def test_creation(self): n = _DSFNode(7) self.assertTrue(n.is_root()) self.assertEqual(n.parent, n) self.assertEqual(n.next, n) self.assertEqual(n.rank, 0) self.assertEqual(n.value, 7)
def test_str(self): n = _DSFNode(39) self.assertEqual("39", str(n))
def test_repr(self): n = _DSFNode(31) self.assertEqual("(value: 31, rank: 0, parent: self)", repr(n)) n.parent = "null" self.assertEqual("(value: 31, rank: 0, parent: null)", repr(n))
def test_creation_custom_rank(self): n = _DSFNode(9, 101) self.assertEqual(n.rank, 101)