def testThirdOfDictSum(self): solution = two_sum.Solution() getSum = solution.getSumThird([3, 6, 2], 5) self.assertEqual(getSum, [0, 2])
def testSecondGetSum(self): solution = two_sum.Solution() getSum = solution.getSum([3, 6, 2], 5) self.assertEqual(getSum, [0, 2])
def testSecondOfDictSum(self): solution = two_sum.Solution() getSum = solution.getSumThird([2, 7, 14, 15], 9) self.assertEqual(getSum, [0, 1])
def testFirstGetSum(self): solution = two_sum.Solution() getSum = solution.getSum([2, 7, 14, 15], 9) self.assertEqual(getSum, [0, 1])
def testFirstOfDictSum(self): solution = two_sum.Solution() getFirstSum = solution.getSumThird([1, 3, 6, 9], 10) self.assertEqual(getFirstSum, [0, 3])
def testThirdSolution(self): solution = two_sum.Solution() getThirdSum = solution.getSum([1, 3, 6, 9], 10) self.assertEqual(getThirdSum, [0, 3])
31302, 31334, 31392, 31446, 31511, 31516, 31518, 31562, 31721, 31779, 31813, 31849, 31865, 31866, 31906, 31906, 31934, 31941, 31954, 32015, 32083, 32150, 32205, 32232, 32267, 32268, 32294, 32351, 32373, 32396, 32400, 32405, 32452, 32479, 32480, 32487, 32491, 32491, 32561, 32590, 32605, 32641, 32716, 32757 ]], [[1, 1, 3, 3], [1, 1, 3, 3]], [[1, 2], [1, 2, 3]]] #test_set = [test_set[-1]] solution = median_of_two_sorted_arrays.Solution() test_solution(solution.findMedianSortedArrays, test_set, solution.description()) #endregion #region two sum tests test_set = [[[1, 2, 7, 3], 9], [[2, 7, 11, 15], 9], [[3, 2, 4], 6], [[-3, 4, 3, 90], 0], [[3, 3], 6], [[3, 2, 3], 6]] solution = two_sum.Solution() test_solution(solution.twoSum, test_set, solution.description()) #endregion #region plus_one tests test_set = [[[1, 2, 3]], [[4, 3, 2, 1]]] solution = plus_one.Solution() test_solution(solution.plusOne, test_set, solution.description()) #endregion #region word_ladder_ii tests test_set = [ ["hit", "cog", ["hot", "dot", "dog", "lot", "log", "cog"]], ["hit", "cog", ["hot", "dot", "dog", "lot", "log"]], ["hot", "dog", ["hot", "cog", "dog", "tot", "hog", "hop", "pot", "dot"]], ["hot", "dog", ["hot", "dog", "cog", "pot", "dot"]],
def test_two_sum(self): self.assertEqual(two_sum.Solution().two_sum([2, 7, 11, 15], 9), [0, 1]) self.assertEqual(two_sum.Solution().two_sum([2, 7, 11, 15], 13), [0, 2])
def test_1(self): nums = [2, 7, 11, 15] target = 9 result = two_sum.Solution().twoSum(nums, target) self.assertEquals([0, 1], result)