Skip to content

Commit ffd4798

Browse files
ammarnajjardonnemartin
authored andcommitted
Fix two sum unit_test challenge to match the solution notebook (donnemartin#176)
1 parent d60f4a9 commit ffd4798

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arrays_strings/two_sum/two_sum_challenge.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@
122122
"\n",
123123
" def test_two_sum(self):\n",
124124
" solution = Solution()\n",
125-
" assert_raises(TypeError, solution.two_sum, None)\n",
126-
" assert_equal(solution.two_sum(0), 0)\n",
125+
" assert_raises(TypeError, solution.two_sum, None, None)\n",
126+
" assert_raises(ValueError, solution.two_sum, [], 0)\n",
127+
" target = 7\n",
128+
" nums = [1, 3, 2, -7, 5]\n",
129+
" expected = [2, 4]\n",
130+
" assert_equal(solution.two_sum(nums, target), expected)\n",
127131
" print('Success: test_two_sum')\n",
128132
"\n",
129133
"\n",

0 commit comments

Comments
 (0)