summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_deque.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2018-09-21 08:46:41 (GMT)
committerGitHub <noreply@github.com>2018-09-21 08:46:41 (GMT)
commitb46ad5431d2643f61e929c1ffec48766b2fafd75 (patch)
treed82d6b7498df61a8f86afdb38f5396c826b7c4a3 /Lib/test/test_deque.py
parentfb3e9c00ed79f4d880ab9a67aab861eb3660ec75 (diff)
downloadcpython-b46ad5431d2643f61e929c1ffec48766b2fafd75.zip
cpython-b46ad5431d2643f61e929c1ffec48766b2fafd75.tar.gz
cpython-b46ad5431d2643f61e929c1ffec48766b2fafd75.tar.bz2
Minor performance tweak for deque.index() with a start argument (GH-9440)
Diffstat (limited to 'Lib/test/test_deque.py')
-rw-r--r--Lib/test/test_deque.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index 9211360..51b66b7 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -288,6 +288,14 @@ class TestBasic(unittest.TestCase):
else:
self.assertEqual(d.index(element, start, stop), target)
+ # Test large start argument
+ d = deque(range(0, 10000, 10))
+ for step in range(100):
+ i = d.index(8500, 700)
+ self.assertEqual(d[i], 8500)
+ # Repeat test with a different internal offset
+ d.rotate()
+
def test_index_bug_24913(self):
d = deque('A' * 3)
with self.assertRaises(ValueError):