Code Duplication    Length = 24-26 lines in 2 locations

test/test_compat.py 2 locations

@@ 77-102 (lines=26) @@
74
            return super().foo
75
    assert D().foo == 3
76
77
78
def test_abstractproperty_namespaced(abc, namespace):
79
80
    class C(metaclass=abc.NamespaceableABCMeta):
81
        with namespace() as ns:
82
            @property
83
            @abstractmethod
84
            def foo(self):
85
                return 3
86
    with pytest.raises(TypeError):
87
        print(C())
88
89
    class D(C):
90
        with namespace() as ns:
91
            @C.ns.foo.getter
92
            def foo(self):
93
                return super().ns.foo
94
    assert D().ns.foo == 3
95
96
97
def test_abstractclassmethod_basics(abc):
98
    @classmethod
99
    @abstractmethod
100
    def foo(cls):
101
        pass
102
    assert foo.__isabstractmethod__
103
104
    @classmethod
105
    def bar(cls):
@@ 51-74 (lines=24) @@
48
        pass
49
    assert not hasattr(bar, "__isabstractmethod__")
50
51
52
def test_abstractproperty_basics(abc):
53
    @property
54
    @abstractmethod
55
    def foo(self):
56
        pass
57
    assert foo.__isabstractmethod__
58
59
    def bar(self):
60
        pass
61
    assert not getattr(bar, "__isabstractmethod__", False)
62
63
    class C(metaclass=abc.NamespaceableABCMeta):
64
        @property
65
        @abstractmethod
66
        def foo(self):
67
            return 3
68
    with pytest.raises(TypeError):
69
        print(C())
70
71
    class D(C):
72
        @C.foo.getter
73
        def foo(self):
74
            return super().foo
75
    assert D().foo == 3
76
77