[Python-checkins] python/dist/src/Lib/test test_descr.py,1.175,1.176

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 07 Jan 2003 05:41:40 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv4861/Lib/test

Modified Files:
	test_descr.py 
Log Message:
Fix for SF bug #642358: only provide a new with a __dict__ or
__weaklist__ descriptor if we added __dict__ or __weaklist__,
respectively.  With unit test.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.175
retrieving revision 1.176
diff -C2 -d -r1.175 -r1.176
*** test_descr.py	6 Jan 2003 23:00:59 -0000	1.175
--- test_descr.py	7 Jan 2003 13:41:37 -0000	1.176
***************
*** 3687,3690 ****
--- 3687,3703 ----
      vereq(C(1) / E(1), "C.__div__") # This one would fail
  
+ def dict_type_with_metaclass():
+     if verbose:
+         print "Testing type of __dict__ when __metaclass__ set..."
+ 
+     class B(object):
+         pass
+     class M(type):
+         pass
+     class C:
+         # In 2.3a1, C.__dict__ was a real dict rather than a dict proxy
+         __metaclass__ = M
+     veris(type(C.__dict__), type(B.__dict__))
+ 
  
  def test_main():
***************
*** 3772,3775 ****
--- 3785,3789 ----
      mutable_names()
      subclass_right_op()
+     dict_type_with_metaclass()
  
      if verbose: print "All OK"