Beispiel #1
0
    def test_node_equal(self):
        n1 = Node(1)
        n2 = Node(2)
        n1.next = n2

        n3 = Node(1)
        n4 = Node(2)
        n3.next = n4
        self.assertEqual(n1, n3)
Beispiel #2
0
 def test_node_repr(self):
     n = Node(1)
     n2 = Node(2)
     n.next = n2
     self.assertEqual(repr(n),
                      "Node({}, {})".format(repr(n.value), repr(n.next)))
Beispiel #3
0
 def test_next_set_invalid(self):
     with self.assertRaises(ValueError):
         n = Node(1)
         n.next = "Hello"
Beispiel #4
0
 def test_next(self):
     n1 = Node(1)
     n2 = Node(2)
     n1.next = n2
     self.assertIs(n1.next, n2)
Beispiel #5
0
 def test_next_set_none(self):
     n = Node(1)
     n.next = None
     self.assertIsNone(n.next)