[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.79,1.80
Guido van Rossum
gvanrossum@users.sourceforge.net
Tue, 02 Oct 2001 12:58:34 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv10734
Modified Files:
test_descr.py
Log Message:
pickles():
- The test for deepcopy() in pickles() was indented wrongly, so it got
run twice (one for binary pickle mode, one for text pickle mode; but
the test doesn't depend on the pickle mode).
- In verbose mode, show which subtest (pickle/cPickle/deepcopy, text/bin).
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -d -r1.79 -r1.80
*** test_descr.py 2001/09/29 00:40:25 1.79
--- test_descr.py 2001/10/02 19:58:32 1.80
***************
*** 2082,2085 ****
--- 2082,2087 ----
for p in pickle, cPickle:
for bin in 0, 1:
+ if verbose:
+ print p.__name__, ["text", "binary"][bin]
for cls in C, C1, C2:
***************
*** 2102,2123 ****
print "b = y =", b
! # Testing copy.deepcopy()
! import copy
! for cls in C, C1, C2:
! cls2 = copy.deepcopy(cls)
! verify(cls2 is cls)
! a = C1(1, 2); a.append(42); a.append(24)
! b = C2("hello", "world", 42)
! x, y = copy.deepcopy((a, b))
! assert x.__class__ == a.__class__
! assert sorteditems(x.__dict__) == sorteditems(a.__dict__)
! assert y.__class__ == b.__class__
! assert sorteditems(y.__dict__) == sorteditems(b.__dict__)
! assert `x` == `a`
! assert `y` == `b`
! if verbose:
! print "a = x =", a
! print "b = y =", b
def copies():
--- 2104,2127 ----
print "b = y =", b
! # Testing copy.deepcopy()
! if verbose:
! print "deepcopy"
! import copy
! for cls in C, C1, C2:
! cls2 = copy.deepcopy(cls)
! verify(cls2 is cls)
! a = C1(1, 2); a.append(42); a.append(24)
! b = C2("hello", "world", 42)
! x, y = copy.deepcopy((a, b))
! assert x.__class__ == a.__class__
! assert sorteditems(x.__dict__) == sorteditems(a.__dict__)
! assert y.__class__ == b.__class__
! assert sorteditems(y.__dict__) == sorteditems(b.__dict__)
! assert `x` == `a`
! assert `y` == `b`
! if verbose:
! print "a = x =", a
! print "b = y =", b
def copies():