def test_left_or_right_child_equal_value(self): bt = BinaryTree() bt.root = Node(4) bt.root.left_child = Node(3) bt.root.right_child = Node(7) result = bt._left_or_right_child(bt.root, 4) self.assertEqual(bt.root.right_child, result)
def test_left_or_right_child_no_larger_child(self): bt = BinaryTree() bt.root = Node(4) bt.root.left_child = Node(3) result = bt._left_or_right_child(bt.root, 5) self.assertEqual(None, result)
def test_left_or_right_child_no_smaller_child(self): bt = BinaryTree() bt.root = Node(4) bt.root.right_child = Node(7) result = bt._left_or_right_child(bt.root, 2) self.assertEqual(None, result)