mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 19:08:02 +00:00
@@ -77,9 +77,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%run ../bst/bst.py"
|
||||
@@ -88,9 +86,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class BstHeight(Bst):\n",
|
||||
@@ -112,9 +108,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -126,19 +120,19 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile 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",
|
||||
@@ -155,9 +149,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -188,9 +180,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