Esempio n. 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'))
Esempio n. 2
0
 def test_method_slot(self):
     """ Can we retrieve top-level methods?
     """
     obj = Struct()
     obj.getter = types.MethodType(lambda self: 0, obj)
     self.assertEqual(get_slot(obj, 'getter'), 0)