Beispiel #1
0
 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)
Beispiel #2
0
 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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 def test_instance_is_not_importable(self):
     self.assertFalse(_importable(dummy.ModuleClass(None)))