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

Function test_lookup_commit_prefix

test/test_repository_bare.py:145–158  ·  view source on GitHub ↗
(barerepo: Repository)

Source from the content-addressed store, hash-verified

143
144
145def test_lookup_commit_prefix(barerepo: Repository) -> None:
146 commit_sha = '5fe808e8953c12735680c257f56600cb0de44b10'
147 commit_sha_prefix = commit_sha[:7]
148 too_short_prefix = commit_sha[:3]
149 commit = barerepo[commit_sha_prefix]
150 assert commit_sha == commit.id
151 assert int(ObjectType.COMMIT) == commit.type
152 assert isinstance(commit, Commit)
153 assert (
154 'Second test data commit.\n\n'
155 'This commit has some additional text.\n' == commit.message
156 )
157 with pytest.raises(ValueError):
158 barerepo.__getitem__(too_short_prefix)
159
160
161def test_expand_id(barerepo: Repository) -> None:

Callers

nothing calls this directly

Calls 1

__getitem__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…