mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Python: Add variable with underscore to __all__ tests
This commit is contained in:
@@ -17,6 +17,10 @@ print("no_all.py")
|
||||
print(" foo={!r}".format(foo))
|
||||
print(" bar={!r}".format(bar))
|
||||
print(" baz={!r}".format(baz))
|
||||
try:
|
||||
print(" _qux={!r}".format(_qux))
|
||||
except NameError:
|
||||
print(" _qux not imported")
|
||||
del foo, bar, baz
|
||||
|
||||
from all_list import *
|
||||
@@ -82,3 +86,5 @@ for mod in [no_all, all_list, all_tuple, all_dynamic, all_indirect, all_set]:
|
||||
print(" foo={!r}".format(mod.foo))
|
||||
print(" bar={!r}".format(mod.bar))
|
||||
print(" baz={!r}".format(mod.baz))
|
||||
|
||||
print("\nspecial: no_all._qux={!r}".format(no_all._qux))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
foo = "foo"
|
||||
bar = "bar"
|
||||
baz = "baz"
|
||||
# When `__all__` is not defined, names starting with underscore is not imported with `from <module> import *`
|
||||
_qux = "qux"
|
||||
|
||||
Reference in New Issue
Block a user