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

Function test_read

test/test_odb.py:71–89  ·  view source on GitHub ↗
(odb: Odb)

Source from the content-addressed store, hash-verified

69
70
71def test_read(odb: Odb) -> None:
72 with pytest.raises(TypeError):
73 odb.read(123) # type: ignore
74 utils.assertRaisesWithArg(KeyError, '1' * 40, odb.read, '1' * 40)
75
76 ab = odb.read(BLOB_OID)
77 a = odb.read(BLOB_HEX)
78 assert ab == a
79 assert (ObjectType.BLOB, BLOB_CONTENTS) == a
80 assert isinstance(a[0], ObjectType)
81
82 a2 = odb.read('7f129fd57e31e935c6d60a0c794efe4e6927664b')
83 assert (ObjectType.BLOB, b'a contents 2\n') == a2
84 assert isinstance(a2[0], ObjectType)
85
86 a_hex_prefix = BLOB_HEX[:4]
87 a3 = odb.read(a_hex_prefix)
88 assert (ObjectType.BLOB, BLOB_CONTENTS) == a3
89 assert isinstance(a3[0], ObjectType)
90
91
92def test_read_header(odb: Odb) -> None:

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…