Skip to content

Commit d597088

Browse files
committed
Add deprecation test for DiffIndex.iter_change_type
1 parent ca1d031 commit d597088

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/deprecation/test_basic.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
if TYPE_CHECKING:
3232
from pathlib import Path
3333

34-
from git.diff import Diff
34+
from git.diff import Diff, DiffIndex
3535
from git.objects.commit import Commit
3636

3737
# ------------------------------------------------------------------------
@@ -54,6 +54,12 @@ def diff(commit: "Commit") -> Generator["Diff", None, None]:
5454
yield diff
5555

5656

57+
@pytest.fixture
58+
def diffs(commit: "Commit") -> Generator["DiffIndex", None, None]:
59+
"""Fixture to supply a DiffIndex."""
60+
yield commit.diff(NULL_TREE)
61+
62+
5763
def test_diff_renamed_warns(diff: "Diff") -> None:
5864
"""The deprecated Diff.renamed property issues a deprecation warning."""
5965
with pytest.deprecated_call():
@@ -122,3 +128,10 @@ def test_iterable_obj_inheriting_does_not_warn() -> None:
122128

123129
class Derived(IterableObj):
124130
pass
131+
132+
133+
def test_diff_iter_change_type(diffs: "DiffIndex") -> None:
134+
"""The internal DiffIndex.iter_change_type function issues no deprecation warning."""
135+
with assert_no_deprecation_warning():
136+
for change_type in diffs.change_type:
137+
[*diffs.iter_change_type(change_type=change_type)]

0 commit comments

Comments
 (0)