MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_diff_applies_to_both

Function test_diff_applies_to_both

test/test_apply_diff.py:153–166  ·  view source on GitHub ↗
(
    testrepo: Repository, old_content: str, patch_diff: Diff
)

Source from the content-addressed store, hash-verified

151
152
153def test_diff_applies_to_both(
154 testrepo: Repository, old_content: str, patch_diff: Diff
155) -> None:
156 # See if patch applies
157 assert testrepo.applies(patch_diff, ApplyLocation.BOTH)
158
159 # Ensure it was a dry run
160 assert read_content(testrepo) == old_content
161
162 # Apply patch for real, then ensure it can't be applied again
163 testrepo.apply(patch_diff, ApplyLocation.BOTH)
164 assert not testrepo.applies(patch_diff, ApplyLocation.BOTH)
165 assert not testrepo.applies(patch_diff, ApplyLocation.WORKDIR)
166 assert not testrepo.applies(patch_diff, ApplyLocation.INDEX)
167
168
169def test_applies_error(

Callers

nothing calls this directly

Calls 1

read_contentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…