def test_2(self): self.assertEqual(Solution().twoSum([3,5,-4,8,11,1,-1,6,1,5,-9,-4,-6.6,8],19), [8, 11])
def test_5(self): self.assertEqual(Solution().twoSumDict([3,5,-4,8,11,1,-1,6],10), [11,-1])
def test_1(self): self.assertEqual(Solution().twoSum([3,5,-4,8,11,1,-1,6],10), [-1, 11])
def test_3(self): self.assertEqual(Solution().twoSumBrute([3,5,-4,8,11,1,-1,6],10), [11, -1])
from TwoSum import Solution import pytest SOL = Solution() @pytest.mark.parametrize("nums, target, ans", [ ([2, 7, 11, 15], 9, [0, 1]), ([4, 6, 2, 1], 8, [1, 2]), ]) def test(nums, target, ans): assert SOL.twoSum(nums, target) == ans
from TwoSum import Solution solution = Solution() # nums = [2,7,11,15, 3,3] # target = 6 # result = solution.twoSum(nums, target) # s = "dvdf" # result = solution.lengthOfLongestSubstring(s) # val = 1534236469 # result = solution.reverse(val) # val = 10 # result = solution.isPalindrome(val) # s = "PAYPALISHIRING" # numRows = 4 # result = solution.convert(s, numRows) # # n = 5 # result = solution.countAndSay(n) # s = "()[]{}" # result = solution.isValid(s) # strs = ["a","cc"] # result = solution.longestCommonPrefix(strs)
def test_b(): soln = Solution() assert soln.twoSum([1, 2, 3, 4, 5], 8) == [2, 4]
def test_a(): soln = Solution() assert soln.twoSum([2, 7, 11, 15], 9) == [0, 1]