diff options
author | Raymond Hettinger <python@rcn.com> | 2013-09-14 20:52:54 -0700 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2013-09-14 20:52:54 -0700 |
commit | c76aa4832b1b5c2898fe78a188835270bf7b70f6 (patch) | |
tree | 1fc9558e5ebc655657a69133ad3aa2ec8c8daabc /Lib/test/test_heapq.py | |
parent | 668dede7e91ebe9d0abce48c2c093781ec1888f5 (diff) | |
parent | 46f5ca31d0856f5d258d86085047eda296ee9972 (diff) | |
download | cpython-git-c76aa4832b1b5c2898fe78a188835270bf7b70f6.tar.gz |
merge
Diffstat (limited to 'Lib/test/test_heapq.py')
-rw-r--r-- | Lib/test/test_heapq.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py index b48ca68461..b5a2fd803a 100644 --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -158,6 +158,15 @@ class TestHeap: self.assertEqual(sorted(chain(*inputs)), list(self.module.merge(*inputs))) self.assertEqual(list(self.module.merge()), []) + def test_merge_does_not_suppress_index_error(self): + # Issue 19018: Heapq.merge suppresses IndexError from user generator + def iterable(): + s = list(range(10)) + for i in range(20): + yield s[i] # IndexError when i > 10 + with self.assertRaises(IndexError): + list(self.module.merge(iterable(), iterable())) + def test_merge_stability(self): class Int(int): pass |