summaryrefslogtreecommitdiffstats
path: root/Lib/test/list_tests.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2011-11-05 21:23:17 (GMT)
committerPetri Lehtinen <petri@digip.org>2011-11-05 21:25:34 (GMT)
commit8e9f6c42513e89cc8ca71e270aeb4a670c431715 (patch)
tree42493db753826247466ba983621fc6679546dca7 /Lib/test/list_tests.py
parent68fb89fdb7f48a354f1fcb95581e7d605d5d53c0 (diff)
parentc2f0a46111dfc9958d1c0428f688b8f625888c88 (diff)
downloadcpython-8e9f6c42513e89cc8ca71e270aeb4a670c431715.zip
cpython-8e9f6c42513e89cc8ca71e270aeb4a670c431715.tar.gz
cpython-8e9f6c42513e89cc8ca71e270aeb4a670c431715.tar.bz2
Accept None as start and stop parameters for list.index() and tuple.index().
Closes #13340.
Diffstat (limited to 'Lib/test/list_tests.py')
-rw-r--r--Lib/test/list_tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 42e118b..0824d48 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -365,6 +365,13 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(u.index(0, 3), 3)
self.assertEqual(u.index(0, 3, 4), 3)
self.assertRaises(ValueError, u.index, 2, 0, -10)
+ self.assertEqual(u.index(1, None), 4)
+ self.assertEqual(u.index(1, None, None), 4)
+ self.assertEqual(u.index(1, 0, None), 4)
+ self.assertEqual(u.index(1, None, 6), 4)
+ self.assertRaises(ValueError, u.index, -1, 3)
+ self.assertRaises(ValueError, u.index, -1, 3, None)
+ self.assertRaises(ValueError, u.index, 1, None, 4)
self.assertRaises(TypeError, u.index)