Code Duplication    Length = 20-22 lines in 2 locations

tests/test_compat.py 2 locations

@@ 220-241 (lines=22) @@
217
    assert DClass().footer() == 4
218
219
220
def test_abstractstaticmethod_namespaced(abc, namespace):
221
    """Test interaction between namespaces and abstract staticmethods."""
222
    class CClass(metaclass=abc.NamespaceableABCMeta):
223
        """A throwaway test class."""
224
        with namespace() as ns:
225
            @staticmethod
226
            @abstractmethod
227
            def footer():
228
                """Return 3. Abstract."""
229
                return 3
230
    with pytest.raises(TypeError):
231
        print(CClass())
232
233
    class DClass(CClass):
234
        """A throwaway test class."""
235
        with namespace() as ns:
236
            @staticmethod
237
            def footer():
238
                """Return 4. Concrete."""
239
                return 4
240
    assert DClass.ns.footer() == 4
241
    assert DClass().ns.footer() == 4
242
243
244
def test_abstractmethod_integration(abc):
@@ 162-181 (lines=20) @@
159
    assert DClass().footer() == 'DClass'
160
161
162
def test_abstractclassmethod_namespaced(abc, namespace):
163
    """Test interaction between namespaces and abstract classmethods."""
164
    class CClass(metaclass=abc.NamespaceableABCMeta):
165
        """A throwaway test class."""
166
        with namespace() as ns:
167
            @classmethod
168
            @abstractmethod
169
            def footer(cls):
170
                return cls.__name__
171
    with pytest.raises(TypeError):
172
        print(CClass())
173
174
    class DClass(CClass):
175
        """A throwaway test class."""
176
        with namespace() as ns:
177
            @classmethod
178
            def footer(cls):
179
                return super().ns.footer()
180
    assert DClass.ns.footer() == 'DClass'
181
    assert DClass().ns.footer() == 'DClass'
182
183
184
def test_abstractstaticmethod_basics(abc):