diff options
author | Raymond Hettinger <python@rcn.com> | 2009-12-10 03:03:02 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-12-10 03:03:02 +0000 |
commit | e6d2db314dd31939f13b1c3d10ec1133c4cdc010 (patch) | |
tree | e14e04b604c04b28bc7fa8e383a82fa7db592e0e /Lib/test/test_deque.py | |
parent | 3109ebd6a19ed38b1b76978c7c8b07b58570ba88 (diff) | |
download | cpython-e6d2db314dd31939f13b1c3d10ec1133c4cdc010.tar.gz |
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 cdb0dab0f0..8120e8b783 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)))) |