mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 10:58:02 +00:00
@@ -83,9 +83,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class BstHeight(Bst):\n",
|
||||
@@ -112,25 +110,23 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_height.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestHeight(object):\n",
|
||||
"class TestHeight(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_height(self):\n",
|
||||
" bst = BstHeight(Node(5))\n",
|
||||
" assert_equal(bst.height(bst.root), 1)\n",
|
||||
" self.assertEqual(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",
|
||||
" self.assertEqual(bst.height(bst.root), 3)\n",
|
||||
"\n",
|
||||
" print('Success: test_height')\n",
|
||||
"\n",
|
||||
@@ -170,9 +166,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user