[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.27,1.1.2.28

Guido van Rossum gvanrossum@users.sourceforge.net
Thu, 05 Jul 2001 14:33:03 -0700


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

Modified Files:
      Tag: descr-branch
	test_descr.py 
Log Message:
metaclass(): add a test to check that methods defined by the metaclass
are properly bound to the class.  (This checks for the bug I just
fixed.)


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -C2 -r1.1.2.27 -r1.1.2.28
*** test_descr.py	2001/07/04 00:44:00	1.1.2.27
--- test_descr.py	2001/07/05 21:33:01	1.1.2.28
***************
*** 366,370 ****
      global C
      class C:
!         __metaclass__ = type(type(0))
          def __init__(self):
              self.__state = 0
--- 366,370 ----
      global C
      class C:
!         __metaclass__ = type
          def __init__(self):
              self.__state = 0
***************
*** 377,380 ****
--- 377,384 ----
      a.setstate(10)
      verify(a.getstate() == 10)
+     class D:
+         class __metaclass__(type):
+             def myself(cls): return cls
+     verify(D.myself() == D)
  
  import sys