예제 #1
0
    def remove_typos_beginning_negated_test(self):
        """
        Test the _remove_typos function with a large difference in the middle.
        """
        # GIVEN: A diffset with a large difference in the middle.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 20, 10, 11), ('equal', 20, 30, 11, 21)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(list(diff))

        # THEN: There diff should not have changed.
        assert result == diff
예제 #2
0
파일: test_lib.py 프로젝트: jkunle/paul
    def remove_typos_beginning_negated_test(self):
        """
        Test the _remove_typos function with a large difference in the middle.
        """
        # GIVEN: A diffset with a large difference in the middle.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 20, 10, 11), ('equal', 20, 30, 11, 21)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(list(diff))

        # THEN: There diff should not have changed.
        assert result == diff
예제 #3
0
    def test_remove_typos_end_negated(self):
        """
        Test the _remove_typos function with a large difference at the end.
        """
        # GIVEN: A diffset with a large difference at the end.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 20, 10, 1)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(list(diff))

        # THEN: There diff should not have changed.
        assert result == diff
예제 #4
0
파일: test_lib.py 프로젝트: imkernel/openlp
    def test_remove_typos_end_negated(self):
        """
        Test the _remove_typos function with a large difference at the end.
        """
        # GIVEN: A diffset with a large difference at the end.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 20, 10, 1)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(list(diff))

        # THEN: There diff should not have changed.
        assert result == diff
예제 #5
0
    def remove_typos_end_test(self):
        """
        Test the _remove_typos function with a typo at the end.
        """
        # GIVEN: A diffset with a difference at the end.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 12, 10, 11)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(diff)

        # THEN: There should be no typos at the end anymore.
        assert len(result) == 1, 'The result should contain only one element.'
        assert result[0][0] == 'equal', 'The result should contain an equal element.'
예제 #6
0
파일: test_lib.py 프로젝트: jkunle/paul
    def remove_typos_end_test(self):
        """
        Test the _remove_typos function with a typo at the end.
        """
        # GIVEN: A diffset with a difference at the end.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 12, 10, 11)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(diff)

        # THEN: There should be no typos at the end anymore.
        assert len(result) == 1, 'The result should contain only one element.'
        assert result[0][0] == 'equal', 'The result should contain an equal element.'
예제 #7
0
    def remove_typos_middle_test(self):
        """
        Test the _remove_typos function with a typo in the middle.
        """
        # GIVEN: A diffset with a difference in the middle.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 12, 10, 11), ('equal', 12, 22, 11, 21)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(diff)

        # THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.
        assert len(result) is 1, 'The result should contain only one element.'
        assert result[0][0] == 'equal', 'The result should contain an equal element.'
        assert result[0][1] == 0, 'The start indices should be kept.'
        assert result[0][2] == 22, 'The stop indices should be kept.'
        assert result[0][3] == 0, 'The start indices should be kept.'
        assert result[0][4] == 21, 'The stop indices should be kept.'
예제 #8
0
파일: test_lib.py 프로젝트: jkunle/paul
    def remove_typos_middle_test(self):
        """
        Test the _remove_typos function with a typo in the middle.
        """
        # GIVEN: A diffset with a difference in the middle.
        diff = [('equal', 0, 10, 0, 10), ('replace', 10, 12, 10, 11), ('equal', 12, 22, 11, 21)]

        # WHEN: We remove the typos in there.
        result = _remove_typos(diff)

        # THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.
        assert len(result) is 1, 'The result should contain only one element.'
        assert result[0][0] == 'equal', 'The result should contain an equal element.'
        assert result[0][1] == 0, 'The start indices should be kept.'
        assert result[0][2] == 22, 'The stop indices should be kept.'
        assert result[0][3] == 0, 'The start indices should be kept.'
        assert result[0][4] == 21, 'The stop indices should be kept.'