]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Test for the fix I just checked in to moduleobject.c.
authorGuido van Rossum <guido@python.org>
Tue, 12 Mar 2002 20:43:31 +0000 (20:43 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 12 Mar 2002 20:43:31 +0000 (20:43 +0000)
Bugfix candidate.

Lib/test/test_descr.py

index a640bb45f5503ef28e759c325a94d9dcd490741d..7e48884616341051f81d5f2c15724a953d7f4915 100644 (file)
@@ -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__":