Skip to content
Closed
Prev Previous commit
Next Next commit
whitespace
  • Loading branch information
kristjanvalur committed Jan 5, 2024
commit 5b79953a588ebc38ece23d522221b89a68614d78
7 changes: 3 additions & 4 deletions Lib/test/test_heapq.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def test_remove(self):
self.module.heapremove(data, len(data))
with self.assertRaises(IndexError) as e:
self.module.heapremove(data, -len(data) - 1)

for i in range(len(data)):
i = random.randrange(-len(data), len(data))
if random.random() < 0.05:
Expand All @@ -291,7 +291,7 @@ def test_remove_replace(self):
self.module.heapremove(data, len(data))
with self.assertRaises(IndexError) as e:
self.module.heapremove(data, -len(data) - 1)

for i in range(200):
i = random.randrange(-len(data), len(data))
if random.random() < 0.05:
Expand All @@ -303,15 +303,14 @@ def test_remove_replace(self):
v = data[i]
assert self.module.heapremove(data, i, replace) is v
self.check_invariant(data)

self.assertEqual(len(data), 100)

def test_remove_replace_err(self):
data = [random.random() for i in range(100)]
self.module.heapify(data)
with self.assertRaisesRegex(TypeError, r"not supported.*'str' and 'float'"):
self.module.heapremove(data, 50, "foo")


class TestHeapPython(TestHeap, TestCase):
module = py_heapq
Expand Down