()
| 37 | |
| 38 | |
| 39 | def test_patch_from_non_utf8() -> None: |
| 40 | # blobs encoded in ISO-8859-1 |
| 41 | old_content = b'Kristian H\xf8gsberg\n' |
| 42 | new_content = old_content + b'foo\n' |
| 43 | patch = pygit2.Patch.create_from( |
| 44 | old_content, |
| 45 | new_content, |
| 46 | old_as_path='iso-8859-1.txt', |
| 47 | new_as_path='iso-8859-1.txt', |
| 48 | ) |
| 49 | |
| 50 | assert patch.data == expected_diff |
| 51 | assert patch.text == expected_diff.decode('utf-8', errors='replace') |
| 52 | |
| 53 | # `patch.text` corrupted the ISO-8859-1 content as it forced UTF-8 |
| 54 | # decoding, so assert that we cannot get the original content back: |
| 55 | assert patch.text.encode('utf-8') != expected_diff |
| 56 | |
| 57 | |
| 58 | def test_patch_create_from_blobs(encodingrepo: Repository) -> None: |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…