summaryrefslogtreecommitdiff
path: root/Lib/test/test_slice.py
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-11-05 15:28:51 +0000
committerMichael W. Hudson <mwh@python.net>2002-11-05 15:28:51 +0000
commit41a618cf8f54c7ebc5475d84f7350721aaee05ce (patch)
treea7b408e63b90041ad3e08f57de8002f86b586e39 /Lib/test/test_slice.py
parentf555bd64f2ca7e3fcf8c3b18530b8b19a00a3c28 (diff)
downloadcpython-41a618cf8f54c7ebc5475d84f7350721aaee05ce.tar.gz
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!).
Diffstat (limited to 'Lib/test/test_slice.py')
-rw-r--r--Lib/test/test_slice.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index 7b3ee067ba..49ed20eb70 100644
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -1,6 +1,7 @@
# tests for slice objects; in particular the indices method.
from test.test_support import vereq
+import sys
vereq(slice(None ).indices(10), (0, 10, 1))
vereq(slice(None, None, 2).indices(10), (0, 10, 2))
@@ -11,3 +12,5 @@ vereq(slice(3, None, -2).indices(10), (3, -1, -2))
vereq(slice(-100, 100 ).indices(10), slice(None).indices(10))
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])