mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-06 17:38:02 +00:00
@@ -89,9 +89,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class MyLinkedList(LinkedList):\n",
|
||||
@@ -120,26 +118,24 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_remove_duplicates.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestRemoveDupes(object):\n",
|
||||
"class TestRemoveDupes(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_remove_dupes(self, linked_list):\n",
|
||||
" print('Test: Empty list')\n",
|
||||
" linked_list.remove_dupes()\n",
|
||||
" assert_equal(linked_list.get_all_data(), [])\n",
|
||||
" self.assertEqual(linked_list.get_all_data(), [])\n",
|
||||
"\n",
|
||||
" print('Test: One element list')\n",
|
||||
" linked_list.insert_to_front(2)\n",
|
||||
" linked_list.remove_dupes()\n",
|
||||
" assert_equal(linked_list.get_all_data(), [2])\n",
|
||||
" self.assertEqual(linked_list.get_all_data(), [2])\n",
|
||||
"\n",
|
||||
" print('Test: General case, duplicates')\n",
|
||||
" linked_list.insert_to_front(1)\n",
|
||||
@@ -150,11 +146,11 @@
|
||||
" linked_list.insert_to_front(1)\n",
|
||||
" linked_list.insert_to_front(1)\n",
|
||||
" linked_list.remove_dupes()\n",
|
||||
" assert_equal(linked_list.get_all_data(), [1, 3, 2])\n",
|
||||
" self.assertEqual(linked_list.get_all_data(), [1, 3, 2])\n",
|
||||
"\n",
|
||||
" print('Test: General case, no duplicates')\n",
|
||||
" linked_list.remove_dupes()\n",
|
||||
" assert_equal(linked_list.get_all_data(), [1, 3, 2])\n",
|
||||
" self.assertEqual(linked_list.get_all_data(), [1, 3, 2])\n",
|
||||
"\n",
|
||||
" print('Success: test_remove_dupes\\n')\n",
|
||||
"\n",
|
||||
@@ -195,9 +191,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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user