Skip to content

Commit e7f0d4b

Browse files
committed
add types to test/test_patch_encoding.py
1 parent 6a4e860 commit e7f0d4b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/test_patch_encoding.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# Boston, MA 02110-1301, USA.
2525

2626
import pygit2
27+
from pygit2 import Blob, Repository
2728

2829
expected_diff = b"""diff --git a/iso-8859-1.txt b/iso-8859-1.txt
2930
index e84e339..201e0c9 100644
@@ -35,7 +36,7 @@
3536
"""
3637

3738

38-
def test_patch_from_non_utf8():
39+
def test_patch_from_non_utf8() -> None:
3940
# blobs encoded in ISO-8859-1
4041
old_content = b'Kristian H\xf8gsberg\n'
4142
new_content = old_content + b'foo\n'
@@ -54,10 +55,14 @@ def test_patch_from_non_utf8():
5455
assert patch.text.encode('utf-8') != expected_diff
5556

5657

57-
def test_patch_create_from_blobs(encodingrepo):
58+
def test_patch_create_from_blobs(encodingrepo: Repository) -> None:
59+
old_content = encodingrepo['e84e339ac7fcc823106efa65a6972d7a20016c85']
60+
new_content = encodingrepo['201e0c908e3d9f526659df3e556c3d06384ef0df']
61+
assert isinstance(old_content, Blob)
62+
assert isinstance(new_content, Blob)
5863
patch = pygit2.Patch.create_from(
59-
encodingrepo['e84e339ac7fcc823106efa65a6972d7a20016c85'],
60-
encodingrepo['201e0c908e3d9f526659df3e556c3d06384ef0df'],
64+
old_content,
65+
new_content,
6166
old_as_path='iso-8859-1.txt',
6267
new_as_path='iso-8859-1.txt',
6368
)

0 commit comments

Comments
 (0)