(encodingrepo: Repository)
| 56 | |
| 57 | |
| 58 | def test_patch_create_from_blobs(encodingrepo: Repository) -> None: |
| 59 | old_content = encodingrepo['e84e339ac7fcc823106efa65a6972d7a20016c85'] |
| 60 | new_content = encodingrepo['201e0c908e3d9f526659df3e556c3d06384ef0df'] |
| 61 | assert isinstance(old_content, Blob) |
| 62 | assert isinstance(new_content, Blob) |
| 63 | patch = pygit2.Patch.create_from( |
| 64 | old_content, |
| 65 | new_content, |
| 66 | old_as_path='iso-8859-1.txt', |
| 67 | new_as_path='iso-8859-1.txt', |
| 68 | ) |
| 69 | |
| 70 | assert patch.data == expected_diff |
| 71 | assert patch.text == expected_diff.decode('utf-8', errors='replace') |
| 72 | |
| 73 | # `patch.text` corrupted the ISO-8859-1 content as it forced UTF-8 |
| 74 | # decoding, so assert that we cannot get the original content back: |
| 75 | assert patch.text.encode('utf-8') != expected_diff |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…