mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-03 16:08:02 +00:00
Fix two sum unit_test challenge to match the solution notebook (#176)
This commit is contained in:
committed by
Donne Martin
parent
d60f4a904c
commit
ffd4798f23
@@ -122,8 +122,12 @@
|
|||||||
"\n",
|
"\n",
|
||||||
" def test_two_sum(self):\n",
|
" def test_two_sum(self):\n",
|
||||||
" solution = Solution()\n",
|
" solution = Solution()\n",
|
||||||
" assert_raises(TypeError, solution.two_sum, None)\n",
|
" assert_raises(TypeError, solution.two_sum, None, None)\n",
|
||||||
" assert_equal(solution.two_sum(0), 0)\n",
|
" assert_raises(ValueError, solution.two_sum, [], 0)\n",
|
||||||
|
" target = 7\n",
|
||||||
|
" nums = [1, 3, 2, -7, 5]\n",
|
||||||
|
" expected = [2, 4]\n",
|
||||||
|
" assert_equal(solution.two_sum(nums, target), expected)\n",
|
||||||
" print('Success: test_two_sum')\n",
|
" print('Success: test_two_sum')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user