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)
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)
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)
def mgr_factory(cls): return instrumentation.ClassManager(cls)