mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-10 03:18:02 +00:00
@@ -101,9 +101,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class GraphDfs(Graph):\n",
|
||||
@@ -141,18 +139,17 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_dfs.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestDfs(object):\n",
|
||||
"class TestDfs(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def __init__(self):\n",
|
||||
" def __init__(self, *args, **kwargs):\n",
|
||||
" super(TestDfs, self).__init__()\n",
|
||||
" self.results = Results()\n",
|
||||
"\n",
|
||||
" def test_dfs(self):\n",
|
||||
@@ -169,7 +166,7 @@
|
||||
" graph.add_edge(3, 2, 7)\n",
|
||||
" graph.add_edge(3, 4, 8)\n",
|
||||
" graph.dfs(nodes[0], self.results.add_result)\n",
|
||||
" assert_equal(str(self.results), \"[0, 1, 3, 2, 4, 5]\")\n",
|
||||
" self.assertEqual(str(self.results), \"[0, 1, 3, 2, 4, 5]\")\n",
|
||||
"\n",
|
||||
" print('Success: test_dfs')\n",
|
||||
"\n",
|
||||
@@ -209,9 +206,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user