Exemple #1
0
    def test_Nodelistget(self):
        nl = Nodelist(Node(1, 2, 2), Node(1, 3, 1), Node(1, 4, 2), Node(1, 5, 1), Node(1, 6, 3))
        n = nl.get(x=1, y=5)
        self.assertEqual(n.x, 1)
        self.assertEqual(n.y, 5)

        self.assertIsNone(nl.get(25, 29))
Exemple #2
0
    def test_NodelistAppend(self):
        nl = Nodelist()
        n = Node(1, 1)

        nl.append(n)
        self.assertEqual(len(nl), 1)
        self.assertTrue(n in nl)
Exemple #3
0
    def test_NodelistMin(self):
        nl = Nodelist(Node(1, 2, 2), Node(1, 3, 1), Node(1, 4, 2), Node(1, 5, 1), Node(1, 6, 3))
        self.assertEqual(len(nl), 5)

        self.assertEqual(nl.pop_min().f, 1)
        self.assertEqual(len(nl), 4)

        self.assertEqual(nl.pop_min().f, 1)
        self.assertEqual(len(nl), 3)

        self.assertEqual(nl.pop_min().f, 2)
        self.assertEqual(len(nl), 2)