Renamed unit test method to be more descriptive.

This commit is contained in:
Donne Martin
2015-07-01 06:56:47 -04:00
parent 9e84d8e257
commit df90beea91
3 changed files with 32 additions and 32 deletions

View File

@@ -91,7 +91,7 @@
"source": [
"class MyLinkedList(LinkedList):\n",
" \n",
" def add(self, first_list, second_list):\n",
" def add_reverse(self, first_list, second_list):\n",
" # TODO: Implement me\n",
" pass"
]
@@ -126,11 +126,11 @@
"\n",
"class TestAddReverse(object):\n",
" \n",
" def test_add(self):\n",
" def test_add_reverse(self):\n",
" print('Test: Empty list(s)')\n",
" assert_equal(MyLinkedList().add(None, None), None)\n",
" assert_equal(MyLinkedList().add(Node(5), None), None)\n",
" assert_equal(MyLinkedList().add(None, Node(10)), None)\n",
" assert_equal(MyLinkedList().add_reverse(None, None), None)\n",
" assert_equal(MyLinkedList().add_reverse(Node(5), None), None)\n",
" assert_equal(MyLinkedList().add_reverse(None, Node(10)), None)\n",
"\n",
" print('Test: Add values of different lengths')\n",
" # Input 1: 6->5->None\n",
@@ -141,7 +141,7 @@
" second_list = MyLinkedList(Node(9))\n",
" second_list.append(8)\n",
" second_list.append(7)\n",
" result = MyLinkedList().add(first_list, second_list)\n",
" result = MyLinkedList().add_reverse(first_list, second_list)\n",
" assert_equal(result.get_all_data(), [5, 4, 8])\n",
"\n",
" print('Test: Add values of same lengths')\n",
@@ -156,14 +156,14 @@
" second_list = MyLinkedList(second_head)\n",
" second_list.append(8)\n",
" second_list.append(7)\n",
" result = MyLinkedList().add(first_list, second_list)\n",
" result = MyLinkedList().add_reverse(first_list, second_list)\n",
" assert_equal(result.get_all_data(), [5, 4, 2, 1])\n",
" \n",
" print('Success: test_add')\n",
" print('Success: test_add_reverse')\n",
"\n",
"def main():\n",
" test = TestAddReverse()\n",
" test.test_add()\n",
" test.test_add_reverse()\n",
"\n",
"if __name__ == '__main__':\n",
" main()"