Skip to content

Commit

Permalink
Add deprecation test for DiffIndex.iter_change_type
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkrzyskow committed Jun 7, 2024
1 parent ca1d031 commit d597088
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/deprecation/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
if TYPE_CHECKING:
from pathlib import Path

from git.diff import Diff
from git.diff import Diff, DiffIndex
from git.objects.commit import Commit

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


@pytest.fixture
def diffs(commit: "Commit") -> Generator["DiffIndex", None, None]:
"""Fixture to supply a DiffIndex."""
yield commit.diff(NULL_TREE)


def test_diff_renamed_warns(diff: "Diff") -> None:
"""The deprecated Diff.renamed property issues a deprecation warning."""
with pytest.deprecated_call():
Expand Down Expand Up @@ -122,3 +128,10 @@ def test_iterable_obj_inheriting_does_not_warn() -> None:

class Derived(IterableObj):
pass


def test_diff_iter_change_type(diffs: "DiffIndex") -> None:
"""The internal DiffIndex.iter_change_type function issues no deprecation warning."""
with assert_no_deprecation_warning():
for change_type in diffs.change_type:
[*diffs.iter_change_type(change_type=change_type)]

0 comments on commit d597088

Please sign in to comment.