[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.56,1.57
Guido van Rossum
gvanrossum@users.sourceforge.net
2001年9月14日 20:14:34 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv29209/Lib/test
Modified Files:
test_descr.py
Log Message:
A fix for SF bug #461546 (bug in long_mul).
Both int and long multiplication are changed to be more careful in
their assumptions about when one of the arguments is a sequence: the
assumption that at least one of the arguments must be an int (or long,
respectively) is still held, but the assumption that these don't smell
like sequences is no longer true: a subtype of int or long may well
have a sequence-repeat thingie!
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** test_descr.py 2001年09月14日 00:25:33 1.56
--- test_descr.py 2001年09月15日 03:14:32 1.57
***************
*** 897,900 ****
--- 897,913 ----
verify(d.foo == 1)
+ # Test handling of int*seq and seq*int
+ class I(int):
+ __dynamic__ = 1
+ verify("a"*I(2) == "aa")
+ verify(I(2)*"a" == "aa")
+
+ # Test handling of long*seq and seq*long
+ class L(long):
+ __dynamic__ = 1
+ verify("a"*L(2L) == "aa")
+ verify(L(2L)*"a" == "aa")
+
+
def errors():
if verbose: print "Testing errors..."