Python: Add variable with underscore to __all__ tests

This commit is contained in:
Rasmus Wriedt Larsen
2021-04-06 11:54:25 +02:00
parent 224d3790b5
commit bc49bc7095
2 changed files with 8 additions and 0 deletions

View File

@@ -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))

View File

@@ -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"