def assemble(self, component_spec): if component_spec == "test.dummy.ModuleClass": return dummy.ModuleClass("test") elif component_spec == "number": return 101 else: raise RuntimeError( "_MockAssembler can't assemble %r" % component_spec)
def test_fails_to_identify_instance(self): # instance doesn't have __qualname__ or __name__ instance = dummy.ModuleClass(None) e_expected = AglyphError("%r does not have an importable dotted name" % instance) assertRaisesWithMessage(self, e_expected, _identify, instance)
def test_user_object(self): obj = dummy.ModuleClass(None) e_expected = AglyphError("%r does not have an importable dotted name" % obj) assertRaisesWithMessage(self, e_expected, Reference, obj)
def test_bound_method(self): bound_method = dummy.ModuleClass(None).method e_expected = AglyphError("%r does not have an importable dotted name" % bound_method) assertRaisesWithMessage(self, e_expected, Reference, bound_method)
def test_instance_is_not_importable(self): self.assertFalse(_importable(dummy.ModuleClass(None)))