Skip to content

Commit b30c1a7

Browse files
committed
improve types according to test/test_describe.py
1 parent dce6c0d commit b30c1a7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pygit2/_pygit2.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,8 @@ class Repository:
835835
) -> Oid: ...
836836
def diff(
837837
self,
838-
a: None | str | Reference = None,
839-
b: None | str | Reference = None,
838+
a: None | str | bytes | Reference = None,
839+
b: None | str | bytes | Reference = None,
840840
cached: bool = False,
841841
flags: DiffOption = DiffOption.NORMAL,
842842
context_lines: int = 3,

test/test_diff_binary.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@
2323
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2424
# Boston, MA 02110-1301, USA.
2525

26+
from pathlib import Path
27+
from typing import Generator
28+
2629
import pytest
2730

2831
import pygit2
32+
from pygit2 import Repository
2933
from pygit2.enums import DiffOption
3034

3135
from . import utils
3236

3337

3438
@pytest.fixture
35-
def repo(tmp_path):
39+
def repo(tmp_path: Path) -> Generator[Repository, None, None]:
3640
with utils.TemporaryRepository('binaryfilerepo.zip', tmp_path) as path:
3741
yield pygit2.Repository(path)
3842

@@ -54,7 +58,7 @@ def repo(tmp_path):
5458
"""
5559

5660

57-
def test_binary_diff(repo):
61+
def test_binary_diff(repo: Repository) -> None:
5862
diff = repo.diff('HEAD', 'HEAD^')
5963
assert PATCH_BINARY == diff.patch
6064
diff = repo.diff('HEAD', 'HEAD^', flags=DiffOption.SHOW_BINARY)

0 commit comments

Comments
 (0)