parent: correct CallSpec name formatting for class methods.

This commit is contained in:
David Wilson 2018-09-10 00:23:32 +01:00
parent 52a121d4aa
commit 863c1b7597
1 changed files with 6 additions and 2 deletions

View File

@ -596,8 +596,12 @@ class CallSpec(object):
self.kwargs = kwargs
def _get_name(self):
return u'%s.%s' % (self.func.__module__,
self.func.__name__)
bits = [self.func.__module__]
if inspect.ismethod(self.func):
bits.append(getattr(self.func.__self__, '__name__', None) or
getattr(type(self.func.__self__), '__name__', None))
bits.append(self.func.__name__)
return u'.'.join(bits)
def _get_args(self):
return u', '.join(repr(a) for a in self.args)