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}))
    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.'
        )
    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})
        )
 def test_is_applicable_without_patch(self):
     result = Result('', '')
     self.assertEqual(
         ApplyPatchAction.is_applicable(result, {}, {}),
         'This result has no patch attached.'
     )
 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, {}, {}))
 def test_is_applicable_without_patch(self):
     result = Result("", "")
     self.assertFalse(ApplyPatchAction.is_applicable(result, {}, {}))
 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, {}, {}))
Exemple #8
0
 def test_is_applicable_without_patch(self):
     result = Result('', '')
     self.assertEqual(ApplyPatchAction.is_applicable(result, {}, {}),
                      'This result has no patch attached.')
 def test_is_applicable_empty_patch(self):
     empty_patch_result = Result("", "", diffs={})
     self.assertFalse(
         ApplyPatchAction.is_applicable(empty_patch_result, {}, {}))
Exemple #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, {}, {}))
Exemple #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, {}, {}))
Exemple #12
0
 def test_is_applicable_without_patch(self):
     result = Result("", "")
     self.assertFalse(ApplyPatchAction.is_applicable(result, {}, {}))
Exemple #13
0
 def test_is_applicable_empty_patch(self):
     empty_patch_result = Result("", "", diffs={})
     self.assertFalse(
         ApplyPatchAction.is_applicable(empty_patch_result, {}, {}))
 def test_is_applicable(self):
     patch_result = PatchResult("", "", {})
     result = Result("", "")
     self.assertTrue(ApplyPatchAction.is_applicable(patch_result))
     self.assertFalse(ApplyPatchAction.is_applicable(result))