Exemplo n.º 1
0
    def test_no_range(self):
        test_file = ["abc"]
        test_file_dict = {abspath("test_file"): test_file}

        test_result = Result("origin", "message")

        result_diff = remove_result_ranges_diffs(
            [test_result], test_file_dict)[test_result][abspath("test_file")]
        expected_diff = Diff.from_string_arrays(test_file, ["abc"])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 2
0
    def test_no_range(self):
        test_file = ['abc']
        test_file_dict = {abspath('test_file'): test_file}

        test_result = Result('origin', 'message')

        result_diff = remove_result_ranges_diffs(
            [test_result], test_file_dict)[test_result][abspath('test_file')]
        expected_diff = Diff.from_string_arrays(test_file, ['abc'])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 3
0
    def test_no_range(self):
        test_file = ['abc']
        test_file_dict = {abspath('test_file'): test_file}

        test_result = Result('origin',
                             'message')

        result_diff = remove_result_ranges_diffs(
            [test_result],
            test_file_dict)[test_result][abspath('test_file')]
        expected_diff = Diff.from_string_arrays(test_file, ['abc'])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 4
0
    def test_no_range(self):
        test_file = ["abc"]
        test_file_dict = {abspath("test_file"): test_file}

        test_result = Result("origin",
                             "message")

        result_diff = remove_result_ranges_diffs(
            [test_result],
            test_file_dict)[test_result][abspath("test_file")]
        expected_diff = Diff.from_string_arrays(test_file, ["abc"])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 5
0
    def test_result_range_line_wise_overlap(self):
        test_file = ["11", "22", "33", "44", "55", "66"]
        test_file_dict = {abspath("test_file"): test_file}

        source_range1 = SourceRange.from_values("test_file", 2, 2, 5, 1)
        source_range2 = SourceRange.from_values("test_file", 3, 1, 4, 1)

        test_result = Result("origin", "message",
                             (source_range1, source_range2))

        result_diff = remove_result_ranges_diffs(
            [test_result], test_file_dict)[test_result][abspath("test_file")]
        expected_diff = Diff.from_string_arrays(test_file,
                                                ["11", "2", "5", "66"])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 6
0
    def test_result_range_inline_overlap(self):
        test_file = ["123456789\n"]
        test_file_dict = {abspath("test_file"): test_file}

        source_range1 = SourceRange.from_values("test_file", 1, 1, 1, 4)
        source_range2 = SourceRange.from_values("test_file", 1, 2, 1, 3)
        source_range3 = SourceRange.from_values("test_file", 1, 3, 1, 6)

        test_result = Result("origin", "message",
                             (source_range1, source_range2, source_range3))

        result_diff = remove_result_ranges_diffs(
            [test_result], test_file_dict)[test_result][abspath("test_file")]
        expected_diff = Diff.from_string_arrays(test_file, ["789\n"])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 7
0
    def test_result_range_line_wise_overlap(self):
        test_file = ['11', '22', '33', '44', '55', '66']
        test_file_dict = {abspath('test_file'): test_file}

        source_range1 = SourceRange.from_values('test_file', 2, 2, 5, 1)
        source_range2 = SourceRange.from_values('test_file', 3, 1, 4, 1)

        test_result = Result('origin', 'message',
                             (source_range1, source_range2))

        result_diff = remove_result_ranges_diffs(
            [test_result], test_file_dict)[test_result][abspath('test_file')]
        expected_diff = Diff.from_string_arrays(test_file,
                                                ['11', '2', '5', '66'])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 8
0
    def test_result_range_inline_overlap(self):
        test_file = ['123456789\n']
        test_file_dict = {abspath('test_file'): test_file}

        source_range1 = SourceRange.from_values('test_file', 1, 1, 1, 4)
        source_range2 = SourceRange.from_values('test_file', 1, 2, 1, 3)
        source_range3 = SourceRange.from_values('test_file', 1, 3, 1, 6)

        test_result = Result('origin', 'message',
                             (source_range1, source_range2, source_range3))

        result_diff = remove_result_ranges_diffs(
            [test_result], test_file_dict)[test_result][abspath('test_file')]
        expected_diff = Diff.from_string_arrays(test_file, ['789\n'])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 9
0
    def test_result_range_line_wise_overlap(self):
        test_file = ['11', '22', '33', '44', '55', '66']
        test_file_dict = {abspath('test_file'): test_file}

        source_range1 = SourceRange.from_values('test_file', 2, 2, 5, 1)
        source_range2 = SourceRange.from_values('test_file', 3, 1, 4, 1)

        test_result = Result('origin',
                             'message',
                             (source_range1, source_range2))

        result_diff = remove_result_ranges_diffs(
            [test_result],
            test_file_dict)[test_result][abspath('test_file')]
        expected_diff = Diff.from_string_arrays(test_file,
                                                ['11', '2', '5', '66'])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 10
0
    def test_result_range_inline_overlap(self):
        test_file = ['123456789\n']
        test_file_dict = {abspath('test_file'): test_file}

        source_range1 = SourceRange.from_values('test_file', 1, 1, 1, 4)
        source_range2 = SourceRange.from_values('test_file', 1, 2, 1, 3)
        source_range3 = SourceRange.from_values('test_file', 1, 3, 1, 6)

        test_result = Result('origin',
                             'message',
                             (source_range1, source_range2, source_range3))

        result_diff = remove_result_ranges_diffs(
            [test_result],
            test_file_dict)[test_result][abspath('test_file')]
        expected_diff = Diff.from_string_arrays(test_file, ['789\n'])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 11
0
    def test_result_range_line_wise_overlap(self):
        test_file = ["11", "22", "33", "44", "55", "66"]
        test_file_dict = {abspath("test_file"): test_file}

        source_range1 = SourceRange.from_values("test_file", 2, 2, 5, 1)
        source_range2 = SourceRange.from_values("test_file", 3, 1, 4, 1)

        test_result = Result("origin",
                             "message",
                             (source_range1, source_range2))

        result_diff = remove_result_ranges_diffs(
            [test_result],
            test_file_dict)[test_result][abspath("test_file")]
        expected_diff = Diff.from_string_arrays(test_file,
                                                ["11", "2", "5", "66"])

        self.assertEqual(result_diff, expected_diff)
Exemplo n.º 12
0
    def test_result_range_inline_overlap(self):
        test_file = ["123456789\n"]
        test_file_dict = {abspath("test_file"): test_file}

        source_range1 = SourceRange.from_values("test_file", 1, 1, 1, 4)
        source_range2 = SourceRange.from_values("test_file", 1, 2, 1, 3)
        source_range3 = SourceRange.from_values("test_file", 1, 3, 1, 6)

        test_result = Result("origin",
                             "message",
                             (source_range1, source_range2, source_range3))

        result_diff = remove_result_ranges_diffs(
            [test_result],
            test_file_dict)[test_result][abspath("test_file")]
        expected_diff = Diff.from_string_arrays(test_file, ["789\n"])

        self.assertEqual(result_diff, expected_diff)