Skip to content

Commit

Permalink
Test that Traversable.{list_,}traverse, but not overrides, warn
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed Mar 28, 2024
1 parent 03464d9 commit 9d096e0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/deprecation/test_various.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pytest

from git.diff import NULL_TREE
from git.objects.util import Traversable
from git.repo import Repo


Expand Down Expand Up @@ -68,3 +69,27 @@ def test_commit_trailers_dict_does_not_warn(commit):
"""The nondeprecated Commit.trailers_dict property issues no deprecation warning."""
with _assert_no_deprecation_warning():
commit.trailers_dict


def test_traverse_list_traverse_in_base_class_warns(commit):
"""Traversable.list_traverse's base implementation issues a deprecation warning."""
with pytest.deprecated_call():
Traversable.list_traverse(commit)


def test_traversable_list_traverse_override_does_not_warn(commit):
"""Calling list_traverse on concrete subclasses is not deprecated, does not warn."""
with _assert_no_deprecation_warning():
commit.list_traverse()


def test_traverse_traverse_in_base_class_warns(commit):
"""Traversable.traverse's base implementation issues a deprecation warning."""
with pytest.deprecated_call():
Traversable.traverse(commit)


def test_traverse_traverse_override_does_not_warn(commit):
"""Calling traverse on concrete subclasses is not deprecated, does not warn."""
with _assert_no_deprecation_warning():
commit.traverse()

0 comments on commit 9d096e0

Please sign in to comment.