  class TestBstSuccessor(object):
  
      @raises(Exception)
      def test_bst_successor_empty(self):
          bst_successor(None)
  
      def test_bst_successor(self):
          nodes = {}
          node = Node(5)
          nodes[5] = node
 
</s> remove         nodes[3] = insert(node, 3)
        nodes[8] = insert(node, 8)
        nodes[2] = insert(node, 2)
        nodes[4] = insert(node, 4)
        nodes[6] = insert(node, 6)
        nodes[12] = insert(node, 12)
        nodes[1] = insert(node, 1)
        nodes[7] = insert(node, 7)
        nodes[10] = insert(node, 10)
        nodes[15] = insert(node, 15)
        nodes[9] = insert(node, 9)

        assert_equal(bst_successor(nodes[4]), 5)
        assert_equal(bst_successor(nodes[5]), 6)
        assert_equal(bst_successor(nodes[8]), 9)
        assert_equal(bst_successor(nodes[15]), None)
 </s> add         bst = Bst(nodes[5])
        nodes[3] = bst.insert(3)
        nodes[8] = bst.insert(8)
        nodes[2] = bst.insert(2)
        nodes[4] = bst.insert(4)
        nodes[6] = bst.insert(6)
        nodes[12] = bst.insert(12)
        nodes[1] = bst.insert(1)
        nodes[7] = bst.insert(7)
        nodes[10] = bst.insert(10)
        nodes[15] = bst.insert(15)
        nodes[9] = bst.insert(9)

        bst_successor = BstSuccessor()
        assert_equal(bst_successor.get_next(nodes[4]), 5)
        assert_equal(bst_successor.get_next(nodes[5]), 6)
        assert_equal(bst_successor.get_next(nodes[8]), 9)
        assert_equal(bst_successor.get_next(nodes[15]), None) </s> remove     "        bst_successor(None)\n",
 </s> add     "        bst_successor = BstSuccessor()\n",
    "        bst_successor.get_next(None)\n", </s> remove     "        bst_successor(None)\n",
 </s> add     "        bst_successor = BstSuccessor()\n",
    "        bst_successor.get_next(None)\n", </s> remove     "        nodes[3] = insert(node, 3)\n",
    "        nodes[8] = insert(node, 8)\n",
    "        nodes[2] = insert(node, 2)\n",
    "        nodes[4] = insert(node, 4)\n",
    "        nodes[6] = insert(node, 6)\n",
    "        nodes[12] = insert(node, 12)\n",
    "        nodes[1] = insert(node, 1)\n",
    "        nodes[7] = insert(node, 7)\n",
    "        nodes[10] = insert(node, 10)\n",
    "        nodes[15] = insert(node, 15)\n",
    "        nodes[9] = insert(node, 9)\n",
    "\n",
    "        assert_equal(bst_successor(nodes[4]), 5)\n",
    "        assert_equal(bst_successor(nodes[5]), 6)\n",
    "        assert_equal(bst_successor(nodes[8]), 9)\n",
    "        assert_equal(bst_successor(nodes[15]), None)\n",
 </s> add     "        bst = Bst(nodes[5])\n",
    "        nodes[3] = bst.insert(3)\n",
    "        nodes[8] = bst.insert(8)\n",
    "        nodes[2] = bst.insert(2)\n",
    "        nodes[4] = bst.insert(4)\n",
    "        nodes[6] = bst.insert(6)\n",
    "        nodes[12] = bst.insert(12)\n",
    "        nodes[1] = bst.insert(1)\n",
    "        nodes[7] = bst.insert(7)\n",
    "        nodes[10] = bst.insert(10)\n",
    "        nodes[15] = bst.insert(15)\n",
    "        nodes[9] = bst.insert(9)\n",
    "\n",
    "        bst_successor = BstSuccessor()\n",
    "        assert_equal(bst_successor.get_next(nodes[4]), 5)\n",
    "        assert_equal(bst_successor.get_next(nodes[5]), 6)\n",
    "        assert_equal(bst_successor.get_next(nodes[8]), 9)\n",
    "        assert_equal(bst_successor.get_next(nodes[15]), None)\n", </s> remove     "        nodes[3] = insert(node, 3)\n",
    "        nodes[8] = insert(node, 8)\n",
    "        nodes[2] = insert(node, 2)\n",
    "        nodes[4] = insert(node, 4)\n",
    "        nodes[6] = insert(node, 6)\n",
    "        nodes[12] = insert(node, 12)\n",
    "        nodes[1] = insert(node, 1)\n",
    "        nodes[7] = insert(node, 7)\n",
    "        nodes[10] = insert(node, 10)\n",
    "        nodes[15] = insert(node, 15)\n",
    "        nodes[9] = insert(node, 9)\n",
    "\n",
    "        assert_equal(bst_successor(nodes[4]), 5)\n",
    "        assert_equal(bst_successor(nodes[5]), 6)\n",
    "        assert_equal(bst_successor(nodes[8]), 9)\n",
    "        assert_equal(bst_successor(nodes[15]), None)\n",
 </s> add     "        bst = Bst(nodes[5])\n",
    "        nodes[3] = bst.insert(3)\n",
    "        nodes[8] = bst.insert(8)\n",
    "        nodes[2] = bst.insert(2)\n",
    "        nodes[4] = bst.insert(4)\n",
    "        nodes[6] = bst.insert(6)\n",
    "        nodes[12] = bst.insert(12)\n",
    "        nodes[1] = bst.insert(1)\n",
    "        nodes[7] = bst.insert(7)\n",
    "        nodes[10] = bst.insert(10)\n",
    "        nodes[15] = bst.insert(15)\n",
    "        nodes[9] = bst.insert(9)\n",
    "\n",
    "        bst_successor = BstSuccessor()\n",
    "        assert_equal(bst_successor.get_next(nodes[4]), 5)\n",
    "        assert_equal(bst_successor.get_next(nodes[5]), 6)\n",
    "        assert_equal(bst_successor.get_next(nodes[8]), 9)\n",
    "        assert_equal(bst_successor.get_next(nodes[15]), None)\n",
        bst_successor = BstSuccessor()
        bst_successor.get_next(None)
  class TestBstSuccessor(object):
  
      @raises(Exception)
      def test_bst_successor_empty(self):
        bst_successor = BstSuccessor()
        bst_successor.get_next(None)
  
      def test_bst_successor(self):
          nodes = {}
          node = Node(5)
          nodes[5] = node
keep keep keep keep replace keep keep keep keep keep
 Move bst successor to a class 
graphs_trees/bst_successor/test_bst_successor.py