summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-03-12 20:43:31 (GMT)
committerGuido van Rossum <guido@python.org>2002-03-12 20:43:31 (GMT)
commitd70356729fe2fa93b6e419e78d3dd9433bcf2787 (patch)
treea0dc8f3b4e5c1016a70295c491e0d1dee35e0d6e
parentcd637aae5665d40c405a173efd5d9f174e63bf5c (diff)
downloadcpython-d70356729fe2fa93b6e419e78d3dd9433bcf2787.zip
cpython-d70356729fe2fa93b6e419e78d3dd9433bcf2787.tar.gz
cpython-d70356729fe2fa93b6e419e78d3dd9433bcf2787.tar.bz2
Test for the fix I just checked in to moduleobject.c.
Bugfix candidate.
-rw-r--r--Lib/test/test_descr.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index a640bb4..7e48884 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__":