#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

@@ -99,9 +99,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%run ../bst/bst.py"
@@ -110,9 +108,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
@@ -147,9 +143,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -161,15 +155,14 @@
],
"source": [
"%%writefile test_bst_validate.py\n",
"from nose.tools import assert_equal\n",
"from nose.tools import raises\n",
"import unittest\n",
"\n",
"\n",
"class TestBstValidate(object):\n",
"class TestBstValidate(unittest.TestCase):\n",
"\n",
" @raises(Exception)\n",
" def test_bst_validate_empty(self):\n",
" validate_bst(None)\n",
" bst = BstValidate(None)\n",
" bst.validate()\n",
"\n",
" def test_bst_validate(self):\n",
" bst = BstValidate(Node(5))\n",
@@ -178,7 +171,7 @@
" bst.insert(6)\n",
" bst.insert(4)\n",
" bst.insert(7)\n",
" assert_equal(bst.validate(), True)\n",
" self.assertEqual(bst.validate(), True)\n",
"\n",
" bst = BstValidate(Node(5))\n",
" left = Node(5)\n",
@@ -187,14 +180,14 @@
" bst.root.left = left\n",
" bst.root.right = right\n",
" bst.root.left.right = invalid\n",
" assert_equal(bst.validate(), False)\n",
" self.assertEqual(bst.validate(), False)\n",
"\n",
" print('Success: test_bst_validate')\n",
"\n",
"\n",
"def main():\n",
" test = TestBstValidate()\n",
" test.test_bst_validate_empty()\n",
" test.assertRaises(TypeError, test.test_bst_validate_empty)\n",
" test.test_bst_validate()\n",
"\n",
"\n",
@@ -205,9 +198,7 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@@ -238,9 +229,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
}