def test_nochild(self, ismin, heapsize, aexp, parent, child): ''' Test if the functions correctly recognize leaves of the heap (those with no children) ''' modheap.initialize_heap(ismin, aexp, CMP_FUNCTION) modheap.import_list(self.nlist(heapsize)) self.assertEqual(child, modheap.get_leftmostchild_index(parent))
def test_indices(self, ismin, heapsize, aexp, parent, child): ''' Test max elements of the heap ''' modheap.initialize_heap(ismin, aexp, CMP_FUNCTION) modheap.import_list(self.nlist(heapsize)) self.assertEqual(child, modheap.get_leftmostchild_index(parent)) self.assertEqual(parent, modheap.get_parent_index(child))