donnemartin / donnemartin/interactive-coding-challenges
Two sum unit test too strict
- Dominant language
- Python
- Stars
- 31.8k
- Forks
- 4.7k
- PR merge metrics
- No merged PRs in 30d
Description
```
def test_two_sum(self):
solution = Solution()
assert_raises(TypeError, solution.two_sum, None, None)
assert_raises(ValueError, solution.two_sum, [], 0)
target = 7
nums = [1, 3, 2, -7, 5]
expected = [2, 4]
assert_equal(solution.two_sum(nums, target), expected)
print('Success: test_two_sum')
```
`[4, 2]` should also be a valid answer. Unittest has an [assertItemsEqual](https://docs.python.org/2/library/unittest.html#unittest.TestCase.assertItemsEqual) method, I'm not sure if nose has that too. I'm happy to write a PR for this, it's trivial to fix.
Contributor guide
Assessment
This issue has not been assessed yet.