Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8bf884

Browse files
committed
Added test for __all__.
1 parent e632380 commit c8bf884

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lib/test/output/test_pkg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,10 @@ t5.string loading
2929
['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'foo', 'string', 't5']
3030
['__builtins__', '__doc__', '__file__', '__name__', 'string']
3131
['__builtins__', '__doc__', '__file__', '__name__', 'spam']
32+
running test t6
33+
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__']
34+
t6.spam loading
35+
t6.ham loading
36+
t6.eggs loading
37+
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'eggs', 'ham', 'spam']
38+
['eggs', 'ham', 'spam', 't6']

Lib/test/test_pkg.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,21 @@ def runtest(hier, code):
146146
print dir(t5)
147147
print dir(t5.foo)
148148
print dir(t5.string)
149+
"""),
150+
151+
("t6", [
152+
("t6", None),
153+
("t6 __init__.py", "__all__ = ['spam', 'ham', 'eggs']"),
154+
("t6 spam.py", "print __name__, 'loading'"),
155+
("t6 ham.py", "print __name__, 'loading'"),
156+
("t6 eggs.py", "print __name__, 'loading'"),
157+
],
158+
"""
159+
import t6
160+
print dir(t6)
161+
from t6 import *
162+
print dir(t6)
163+
print dir()
149164
"""),
150165

151166
]

0 commit comments

Comments
 (0)