ValueError: if the class could not be resolved for any unexpected reason.
"""
+ # Callable objects: return their own class.
+ if (not hasattr(m, '__name__') and hasattr(m, '__class__') and
+ hasattr(m, '__call__')):
+ if isinstance(m.__class__, six.class_types):
+ return m.__class__
+
# Instance method and class methods: should be bound to a non-null "self".
# If self is a class, then it's a class method.
if hasattr(m, '__self__'):
inspect_utils.getmethodclass(test_obj.wrap_decorated_member),
LocalClass)
+ def test_getmethodclass_callables(self):
+ class TestCallable(object):
+
+ def __call__(self):
+ pass
+
+ c = TestCallable()
+ self.assertEqual(inspect_utils.getmethodclass(c), TestCallable)
+
if __name__ == '__main__':
test.main()