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

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 29 Jun 2001 09:32:47 -0700


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

Modified Files:
      Tag: descr-branch
	test_descr.py 
Log Message:
Simplify and change the spam API: instead of exporting a separate type
object and constructor function for each type, the module now exports
just the type, by its natural name (spamlist or spamdict).


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -C2 -r1.1.2.21 -r1.1.2.22
*** test_descr.py	2001/06/29 15:59:55	1.1.2.21
--- test_descr.py	2001/06/29 16:32:45	1.1.2.22
***************
*** 221,229 ****
      def spamlist(l, memo=None):
          import spam
!         sl = spam.list()
!         for i in l: sl.append(i)
!         return sl
      # This is an ugly hack:
!     copy._deepcopy_dispatch[spam.SpamListType] = spamlist
  
      testbinop(spamlist([1]), spamlist([2]), spamlist([1,2]), "a+b", "__add__")
--- 221,227 ----
      def spamlist(l, memo=None):
          import spam
!         return spam.spamlist(l)
      # This is an ugly hack:
!     copy._deepcopy_dispatch[spam.spamlist] = spamlist
  
      testbinop(spamlist([1]), spamlist([2]), spamlist([1,2]), "a+b", "__add__")
***************
*** 249,257 ****
      def spamdict(d, memo=None):
          import spam
!         sd = spam.dict()
          for k, v in d.items(): sd[k] = v
          return sd
      # This is an ugly hack:
!     copy._deepcopy_dispatch[spam.SpamDictType] = spamdict
  
      testbinop(spamdict({1:2}), spamdict({2:1}), -1, "cmp(a,b)", "__cmp__")
--- 247,255 ----
      def spamdict(d, memo=None):
          import spam
!         sd = spam.spamdict()
          for k, v in d.items(): sd[k] = v
          return sd
      # This is an ugly hack:
!     copy._deepcopy_dispatch[spam.spamdict] = spamdict
  
      testbinop(spamdict({1:2}), spamdict({2:1}), -1, "cmp(a,b)", "__cmp__")