test.extra.test_heap module

Test that the heap implementation works as required.

class test.extra.test_heap.TestHeap(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Sets up all tests.

Creates two heaps (a min-heap and a max-heap) and fills them with 10,000 random integers.

test_insert()[source]

Tests the insertion in the heap.

test_pop()[source]

Tests the pop of the max/min item in the heap.

test_peek()[source]

Tests peeking of items (and regaining their indexes) of the heap.