  
  class TestHeight(object):
  
      def test_height(self):
          root = Node(5)
          assert_equal(height(root), 1)
          insert(root, 2)
          insert(root, 8)
          insert(root, 1)
          insert(root, 3)
          assert_equal(height(root), 3)
  
          print('Success: test_height')
  
  
  def main():
 
</s> remove     "        root = Node(5)\n",
    "        assert_equal(height(root), 1)\n",
    "        insert(root, 2)\n",
    "        insert(root, 8)\n",
    "        insert(root, 1)\n",
    "        insert(root, 3)\n",
    "        assert_equal(height(root), 3)\n",
 </s> add     "        bst = BstHeight(Node(5))\n",
    "        assert_equal(bst.height(bst.root), 1)\n",
    "        bst.insert(2)\n",
    "        bst.insert(8)\n",
    "        bst.insert(1)\n",
    "        bst.insert(3)\n",
    "        assert_equal(bst.height(bst.root), 3)\n", </s> remove     "        root = Node(5)\n",
    "        assert_equal(height(root), 1)\n",
    "        insert(root, 2)\n",
    "        insert(root, 8)\n",
    "        insert(root, 1)\n",
    "        insert(root, 3)\n",
    "        assert_equal(height(root), 3)\n",
 </s> add     "        bst = BstHeight(Node(5))\n",
    "        assert_equal(bst.height(bst.root), 1)\n",
    "        bst.insert(2)\n",
    "        bst.insert(8)\n",
    "        bst.insert(1)\n",
    "        bst.insert(3)\n",
    "        assert_equal(bst.height(bst.root), 3)\n", </s> remove def height(node):
    if node is None:
        return 0
    return 1 + max(height(node.left), 
                   height(node.right)) </s> add  </s> remove     "def height(node):\n",
    "    # TODO: Implement me\n",
    "    pass"
 </s> add     "class BstHeight(Bst):\n",
    "\n",
    "    def height(self, node):\n",
    "        # TODO: Implement me\n",
    "        pass" </s> remove     "%run height.py"
 </s> add     "class BstHeight(Bst):\n",
    "\n",
    "    def height(self, node):\n",
    "        if node is None:\n",
    "            return 0\n",
    "        return 1 + max(self.height(node.left),\n",
    "                       self.height(node.right))"
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
  
  class TestHeight(object):
  
      def test_height(self):
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
        bst = BstHeight(Node(5))
        assert_equal(bst.height(bst.root), 1)
        bst.insert(2)
        bst.insert(8)
        bst.insert(1)
        bst.insert(3)
        assert_equal(bst.height(bst.root), 3)
  
          print('Success: test_height')
  
  
  def main():
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
 Move tree height to a class 
graphs_trees/tree_height/test_height.py