  class TestCheckBalance(object):
  
      @raises(Exception)
      def test_check_balance_empty(self):
          check_balance(None)
  
      def test_check_balance(self):
          node = Node(5)
          assert_equal(check_balance(node), True)
  
 
</s> remove         node = Node(5)
        assert_equal(check_balance(node), True)

        insert(node, 3)
        insert(node, 8)
        insert(node, 1)
        insert(node, 4)
        assert_equal(check_balance(node), True)

        node = Node(5)
        insert(node, 3)
        insert(node, 8)
        insert(node, 9)
        insert(node, 10)
        assert_equal(check_balance(node), False)

        node = Node(3)
        insert(node, 2)
        insert(node, 1)
        insert(node, 5)
        insert(node, 4)
        insert(node, 6)
        insert(node, 7)
        assert_equal(check_balance(node), False)
 </s> add         bst = BstBalance(Node(5))
        assert_equal(bst.check_balance(), True)

        bst.insert(3)
        bst.insert(8)
        bst.insert(1)
        bst.insert(4)
        assert_equal(bst.check_balance(), True)

        bst = BstBalance(Node(5))
        bst.insert(3)
        bst.insert(8)
        bst.insert(9)
        bst.insert(10)
        assert_equal(bst.check_balance(), False)

        bst = BstBalance(Node(3))
        bst.insert(2)
        bst.insert(1)
        bst.insert(5)
        bst.insert(4)
        bst.insert(6)
        bst.insert(7)
        assert_equal(bst.check_balance(), True) </s> remove     "        check_balance(None)\n",
 </s> add     "        bst = BstBalance(None)\n",
    "        bst.check_balance()\n", </s> remove     "        check_balance(None)\n",
 </s> add     "        bst = BstBalance(None)\n",
    "        bst.check_balance()\n", </s> remove     "        node = Node(5)\n",
    "        assert_equal(check_balance(node), True)\n",
    "\n",
    "        insert(node, 3)\n",
    "        insert(node, 8)\n",
    "        insert(node, 1)\n",
    "        insert(node, 4)\n",
    "        assert_equal(check_balance(node), True)\n",
    "\n",
    "        node = Node(5)\n",
    "        insert(node, 3)\n",
    "        insert(node, 8)\n",
    "        insert(node, 9)\n",
    "        insert(node, 10)\n",
    "        assert_equal(check_balance(node), False)\n",
    "\n",
    "        node = Node(3)\n",
    "        insert(node, 2)\n",
    "        insert(node, 1)\n",
    "        insert(node, 5)\n",
    "        insert(node, 4)\n",
    "        insert(node, 6)\n",
    "        insert(node, 7)\n",
    "        assert_equal(check_balance(node), False)\n",
 </s> add     "        bst = BstBalance(Node(5))\n",
    "        assert_equal(bst.check_balance(), True)\n",
    "\n",
    "        bst.insert(3)\n",
    "        bst.insert(8)\n",
    "        bst.insert(1)\n",
    "        bst.insert(4)\n",
    "        assert_equal(bst.check_balance(), True)\n",
    "\n",
    "        bst = BstBalance(Node(5))\n",
    "        bst.insert(3)\n",
    "        bst.insert(8)\n",
    "        bst.insert(9)\n",
    "        bst.insert(10)\n",
    "        assert_equal(bst.check_balance(), False)\n",
    "\n",
    "        bst = BstBalance(Node(3))\n",
    "        bst.insert(2)\n",
    "        bst.insert(1)\n",
    "        bst.insert(5)\n",
    "        bst.insert(4)\n",
    "        bst.insert(6)\n",
    "        bst.insert(7)\n",
    "        assert_equal(bst.check_balance(), True)\n", </s> remove     "        node = Node(5)\n",
    "        assert_equal(check_balance(node), True)\n",
    "\n",
    "        insert(node, 3)\n",
    "        insert(node, 8)\n",
    "        insert(node, 1)\n",
    "        insert(node, 4)\n",
    "        assert_equal(check_balance(node), True)\n",
    "\n",
    "        node = Node(5)\n",
    "        insert(node, 3)\n",
    "        insert(node, 8)\n",
    "        insert(node, 9)\n",
    "        insert(node, 10)\n",
    "        assert_equal(check_balance(node), False)\n",
    "\n",
    "        node = Node(3)\n",
    "        insert(node, 2)\n",
    "        insert(node, 1)\n",
    "        insert(node, 5)\n",
    "        insert(node, 4)\n",
    "        insert(node, 6)\n",
    "        insert(node, 7)\n",
    "        assert_equal(check_balance(node), False)\n",
 </s> add     "        bst = BstBalance(Node(5))\n",
    "        assert_equal(bst.check_balance(), True)\n",
    "\n",
    "        bst.insert(3)\n",
    "        bst.insert(8)\n",
    "        bst.insert(1)\n",
    "        bst.insert(4)\n",
    "        assert_equal(bst.check_balance(), True)\n",
    "\n",
    "        bst = BstBalance(Node(5))\n",
    "        bst.insert(3)\n",
    "        bst.insert(8)\n",
    "        bst.insert(9)\n",
    "        bst.insert(10)\n",
    "        assert_equal(bst.check_balance(), False)\n",
    "\n",
    "        bst = BstBalance(Node(3))\n",
    "        bst.insert(2)\n",
    "        bst.insert(1)\n",
    "        bst.insert(5)\n",
    "        bst.insert(4)\n",
    "        bst.insert(6)\n",
    "        bst.insert(7)\n",
    "        assert_equal(bst.check_balance(), True)\n",
        bst = BstBalance(None)
        bst.check_balance()
  class TestCheckBalance(object):
  
      @raises(Exception)
      def test_check_balance_empty(self):
        bst = BstBalance(None)
        bst.check_balance()
  
      def test_check_balance(self):
          node = Node(5)
          assert_equal(check_balance(node), True)
  
keep keep keep keep replace keep keep keep keep keep
 Move tree check balance to a class (#99) 
graphs_trees/check_balance/test_check_balance.py