Пример #1
0
    def test_pre_post(self):
        node = DfsNode()

        node.setPreVisit(11)
        node.setPostVisit(22)

        self.assertEqual(node.getPreVisit(), 11)
        self.assertEqual(node.getPostVisit(), 22)
Пример #2
0
    def test_pre_post_raise(self):
        node = DfsNode()

        node.setPreVisit(11)
        self.assertRaises(Exception, node.setPostVisit, 10)
        self.assertRaises(Exception, node.setPostVisit, 11)
Пример #3
0
    def test_init(self):
        node = DfsNode()

        self.assertEqual(node.getColor(), DfsNode.White)
        self.assertEqual(node.getPreVisit(), -1)
        self.assertEqual(node.getPostVisit(), -1)