Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca385a5

Browse files
committed
Test that subclassing deprecated git.util.Iterable warns
And that subclassing the strongly preferred git.util.Iterable class does not warn.
1 parent 21c2b72 commit ca385a5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/deprecation/test_various.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from git.diff import NULL_TREE
1313
from git.objects.util import Traversable
1414
from git.repo import Repo
15+
from git.util import Iterable as _Iterable, IterableObj
1516

1617

1718
@contextlib.contextmanager
@@ -93,3 +94,19 @@ def test_traverse_traverse_override_does_not_warn(commit):
9394
"""Calling traverse on concrete subclasses is not deprecated, does not warn."""
9495
with _assert_no_deprecation_warning():
9596
commit.traverse()
97+
98+
99+
def test_iterable_inheriting_warns():
100+
"""Subclassing the deprecated git.util.Iterable issues a deprecation warning."""
101+
with pytest.deprecated_call():
102+
103+
class Derived(_Iterable):
104+
pass
105+
106+
107+
def test_iterable_obj_inheriting_does_not_warn():
108+
"""Subclassing git.util.IterableObj is not deprecated, does not warn."""
109+
with _assert_no_deprecation_warning():
110+
111+
class Derived(IterableObj):
112+
pass

0 commit comments

Comments
 (0)