diff options
author | Raymond Hettinger <python@rcn.com> | 2009-12-10 03:03:02 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-12-10 03:03:02 (GMT) |
commit | 3f9afd816de4067b8277bfe0241cf15d34b13e47 (patch) | |
tree | 4701c6f2330249aeee9a01bd061b2cee3d064e2d /Lib/test/test_deque.py | |
parent | 0f6cae0bffa52b16e09fce41c388b1ef70404c28 (diff) | |
download | cpython-3f9afd816de4067b8277bfe0241cf15d34b13e47.zip cpython-3f9afd816de4067b8277bfe0241cf15d34b13e47.tar.gz cpython-3f9afd816de4067b8277bfe0241cf15d34b13e47.tar.bz2 |
Fix variants of deque.extend: d.extend(d) d+=d d.extendleft(d)
Diffstat (limited to 'Lib/test/test_deque.py')
-rw-r--r-- | Lib/test/test_deque.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index cdb0dab..8120e8b 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -136,12 +136,23 @@ class TestBasic(unittest.TestCase): self.assertRaises(TypeError, d.extend, 1) d.extend('bcd') self.assertEqual(list(d), list('abcd')) + d.extend(d) + self.assertEqual(list(d), list('abcdabcd')) + + def test_iadd(self): + d = deque('a') + d += 'bcd' + self.assertEqual(list(d), list('abcd')) + d += d + self.assertEqual(list(d), list('abcdabcd')) def test_extendleft(self): d = deque('a') self.assertRaises(TypeError, d.extendleft, 1) d.extendleft('bcd') self.assertEqual(list(d), list(reversed('abcd'))) + d.extendleft(d) + self.assertEqual(list(d), list('abcddcba')) d = deque() d.extendleft(range(1000)) self.assertEqual(list(d), list(reversed(range(1000)))) |