summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-11-27 16:29:26 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-11-27 16:29:26 (GMT)
commitade8c8b2c3a158013564a6adbd92686b5f3340c9 (patch)
treee991ed37bd078f9730bcebca7f80037be077ae01 /Lib/test
parentdeaba570097c73145a46707efd94134eb2c6cda3 (diff)
downloadcpython-ade8c8b2c3a158013564a6adbd92686b5f3340c9.zip
cpython-ade8c8b2c3a158013564a6adbd92686b5f3340c9.tar.gz
cpython-ade8c8b2c3a158013564a6adbd92686b5f3340c9.tar.bz2
Nudge getting __module__ and __name__ for new-style classes so that
the results of *setting* __name__ are not so surprising. If people can suggest more tests, that'd be grand, or is what's there sufficient?
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_descr.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 99eecd3..76636a9 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3603,7 +3603,15 @@ def mutable_names():
class C(object):
pass
- C.__name__ = 'C'
+ # C.__module__ could be 'test_descr' or '__main__'
+ mod = C.__module__
+
+ C.__name__ = 'D'
+ vereq((C.__module__, C.__name__), (mod, 'D'))
+
+ C.__name__ = 'D.E'
+ vereq((C.__module__, C.__name__), (mod, 'D.E'))
+
def test_main():
do_this_first()