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

Function test_read

test/test_index.py:47–60  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

45
46
47def test_read(testrepo: Repository) -> None:
48 index = testrepo.index
49 assert len(index) == 2
50
51 with pytest.raises(TypeError):
52 index[()]
53 utils.assertRaisesWithArg(ValueError, -4, lambda: index[-4])
54 utils.assertRaisesWithArg(KeyError, 'abc', lambda: index['abc'])
55
56 sha = 'a520c24d85fbfc815d385957eed41406ca5a860b'
57 assert 'hello.txt' in index
58 assert index['hello.txt'].id == sha
59 assert index['hello.txt'].path == 'hello.txt'
60 assert index[1].id == sha
61
62
63def test_add(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…