summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_slice.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-07-02 16:11:42 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-07-02 16:11:42 (GMT)
commitfea6a94b3b8650523078432b4417bb9f5f09b76b (patch)
tree30403256638ec5eb5efbb83b678487623354c93b /Lib/test/test_slice.py
parent464109a893619cd1866e95724f18e1b4c57442c0 (diff)
downloadcpython-fea6a94b3b8650523078432b4417bb9f5f09b76b.zip
cpython-fea6a94b3b8650523078432b4417bb9f5f09b76b.tar.gz
cpython-fea6a94b3b8650523078432b4417bb9f5f09b76b.tar.bz2
Merged revisions 64365,64370,64406,64408-64409,64412,64416-64417,64420-64421,64425-64428 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64365 | raymond.hettinger | 2008-06-17 19:56:57 -0500 (Tue, 17 Jun 2008) | 1 line Fix double decref. ........ r64370 | mark.dickinson | 2008-06-18 04:20:17 -0500 (Wed, 18 Jun 2008) | 2 lines Typo fix ........ r64406 | andrew.kuchling | 2008-06-19 09:02:30 -0500 (Thu, 19 Jun 2008) | 1 line Only include update_lines_cols() function when it's actually going to be used ........ r64408 | amaury.forgeotdarc | 2008-06-19 14:57:39 -0500 (Thu, 19 Jun 2008) | 2 lines test_macos can be skipped on non-mac platforms. ........ r64409 | andrew.kuchling | 2008-06-19 15:33:31 -0500 (Thu, 19 Jun 2008) | 1 line Put threading in front of thread ........ r64412 | amaury.forgeotdarc | 2008-06-19 16:17:12 -0500 (Thu, 19 Jun 2008) | 3 lines In test_site, correctly escape backslashes in path names. This allows the test to pass when the username begins with a lowercase 't'... ........ r64416 | vinay.sajip | 2008-06-19 17:40:17 -0500 (Thu, 19 Jun 2008) | 2 lines Bug #3136: fileConfig()'s disabling of old loggers is now conditional via an optional disable_existing_loggers parameter, but the default value is such that the old behaviour is preserved. Thanks to Leandro Lucarella for the patch. ........ r64417 | vinay.sajip | 2008-06-19 17:41:08 -0500 (Thu, 19 Jun 2008) | 1 line Updated with fix for #3136. ........ r64420 | andrew.kuchling | 2008-06-19 21:05:57 -0500 (Thu, 19 Jun 2008) | 1 line Various items ........ r64421 | andrew.kuchling | 2008-06-19 21:11:42 -0500 (Thu, 19 Jun 2008) | 1 line Fix comment typos ........ r64425 | andrew.kuchling | 2008-06-20 06:39:54 -0500 (Fri, 20 Jun 2008) | 1 line Various items ........ r64426 | mark.dickinson | 2008-06-20 09:53:43 -0500 (Fri, 20 Jun 2008) | 4 lines Issue #3004: Minor fix to slice.indices(). slice(-10).indices(9) now returns (0, 0, 1) instead of (0, -1, 1), and slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9, 10, -1). ........ r64427 | mark.dickinson | 2008-06-20 10:17:41 -0500 (Fri, 20 Jun 2008) | 2 lines Fix outdated count of the number of new math module functions. ........ r64428 | mark.dickinson | 2008-06-20 10:26:19 -0500 (Fri, 20 Jun 2008) | 2 lines Fix another typo in math_sum comment ........
Diffstat (limited to 'Lib/test/test_slice.py')
-rw-r--r--Lib/test/test_slice.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index e619746..640c8c0 100644
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -82,6 +82,20 @@ class SliceTest(unittest.TestCase):
self.assertEqual(slice(None, None, -1).indices(10), (9, -1, -1))
self.assertEqual(slice(None, None, -2).indices(10), (9, -1, -2))
self.assertEqual(slice(3, None, -2).indices(10), (3, -1, -2))
+ # issue 3004 tests
+ self.assertEqual(slice(None, -9).indices(10), (0, 1, 1))
+ self.assertEqual(slice(None, -10).indices(10), (0, 0, 1))
+ self.assertEqual(slice(None, -11).indices(10), (0, 0, 1))
+ self.assertEqual(slice(None, -10, -1).indices(10), (9, 0, -1))
+ self.assertEqual(slice(None, -11, -1).indices(10), (9, -1, -1))
+ self.assertEqual(slice(None, -12, -1).indices(10), (9, -1, -1))
+ self.assertEqual(slice(None, 9).indices(10), (0, 9, 1))
+ self.assertEqual(slice(None, 10).indices(10), (0, 10, 1))
+ self.assertEqual(slice(None, 11).indices(10), (0, 10, 1))
+ self.assertEqual(slice(None, 8, -1).indices(10), (9, 8, -1))
+ self.assertEqual(slice(None, 9, -1).indices(10), (9, 9, -1))
+ self.assertEqual(slice(None, 10, -1).indices(10), (9, 9, -1))
+
self.assertEqual(
slice(-100, 100 ).indices(10),
slice(None).indices(10)