def test_find(self):
     node = Node(3)
     node.insert(1)
     node.insert(0)
     node.insert(5)
     node = node._parent
     self.assertTrue(node.find(0))
     self.assertTrue(node.find(5))
     self.assertFalse(node.find(10))
 def test_get_inorder(self):
     node = Node(3)
     node.insert(1)
     node.insert(5)
     self.assertListEqual([(1, NodeColor.RED), (3, NodeColor.BLACK),
                           (5, NodeColor.RED)], node.get_inorder())
     node.insert(6)
     self.assertListEqual([(1, NodeColor.BLACK), (3, NodeColor.BLACK),
                           (5, NodeColor.BLACK), (6, NodeColor.RED)],
                          node.get_inorder())
 def test_right_left_case(self):
     root = Node(15)
     root._color = NodeColor.BLACK
     root._left = Node(7)
     root._left._color = NodeColor.BLACK
     root._left._parent = root
     root._right = Node(25)
     root._right._color = NodeColor.RED
     root._right._parent = root
     self.assertListEqual([(7, NodeColor.BLACK), (15, NodeColor.BLACK),
                           (25, NodeColor.RED)], root.get_inorder())
     root.insert(24)
     root = root._parent
     self.assertListEqual([(7, NodeColor.BLACK), (15, NodeColor.RED),
                           (24, NodeColor.BLACK), (25, NodeColor.RED)],
                          root.get_inorder())
 def test_insert(self):
     node = Node(3)
     self.assertFalse(node.insert(3))
     self.assertTrue(node.insert(1))