def test_prev_node_of_min(self):
     """
     test the following binary search tree
          3
         /
        2
       /
      1 <-- get prev node of 1
     """
     bst = BinarySearchTree()
     bst.insert(3)
     bst.insert(2)
     node = bst.insert(1)
     self.assertEqual(bst.prev(node), None)
 def test_prev_node_has_left_subtree(self):
     """
     test the following binary search tree
          4 <-- get prev node of 4
         /
        2
       / \
      1   3
     """
     bst = BinarySearchTree()
     node = bst.insert(4)
     bst.insert(2)
     bst.insert(1)
     expected_prev = bst.insert(3)
     self.assertEqual(bst.prev(node), expected_prev)