diff options
author | Michael W. Hudson <mwh@python.net> | 2002-07-19 15:47:06 +0000 |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2002-07-19 15:47:06 +0000 |
commit | 2b7d014fa95d4a97f4006edb57e652d93840b878 (patch) | |
tree | e992dd611189136eb8fd8a869dd11d838a43ef71 /Lib/test/test_slice.py | |
parent | 172b5d5f8a5db8ce5bc7e36fc1be7a54dcd4675c (diff) | |
download | cpython-2b7d014fa95d4a97f4006edb57e652d93840b878.tar.gz |
A few days ago, Guido said (in the thread "[Python-Dev] Python
version of PySlice_GetIndicesEx"):
> OK. Michael, if you want to check in indices(), go ahead.
Then I did what was needed, but didn't check it in. Here it is.
Diffstat (limited to 'Lib/test/test_slice.py')
-rw-r--r-- | Lib/test/test_slice.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py new file mode 100644 index 0000000000..895238f106 --- /dev/null +++ b/Lib/test/test_slice.py @@ -0,0 +1,14 @@ +# tests for slice objects; in particular the indices method. + +from test_support import vereq + +vereq(slice(None ).indices(10), (0, 10, 1)) +vereq(slice(None, None, 2).indices(10), (0, 10, 2)) +vereq(slice(1, None, 2).indices(10), (1, 10, 2)) +vereq(slice(None, None, -1).indices(10), (9, -1, -1)) +vereq(slice(None, None, -2).indices(10), (9, -1, -2)) +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)) + |