def test2(self): intervals = generate_intervals([[1, 2], [3, 5], [6, 7], [8, 10], [12, 16]]) newInterval = Interval(4, 9) inserted = Solution().insert(intervals, newInterval) result_str = ', '.join(map(str, inserted)) self.assertEqual(result_str, '[1, 2], [3, 10], [12, 16]')
def test2(self): res = self.to_string(Solution().merge( generate_intervals([[7, 8], [1, 3], [3, 6], [4, 6]]))) ans = self.to_string(generate_intervals([[1, 6], [7, 8]])) self.assertEqual(res, ans)
def test1(self): res = self.to_string(Solution().merge( generate_intervals([[1, 3], [2, 6], [8, 10], [15, 18]]))) ans = self.to_string(generate_intervals([[1, 6], [8, 10], [15, 18]])) self.assertEqual(res, ans)
def test7(self): intervals = generate_intervals([[1, 3]]) newInterval = Interval(4, 8) inserted = Solution().insert(intervals, newInterval) result_str = ', '.join(map(str, inserted)) self.assertEqual(result_str, '[1, 3], [4, 8]')