mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-11 03:48:03 +00:00
@@ -142,12 +142,13 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_bfs.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestBfs(object):\n",
|
||||
"class TestBfs(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def __init__(self):\n",
|
||||
" def __init__(self, *args, **kwargs):\n",
|
||||
" super(TestBfs, self).__init__()\n",
|
||||
" self.results = Results()\n",
|
||||
"\n",
|
||||
" def test_bfs(self):\n",
|
||||
@@ -164,7 +165,7 @@
|
||||
" graph.add_edge(3, 2, 7)\n",
|
||||
" graph.add_edge(3, 4, 8)\n",
|
||||
" graph.bfs(nodes[0], self.results.add_result)\n",
|
||||
" assert_equal(str(self.results), \"[0, 1, 4, 5, 3, 2]\")\n",
|
||||
" self.assertEqual(str(self.results), \"[0, 1, 4, 5, 3, 2]\")\n",
|
||||
"\n",
|
||||
" print('Success: test_bfs')\n",
|
||||
"\n",
|
||||
@@ -204,7 +205,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.4"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user