def test_min_heap_min_2(self):
     test_data = generate_random_list(18, 1, 999)
     mh = binary_min_heap(test_data)
     test_data.sort()
     self.assertEqual(test_data[0], mh.min_heap_get_min())
     ret = mh.min_heap_sort()
     self.assertEqual(test_data, ret)
 def test_min_heap_1(self):
     mh = binary_min_heap(test_list)
     slist = test_list[:]
     slist.sort()
     for i in xrange(len(slist)):
         mh_min = mh.min_heap_extract()
         self.assertEqual(slist[i], mh_min)
 def test_min_heap_data_right(self):
     mh = binary_min_heap(data_right)
     tlist = data_right[:]
     tlist.sort()
     data = mh.min_heap_get_min()
     self.assertEqual(3, data)
     self.assertEqual(tlist, mh.min_heap_sort())
 def test_min_heap_data_1(self):
     mh = binary_min_heap(data_one)
     mh.min_heap_insert(3)
     data = mh.min_heap_extract()
     self.assertEqual(3, data)
     tlist = mh.min_heap_sort()
     self.assertEqual(tlist, data_one)
 def test_min_heap_type_1(self):
     with self.assertRaises(Exception) as cm:
         mh = binary_min_heap([1, 2, '3'])
     self.assertEqual(cm.exception.message,
                      'binary_min_heap::multiple data types are not supported')
 def test_min_heap_4(self):
     mh = binary_min_heap([])
     mh.min_heap_insert(3)
     ret = mh.min_heap_extract()
     self.assertEqual(ret, 3)
 def test_min_heap_min_3(self):
     test_data = [6, 4, 1, 9, 5, 2]
     mh = binary_min_heap(test_data)
     test_data.sort()
     self.assertEqual(test_data[0], mh.min_heap_get_min())
 def test_min_heap_min(self):
     test_data = generate_random_list(9, 1, 49)
     mh = binary_min_heap(test_data)
     test_data.sort()
     self.assertEqual(test_data[0], mh.min_heap_get_min())
 def test_min_heap_2(self):
     mh = binary_min_heap(test_list2)
     slist = test_list2[:]
     slist.sort()
     ret = mh.min_heap_sort()
     self.assertEqual(ret, slist)
 def test_min_heap_data_2(self):
     mh = binary_min_heap(data_one)
     data = mh.min_heap_extract()
     self.assertEqual(9, data)
     tlist = mh.min_heap_sort()
     self.assertEqual(tlist, [])
 def test_min_heap_type_2(self):
     mh = binary_min_heap([9])
     with self.assertRaises(Exception) as cm:
         mh.min_heap_insert('abc')
     self.assertEqual(cm.exception.message,
                      'binary_min_heap::multiple data types are not supported')