diff --git a/tests/functional/p/protocol_classes_abstract.py b/tests/functional/p/protocol_classes_abstract.py index 95f74246e7a..f417d9729f5 100644 --- a/tests/functional/p/protocol_classes_abstract.py +++ b/tests/functional/p/protocol_classes_abstract.py @@ -1,5 +1,7 @@ """Test that classes inheriting from protocols should not warn about abstract-method.""" + # pylint: disable=too-few-public-methods,disallowed-name,invalid-name + from abc import abstractmethod from typing import Protocol, Literal @@ -14,6 +16,7 @@ def foo(self) -> Literal["foo"]: def foo_no_abstract(self) -> Literal["foo"]: """foo not abstract method""" + class BarProtocol(Protocol): """Bar Protocol""" @abstractmethod @@ -21,11 +24,14 @@ def bar(self) -> Literal["bar"]: """bar method""" - class FooBarProtocol(FooProtocol, BarProtocol, Protocol): """FooBar Protocol""" +class IndirectProtocol(FooProtocol): + """Doesn't subclass typing.Protocol directly""" + + class FooBar(FooBarProtocol): """FooBar object""" diff --git a/tests/functional/p/protocol_classes_abstract.rc b/tests/functional/p/protocol_classes_abstract.rc new file mode 100644 index 00000000000..85fc502b372 --- /dev/null +++ b/tests/functional/p/protocol_classes_abstract.rc @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.8