[Python-checkins] CVS: python/dist/src/Lib/test test_pkg.py,1.7,1.8
Thomas Wouters
python-dev@python.org
Thu, 17 Aug 2000 15:55:02 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv24798/Lib/test
Modified Files:
test_pkg.py
Log Message:
Apply SF patch #101135, adding 'import module as m' and 'from module import
name as n'. By doing some twists and turns, "as" is not a reserved word.
There is a slight change in semantics for 'from module import name' (it will
now honour the 'global' keyword) but only in cases that are explicitly
undocumented.
Index: test_pkg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkg.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_pkg.py 1998/05/19 15:09:42 1.7
--- test_pkg.py 2000/08/17 22:54:59 1.8
***************
*** 166,169 ****
--- 166,196 ----
print dir()
"""),
+
+ ("t7", [
+ ("t7.py", "print 'Importing t7.py'"),
+ ("t7", None),
+ ("t7 __init__.py", "print __name__, 'loading'"),
+ ("t7 sub.py", "print 'THIS SHOULD NOT BE PRINTED (sub.py)'"),
+ ("t7 sub", None),
+ ("t7 sub __init__.py", ""),
+ ("t7 sub subsub.py", "print 'THIS SHOULD NOT BE PRINTED (subsub.py)'"),
+ ("t7 sub subsub", None),
+ ("t7 sub subsub __init__.py", "print __name__, 'loading'; spam = 1"),
+ ],
+ """
+ t7, sub, subsub = None, None, None
+ import t7 as tas
+ print dir(tas)
+ assert not t7
+ from t7 import sub as subpar
+ print dir(subpar)
+ assert not t7 and not sub
+ from t7.sub import subsub as subsubsub
+ print dir(subsubsub)
+ assert not t7 and not sub and not subsub
+ from t7.sub.subsub import spam as ham
+ print "t7.sub.subsub.spam =", ham
+ assert not t7 and not sub and not subsub
+ """),
]