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

Function test_refs_getitem

test/test_refs.py:77–89  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

75
76
77def test_refs_getitem(testrepo: Repository) -> None:
78 refname = 'refs/foo'
79 # Raise KeyError ?
80 with pytest.raises(KeyError):
81 testrepo.references[refname]
82
83 # Return None ?
84 assert testrepo.references.get(refname) is None
85
86 # Test a lookup
87 reference = testrepo.references.get('refs/heads/master')
88 assert reference is not None
89 assert reference.name == 'refs/heads/master'
90
91
92def test_refs_get_sha(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…