commit
2b3ac35780
|
@ -259,6 +259,8 @@ class MultiCall:
|
|||
return kwargs
|
||||
|
||||
def varnames(func):
|
||||
if not inspect.isfunction(func) and not inspect.ismethod(func):
|
||||
func = getattr(func, '__call__', func)
|
||||
ismethod = inspect.ismethod(func)
|
||||
rawcode = py.code.getrawcode(func)
|
||||
try:
|
||||
|
|
|
@ -340,8 +340,12 @@ def test_varnames():
|
|||
class A:
|
||||
def f(self, y):
|
||||
pass
|
||||
class B(object):
|
||||
def __call__(self, z):
|
||||
pass
|
||||
assert varnames(f) == ("x",)
|
||||
assert varnames(A().f) == ('y',)
|
||||
assert varnames(B()) == ('z',)
|
||||
|
||||
class TestMultiCall:
|
||||
def test_uses_copy_of_methods(self):
|
||||
|
|
Loading…
Reference in New Issue