31
31
if TYPE_CHECKING :
32
32
from pathlib import Path
33
33
34
- from git .diff import Diff
34
+ from git .diff import Diff , DiffIndex
35
35
from git .objects .commit import Commit
36
36
37
37
# ------------------------------------------------------------------------
@@ -54,6 +54,12 @@ def diff(commit: "Commit") -> Generator["Diff", None, None]:
54
54
yield diff
55
55
56
56
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
+
57
63
def test_diff_renamed_warns (diff : "Diff" ) -> None :
58
64
"""The deprecated Diff.renamed property issues a deprecation warning."""
59
65
with pytest .deprecated_call ():
@@ -122,3 +128,10 @@ def test_iterable_obj_inheriting_does_not_warn() -> None:
122
128
123
129
class Derived (IterableObj ):
124
130
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