Пример #1
0
    def test_init(self):
        item1 = HeapItem(self.Item(15))
        item2 = HeapItem(self.Item(20))
        item3 = HeapItem(self.Item(15))
        self.assertTrue(item1)
        self.assertTrue(item2)
        self.assertTrue(item3)

        self.assertNotEqual(item1, item2)
        self.assertEqual(item1, item3)
        # HeapItem uses negated scores.
        self.assertGreater(item1, item2)
        self.assertLessEqual(item1, item3)
        self.assertTrue(item1 <= item3)
        self.assertFalse(item2 >= item1)
Пример #2
0
    def test_clear(self):
        item = HeapItem(self.Item(15))
        self.assertTrue(item)

        item.clear()
        self.assertFalse(item)
  def test_clear(self):
    item = HeapItem(self.Item(15))
    self.assertTrue(item)

    item.clear()
    self.assertFalse(item)