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

Function test_new_commit_encoding

test/test_commit.py:108–134  ·  view source on GitHub ↗
(barerepo: Repository)

Source from the content-addressed store, hash-verified

106
107
108def test_new_commit_encoding(barerepo: Repository) -> None:
109 repo = barerepo
110 encoding = 'iso-8859-1'
111 message = 'New commit.\n\nMessage with non-ascii chars: ééé.\n'
112 committer = Signature('John Doe', 'jdoe@example.com', 12346, 0, encoding)
113 author = Signature('J. David Ibáñez', 'jdavid@example.com', 12345, 0, encoding)
114 tree = '967fce8df97cc71722d3c2a5930ef3e6f1d27b12'
115 tree_prefix = tree[:5]
116
117 parents = [COMMIT_SHA[:5]]
118 sha = repo.create_commit(
119 None, author, committer, message, tree_prefix, parents, encoding
120 )
121 commit = repo[sha]
122 assert isinstance(commit, Commit)
123
124 assert ObjectType.COMMIT.value == commit.type
125 assert 'iso-8859-1' == commit.message_encoding
126 assert message.encode(encoding) == commit.raw_message
127 assert 12346 == commit.commit_time
128 assert committer == commit.committer
129 assert author == commit.author
130 assert tree == commit.tree.id
131 assert Oid(hex=tree) == commit.tree_id
132 assert 1 == len(commit.parents)
133 assert COMMIT_SHA == commit.parents[0].id
134 assert Oid(hex=COMMIT_SHA) == commit.parent_ids[0]
135
136
137def test_modify_commit(barerepo: 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…