예제 #1
0
    def test_is_applicable_conflict(self):
        diff = Diff(["1\n", "2\n", "3\n"])
        diff.add_lines(2, ['a line'])

        conflict_result = Result("", "", diffs={'f': diff})
        # Applying the same diff twice will result in a conflict
        self.assertFalse(
            ApplyPatchAction.is_applicable(conflict_result, {}, {'f': diff}))
예제 #2
0
    def test_is_applicable_empty_patch(self):
        diff = Diff([], rename='new_name')
        result = Result('', '', diffs={'f': diff})

        # Two renames donot result in any change
        self.assertEqual(
            ApplyPatchAction.is_applicable(result, {}, {'f': diff}),
            'The given patches do not change anything anymore.'
        )
예제 #3
0
    def test_is_applicable_conflict(self):
        diff = Diff(['1\n', '2\n', '3\n'])
        diff.add_lines(2, ['a line'])

        conflict_result = Result('', '', diffs={'f': diff})
        # Applying the same diff twice will result in a conflict
        self.assertIn(
            'Two or more patches conflict with each other: ',
            ApplyPatchAction.is_applicable(conflict_result, {}, {'f': diff})
        )
예제 #4
0
 def test_is_applicable_without_patch(self):
     result = Result('', '')
     self.assertEqual(
         ApplyPatchAction.is_applicable(result, {}, {}),
         'This result has no patch attached.'
     )
예제 #5
0
 def test_is_applicable(self):
     diff = Diff(['1\n', '2\n', '3\n'])
     diff.delete_line(2)
     patch_result = Result('', '', diffs={'f': diff})
     self.assertTrue(
         ApplyPatchAction.is_applicable(patch_result, {}, {}))
예제 #6
0
 def test_is_applicable_without_patch(self):
     result = Result("", "")
     self.assertFalse(ApplyPatchAction.is_applicable(result, {}, {}))
예제 #7
0
 def test_is_applicable(self):
     diff = Diff(["1\n", "2\n", "3\n"])
     diff.delete_line(2)
     patch_result = Result("", "", diffs={'f': diff})
     self.assertTrue(
         ApplyPatchAction.is_applicable(patch_result, {}, {}))
예제 #8
0
 def test_is_applicable_without_patch(self):
     result = Result('', '')
     self.assertEqual(ApplyPatchAction.is_applicable(result, {}, {}),
                      'This result has no patch attached.')
예제 #9
0
 def test_is_applicable_empty_patch(self):
     empty_patch_result = Result("", "", diffs={})
     self.assertFalse(
         ApplyPatchAction.is_applicable(empty_patch_result, {}, {}))
예제 #10
0
 def test_is_applicable(self):
     diff = Diff(['1\n', '2\n', '3\n'])
     diff.delete_line(2)
     patch_result = Result('', '', diffs={'f': diff})
     self.assertTrue(ApplyPatchAction.is_applicable(patch_result, {}, {}))
예제 #11
0
 def test_is_applicable(self):
     diff = Diff(["1\n", "2\n", "3\n"])
     diff.delete_line(2)
     patch_result = Result("", "", diffs={'f': diff})
     self.assertTrue(
         ApplyPatchAction.is_applicable(patch_result, {}, {}))
예제 #12
0
 def test_is_applicable_without_patch(self):
     result = Result("", "")
     self.assertFalse(ApplyPatchAction.is_applicable(result, {}, {}))
예제 #13
0
 def test_is_applicable_empty_patch(self):
     empty_patch_result = Result("", "", diffs={})
     self.assertFalse(
         ApplyPatchAction.is_applicable(empty_patch_result, {}, {}))
예제 #14
0
 def test_is_applicable(self):
     patch_result = PatchResult("", "", {})
     result = Result("", "")
     self.assertTrue(ApplyPatchAction.is_applicable(patch_result))
     self.assertFalse(ApplyPatchAction.is_applicable(result))