mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-08 10:28:03 +00:00
@@ -103,9 +103,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class GraphPathExists(Graph):\n",
|
||||
@@ -132,16 +130,14 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_path_exists.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestPathExists(object):\n",
|
||||
"class TestPathExists(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_path_exists(self):\n",
|
||||
" nodes = []\n",
|
||||
@@ -157,9 +153,9 @@
|
||||
" graph.add_edge(3, 2, 7)\n",
|
||||
" graph.add_edge(3, 4, 8)\n",
|
||||
"\n",
|
||||
" assert_equal(graph.path_exists(nodes[0], nodes[2]), True)\n",
|
||||
" assert_equal(graph.path_exists(nodes[0], nodes[0]), True)\n",
|
||||
" assert_equal(graph.path_exists(nodes[4], nodes[5]), False)\n",
|
||||
" self.assertEqual(graph.path_exists(nodes[0], nodes[2]), True)\n",
|
||||
" self.assertEqual(graph.path_exists(nodes[0], nodes[0]), True)\n",
|
||||
" self.assertEqual(graph.path_exists(nodes[4], nodes[5]), False)\n",
|
||||
"\n",
|
||||
" print('Success: test_path_exists')\n",
|
||||
"\n",
|
||||
@@ -199,9 +195,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