diff options
author | Zackery Spytz <zspytz@gmail.com> | 2021-04-02 15:28:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-02 15:28:35 (GMT) |
commit | afd12650580725ac598b2845384771c14c4f952e (patch) | |
tree | 2290e54eaa5fdb75d0b0513f0e575c440150fafd /Lib/test/test_array.py | |
parent | 240bcf82a11fe7433a61da70605e924c53b88096 (diff) | |
download | cpython-afd12650580725ac598b2845384771c14c4f952e.zip cpython-afd12650580725ac598b2845384771c14c4f952e.tar.gz cpython-afd12650580725ac598b2845384771c14c4f952e.tar.bz2 |
bpo-31956: Add start and stop parameters to array.index() (GH-25059)
Co-Authored-By: Anders Lorentsen <Phaqui@gmail.com>
Diffstat (limited to 'Lib/test/test_array.py')
-rw-r--r-- | Lib/test/test_array.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 77a0c64..bdcd125 100644 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -918,6 +918,17 @@ class BaseTest: self.assertRaises(ValueError, a.index, None) self.assertRaises(ValueError, a.index, self.outside) + a = array.array('i', [-2, -1, 0, 0, 1, 2]) + self.assertEqual(a.index(0), 2) + self.assertEqual(a.index(0, 2), 2) + self.assertEqual(a.index(0, -4), 2) + self.assertEqual(a.index(-2, -10), 0) + self.assertEqual(a.index(0, 3), 3) + self.assertEqual(a.index(0, -3), 3) + self.assertEqual(a.index(0, 3, 4), 3) + self.assertEqual(a.index(0, -3, -2), 3) + self.assertRaises(ValueError, a.index, 2, 0, -10) + def test_count(self): example = 2*self.example a = array.array(self.typecode, example) |