#273: Remove nose dependency for graphs_trees/ (#277)

This commit is contained in:
Donne Martin
2020-07-10 21:02:32 -04:00
committed by GitHub
parent 139e157250
commit abf7524c26
67 changed files with 860 additions and 1027 deletions

View File

@@ -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
}

View File

@@ -107,9 +107,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%run ../graph/graph.py"
@@ -118,9 +116,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from collections import deque\n",
@@ -157,9 +153,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -171,10 +165,10 @@
],
"source": [
"%%writefile 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",
@@ -190,9 +184,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",
@@ -209,9 +203,7 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -242,9 +234,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
}

View File

@@ -1,7 +1,7 @@
from nose.tools import assert_equal
import unittest
class TestPathExists(object):
class TestPathExists(unittest.TestCase):
def test_path_exists(self):
nodes = []
@@ -17,9 +17,9 @@ class TestPathExists(object):
graph.add_edge(3, 2, 7)
graph.add_edge(3, 4, 8)
assert_equal(graph.path_exists(nodes[0], nodes[2]), True)
assert_equal(graph.path_exists(nodes[0], nodes[0]), True)
assert_equal(graph.path_exists(nodes[4], nodes[5]), False)
self.assertEqual(graph.path_exists(nodes[0], nodes[2]), True)
self.assertEqual(graph.path_exists(nodes[0], nodes[0]), True)
self.assertEqual(graph.path_exists(nodes[4], nodes[5]), False)
print('Success: test_path_exists')
@@ -30,4 +30,4 @@ def main():
if __name__ == '__main__':
main()
main()