Code Duplication    Length = 32-32 lines in 2 locations

tests/test_compat.py 2 locations

@@ 176-207 (lines=32) @@
173
    assert DClass().ns.footer() == 'DClass'
174
175
176
def test_abstractstaticmethod_basics(abc):
177
    """Test abstract staticmethod works as expected.
178
179
    Adapted from Python's test suite.
180
    """
181
    @staticmethod
182
    @abstractmethod
183
    def footer():
184
        pass
185
    assert footer.__isabstractmethod__
186
187
    @staticmethod
188
    def barter():
189
        pass
190
    assert not getattr(barter, "__isabstractmethod__", False)
191
192
    class CClass(metaclass=abc.NamespaceableABCMeta):
193
        """A throwaway test class."""
194
        @staticmethod
195
        @abstractmethod
196
        def footer():
197
            return 3
198
    with pytest.raises(TypeError):
199
        print(CClass())
200
201
    class DClass(CClass):
202
        """A throwaway test class."""
203
        @staticmethod
204
        def footer():
205
            return 4
206
    assert DClass.footer() == 4
207
    assert DClass().footer() == 4
208
209
210
def test_abstractstaticmethod_namespaced(abc, namespace):
@@ 120-151 (lines=32) @@
117
    assert DClass().ns.footer == 3
118
119
120
def test_abstractclassmethod_basics(abc):
121
    """Test abstract classmethod works as expected.
122
123
    Adapted from Python's test suite.
124
    """
125
    @classmethod
126
    @abstractmethod
127
    def footer(cls):
128
        pass
129
    assert footer.__isabstractmethod__
130
131
    @classmethod
132
    def barter(cls):
133
        pass
134
    assert not getattr(barter, "__isabstractmethod__", False)
135
136
    class CClass(metaclass=abc.NamespaceableABCMeta):
137
        """A throwaway test class."""
138
        @classmethod
139
        @abstractmethod
140
        def footer(cls):
141
            return cls.__name__
142
    with pytest.raises(TypeError):
143
        print(CClass())
144
145
    class DClass(CClass):
146
        """A throwaway test class."""
147
        @classmethod
148
        def footer(cls):
149
            return super().footer()
150
    assert DClass.footer() == 'DClass'
151
    assert DClass().footer() == 'DClass'
152
153
154
def test_abstractclassmethod_namespaced(abc, namespace):