(testrepo: Repository)
| 94 | |
| 95 | |
| 96 | def test_create_blob(testrepo: Repository) -> None: |
| 97 | blob_oid = testrepo.create_blob(BLOB_NEW_CONTENT) |
| 98 | blob = testrepo[blob_oid] |
| 99 | |
| 100 | assert isinstance(blob, pygit2.Blob) |
| 101 | assert ObjectType.BLOB == blob.type |
| 102 | |
| 103 | assert blob_oid == blob.id |
| 104 | assert utils.gen_blob_sha1(BLOB_NEW_CONTENT) == blob_oid |
| 105 | |
| 106 | assert BLOB_NEW_CONTENT == blob.data |
| 107 | assert len(BLOB_NEW_CONTENT) == blob.size |
| 108 | assert BLOB_NEW_CONTENT == blob.read_raw() |
| 109 | blob_buffer = memoryview(blob) |
| 110 | assert len(BLOB_NEW_CONTENT) == len(blob_buffer) |
| 111 | assert BLOB_NEW_CONTENT == blob_buffer |
| 112 | |
| 113 | def set_content() -> None: |
| 114 | blob_buffer[:2] = b'hi' |
| 115 | |
| 116 | with pytest.raises(TypeError): |
| 117 | set_content() |
| 118 | |
| 119 | |
| 120 | def test_create_blob_fromworkdir(testrepo: Repository) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…