예제 #1
0
 def test_method_not_bound(self):
     """ Check that methods that not bound to the object are not called.
     """
     other = Struct()
     other.getter = types.MethodType(lambda self: 0, other)
     obj = Struct()
     obj.meth = other.getter
     self.assertRaises(AttributeError, lambda: get_slot(obj, 'meth'))
예제 #2
0
 def test_method_slot_args(self):
     """ Check that methods with required arguments are not called.
     """
     obj = Struct()
     obj.meth = types.MethodType(lambda self, x: x, obj)
     self.assertRaises(AttributeError, lambda: get_slot(obj, 'meth'))