本文整理汇总了Python中coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction.is_applicable方法的典型用法代码示例。如果您正苦于以下问题:Python ApplyPatchAction.is_applicable方法的具体用法?Python ApplyPatchAction.is_applicable怎么用?Python ApplyPatchAction.is_applicable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction
的用法示例。
在下文中一共展示了ApplyPatchAction.is_applicable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_applicable_conflict
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
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: test_is_applicable_empty_patch
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
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: test_is_applicable_conflict
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
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: test_is_applicable_without_patch
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
def test_is_applicable_without_patch(self):
result = Result('', '')
self.assertEqual(
ApplyPatchAction.is_applicable(result, {}, {}),
'This result has no patch attached.'
)
示例5: test_is_applicable
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
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: test_is_applicable
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
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, {}, {}))
示例7: test_is_applicable_without_patch
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
def test_is_applicable_without_patch(self):
result = Result("", "")
self.assertFalse(ApplyPatchAction.is_applicable(result, {}, {}))
示例8: test_is_applicable_empty_patch
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
def test_is_applicable_empty_patch(self):
empty_patch_result = Result("", "", diffs={})
self.assertFalse(
ApplyPatchAction.is_applicable(empty_patch_result, {}, {}))
示例9: test_is_applicable
# 需要导入模块: from coalib.results.result_actions.ApplyPatchAction import ApplyPatchAction [as 别名]
# 或者: from coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction import is_applicable [as 别名]
def test_is_applicable(self):
patch_result = PatchResult("", "", {})
result = Result("", "")
self.assertTrue(ApplyPatchAction.is_applicable(patch_result))
self.assertFalse(ApplyPatchAction.is_applicable(result))