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

Function test_context_lines

test/test_patch.py:159–177  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

157
158
159def test_context_lines(testrepo: Repository) -> None:
160 old_blob = testrepo[BLOB_OLD_SHA]
161 new_blob = testrepo[BLOB_NEW_SHA]
162 assert isinstance(old_blob, Blob)
163 assert isinstance(new_blob, Blob)
164
165 patch = pygit2.Patch.create_from(
166 old_blob,
167 new_blob,
168 old_as_path=BLOB_OLD_PATH,
169 new_as_path=BLOB_NEW_PATH,
170 )
171
172 assert patch.text is not None
173 context_count = len(
174 [line for line in patch.text.splitlines() if line.startswith(' ')]
175 )
176
177 assert context_count != 0
178
179
180def test_no_context_lines(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…