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

Guido van Rossum gvanrossum@users.sourceforge.net
2001年10月08日 09:35:47 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv1312
Modified Files:
	test_descr.py 
Log Message:
Change all occurrences of verify(x == y) into vereq(x, y), since when
this type of test fails, vereq() does a better job of reporting than
verify().
Change vereq(x, y) to use "not x == y" rather than "x != y" -- it
makes a difference is some overloading tests.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** test_descr.py	2001年10月04日 05:48:13	1.83
--- test_descr.py	2001年10月08日 16:35:45	1.84
***************
*** 5,43 ****
 
 def vereq(a, b):
! if a != b:
! raise TestFailed, "%r != %r" % (a, b)
 
 def testunop(a, res, expr="len(a)", meth="__len__"):
 if verbose: print "checking", expr
 dict = {'a': a}
! verify(eval(expr, dict) == res)
 t = type(a)
[...2153 lines suppressed...]
 a.bar.append(4)
! verify(d.bar == [1,2,3])
 
 def binopoverride():
--- 2173,2187 ----
 a.foo = 12
 b = copy.copy(a)
! vereq(b.__dict__, a.__dict__)
 
 a.bar = [1,2,3]
 c = copy.copy(a)
! vereq(c.bar, a.bar)
 verify(c.bar is a.bar)
 
 d = copy.deepcopy(a)
! vereq(d.__dict__, a.__dict__)
 a.bar.append(4)
! vereq(d.bar, [1,2,3])
 
 def binopoverride():

AltStyle によって変換されたページ (->オリジナル) /