mirror of
https://github.com/python/cpython.git
synced 2025-08-16 14:50:43 +00:00
Issue 11004: Fix edge case for deque.count().
This commit is contained in:
parent
51581de168
commit
57a8689b55
3 changed files with 18 additions and 4 deletions
|
@ -137,6 +137,15 @@ class TestBasic(unittest.TestCase):
|
|||
m.d = d
|
||||
self.assertRaises(RuntimeError, d.count, 3)
|
||||
|
||||
# test issue11004
|
||||
# block advance failed after rotation aligned elements on right side of block
|
||||
d = deque([None]*16)
|
||||
for i in range(len(d)):
|
||||
d.rotate(-1)
|
||||
d.rotate(1)
|
||||
self.assertEqual(d.count(1), 0)
|
||||
self.assertEqual(d.count(None), 16)
|
||||
|
||||
def test_comparisons(self):
|
||||
d = deque('xabc'); d.popleft()
|
||||
for e in [d, deque('abc'), deque('ab'), deque(), list(d)]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue