From: Michael W. Hudson Date: Fri, 15 Mar 2002 10:35:55 +0000 (+0000) Subject: backport gvanrossum's checkin of X-Git-Tag: v2.2.1c1~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83a4a8a6c7a501884881422694b49dd803255bec;p=thirdparty%2FPython%2Fcpython.git backport gvanrossum's checkin of revision 1.120 of test_descr.py Test for the fix I just checked in to moduleobject.c. Bugfix candidate. --- diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 32940eb9ebd3..174013438b25 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2730,6 +2730,17 @@ def deepcopyrecursive(): b.a = a z = deepcopy(a) # This blew up before +def modules(): + if verbose: print "Testing uninitialized module objects..." + from types import ModuleType as M + m = M.__new__(M) + str(m) + vereq(hasattr(m, "__name__"), 0) + vereq(hasattr(m, "__file__"), 0) + vereq(hasattr(m, "foo"), 0) + vereq(m.__dict__, None) + m.foo = 1 + vereq(m.__dict__, {"foo": 1}) def test_main(): class_docstrings() @@ -2786,6 +2797,7 @@ def test_main(): hashinherit() strops() deepcopyrecursive() + modules() if verbose: print "All OK" if __name__ == "__main__":