diff options
Diffstat (limited to 'tests/pyreverse/test_inspector.py')
-rw-r--r-- | tests/pyreverse/test_inspector.py | 82 |
1 files changed, 2 insertions, 80 deletions
diff --git a/tests/pyreverse/test_inspector.py b/tests/pyreverse/test_inspector.py index 00cad918f..ce7a65b62 100644 --- a/tests/pyreverse/test_inspector.py +++ b/tests/pyreverse/test_inspector.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """For the visitors.diadefs module.""" @@ -15,7 +15,6 @@ from pathlib import Path import astroid import pytest -from astroid import nodes from pylint.pyreverse import inspector from pylint.pyreverse.inspector import Project @@ -37,20 +36,6 @@ def project(get_project: GetProjectCallable) -> Generator[Project, None, None]: yield project -def test_class_implements(project: Project) -> None: - klass = project.get_module("data.clientmodule_test")["Ancestor"] - assert hasattr(klass, "implements") - assert len(klass.implements) == 1 - assert isinstance(klass.implements[0], nodes.ClassDef) - assert klass.implements[0].name == "Interface" - - -def test_class_implements_specialization(project: Project) -> None: - klass = project.get_module("data.clientmodule_test")["Specialization"] - assert hasattr(klass, "implements") - assert len(klass.implements) == 0 - - def test_locals_assignment_resolution(project: Project) -> None: klass = project.get_module("data.clientmodule_test")["Specialization"] assert hasattr(klass, "locals_type") @@ -78,54 +63,6 @@ def test_instance_attrs_resolution(project: Project) -> None: assert type_dict["_id"][0] is astroid.Uninferable -def test_concat_interfaces() -> None: - cls = astroid.extract_node( - ''' - class IMachin: pass - - class Correct2: - """docstring""" - __implements__ = (IMachin,) - - class BadArgument: - """docstring""" - __implements__ = (IMachin,) - - class InterfaceCanNowBeFound: #@ - """docstring""" - __implements__ = BadArgument.__implements__ + Correct2.__implements__ - ''' - ) - interfaces = inspector.interfaces(cls) - assert [i.name for i in interfaces] == ["IMachin"] - - -def test_interfaces() -> None: - module = astroid.parse( - """ - class Interface(object): pass - class MyIFace(Interface): pass - class AnotherIFace(Interface): pass - class Concrete0(object): - __implements__ = MyIFace - class Concrete1: - __implements__ = (MyIFace, AnotherIFace) - class Concrete2: - __implements__ = (MyIFace, AnotherIFace) - class Concrete23(Concrete1): pass - """ - ) - - for klass, interfaces in ( - ("Concrete0", ["MyIFace"]), - ("Concrete1", ["MyIFace", "AnotherIFace"]), - ("Concrete2", ["MyIFace", "AnotherIFace"]), - ("Concrete23", []), - ): - klass = module[klass] - assert [i.name for i in inspector.interfaces(klass)] == interfaces - - def test_from_directory(project: Project) -> None: expected = os.path.join("tests", "data", "__init__.py") assert project.name == "data" @@ -140,18 +77,3 @@ def test_project_node(project: Project) -> None: "data.suppliermodule_test", ] assert sorted(project.keys()) == expected - - -def test_interface_deprecation(project: Project) -> None: - linker = inspector.Linker(project) - cls = astroid.extract_node( - ''' - class IMachin: pass - - class Concrete: #@ - """docstring""" - __implements__ = (IMachin,) - ''' - ) - with pytest.warns(DeprecationWarning): - linker.visit_classdef(cls) |