[Python-checkins] python/dist/src/Lib/test test_slice.py,1.3,1.4

mwh@users.sourceforge.net mwh@users.sourceforge.net
2002年11月05日 07:28:53 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv7435/Lib/test
Modified Files:
	test_slice.py 
Log Message:
Some days, I think my comment of
	/* this is harder to get right than you might think */
angered some God somewhere. After noticing
 >>> range(5000000)[slice(96360, None, 439)]
 []
I found that my cute test for the slice being empty failed due to
overflow. Fixed, and added simple test (not the above!).
Index: test_slice.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_slice.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_slice.py	8 Aug 2002 20:19:19 -0000	1.3
--- test_slice.py	5 Nov 2002 15:28:50 -0000	1.4
***************
*** 2,5 ****
--- 2,6 ----
 
 from test.test_support import vereq
+ import sys
 
 vereq(slice(None ).indices(10), (0, 10, 1))
***************
*** 12,13 ****
--- 13,16 ----
 vereq(slice(100, -100, -1).indices(10), slice(None, None, -1).indices(10))
 vereq(slice(-100L, 100L, 2L).indices(10), (0, 10, 2))
+ 
+ vereq(range(10)[::sys.maxint - 1], [0])

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