[Python-checkins] python/dist/src/Lib/test test_types.py,1.43,1.44

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sat, 07 Dec 2002 00:10:53 -0800


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

Modified Files:
	test_types.py 
Log Message:
Remove assumption that cls is a subclass of dict.
Simplifies the code and gets Just van Rossum's example to work.


Index: test_types.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** test_types.py	5 Dec 2002 21:32:32 -0000	1.43
--- test_types.py	7 Dec 2002 08:10:51 -0000	1.44
***************
*** 567,573 ****
      def __new__(cls, *args, **kwargs):
          return UserDict(*args, **kwargs)
! try: mydict.fromkeys('a b c'.split())
! except TypeError: pass
! else: raise TestFailed, 'dict.fromkeys() failed to detect non-dict class.'
  # dict.copy()
  d = {1:1, 2:2, 3:3}
--- 567,573 ----
      def __new__(cls, *args, **kwargs):
          return UserDict(*args, **kwargs)
! ud = mydict.fromkeys('ab')
! if ud != {'a':None, 'b':None} or not isinstance(ud,UserDict):
!     raise TestFailed, 'fromkeys did not instantiate using  __new__'
  # dict.copy()
  d = {1:1, 2:2, 3:3}