[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.112,1.112.2.1
Guido van Rossum
gvanrossum@users.sourceforge.net
2001年12月13日 20:17:48 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv28461
Modified Files:
Tag: r22rc1-branch
test_descr.py
Log Message:
Fix for SF bug #492345. (I could've sworn I checked this in, but
apparently I didn't!)
This code:
class Classic:
pass
class New(Classic):
__metaclass__ = type
attempts to create a new-style class with only classic bases -- but it
doesn't work right. Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.112
retrieving revision 1.112.2.1
diff -C2 -d -r1.112 -r1.112.2.1
*** test_descr.py 2001年12月11日 04:37:34 1.112
--- test_descr.py 2001年12月14日 04:17:45 1.112.2.1
***************
*** 923,926 ****
--- 923,936 ----
vereq(m.all_method(), "M3 b")
+ class Classic:
+ pass
+ try:
+ class New(Classic):
+ __metaclass__ = type
+ except TypeError:
+ pass
+ else:
+ raise TestFailed, "new class with only classic bases - shouldn't be"
+
def diamond():
if verbose: print "Testing multiple inheritance special cases..."