示例#1
0
    def test_negative(self):
        class A:
            def foo(self):
                pass

        class B(A):
            pass

        assert not overrides(B, 'foo')
        assert not overrides(B(), 'foo')
示例#2
0
    def test_positive(self):
        class A:
            def foo(self):
                pass

        class B(A):
            def foo(self):
                pass

        assert overrides(B, 'foo')
        assert overrides(B(), 'foo')
示例#3
0
    def test_custom_base(self):
        class A:
            def foo(self): pass

        class B:
            def foo(self): pass

        class C:
            pass

        assert overrides(B, 'foo', A)
        assert not overrides(C, 'foo', A)
示例#4
0
    def test_three_class(self):
        class A:
            def foo(self): pass

        class B(A):
            pass

        class C(B):
            def foo(self): pass

        assert overrides(C, 'foo')
        assert not overrides(B, 'foo')