示例#1
0
    def test_single_down(self):
        class A(object):
            pass

        register_class(A)

        mgr_factory = lambda cls: instrumentation.ClassManager(cls)

        class B(A):
            __sa_instrumentation_manager__ = staticmethod(mgr_factory)

        assert_raises_message(TypeError,
                              "multiple instrumentation implementations",
                              register_class, B)
示例#2
0
    def test_none(self):
        class A(object):
            pass

        register_class(A)

        mgr_factory = lambda cls: instrumentation.ClassManager(cls)

        class B(object):
            __sa_instrumentation_manager__ = staticmethod(mgr_factory)

        register_class(B)

        class C(object):
            __sa_instrumentation_manager__ = instrumentation.ClassManager

        register_class(C)
示例#3
0
    def test_diamond_b1(self):
        mgr_factory = lambda cls: instrumentation.ClassManager(cls)

        class A(object):
            pass

        class B1(A):
            pass

        class B2(A):
            __sa_instrumentation_manager__ = staticmethod(mgr_factory)

        class C(object):
            pass

        assert_raises_message(TypeError,
                              "multiple instrumentation implementations",
                              register_class, B1)
示例#4
0
 def mgr_factory(cls):
     return instrumentation.ClassManager(cls)