(testrepo: Repository)
| 157 | |
| 158 | |
| 159 | def 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 | |
| 180 | def test_no_context_lines(testrepo: Repository) -> None: |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…