inspect.signature throws TypeError
if callable() fails it raises typeerror not sure if it also raises a valueerror
This commit is contained in:
parent
fa5983613b
commit
322b267825
1 changed files with 2 additions and 1 deletions
|
@ -37,7 +37,7 @@ def is_data_provider(fun: Any) -> bool:
|
|||
# todo. uh.. very similar to what cachew is trying to do?
|
||||
try:
|
||||
sig = inspect.signature(fun)
|
||||
except ValueError: # not a function?
|
||||
except (ValueError, TypeError): # not a function?
|
||||
return False
|
||||
|
||||
# has at least one argument without default values
|
||||
|
@ -56,6 +56,7 @@ def test_is_data_provider() -> None:
|
|||
idp = is_data_provider
|
||||
assert not idp(None)
|
||||
assert not idp(int)
|
||||
assert not idp("x")
|
||||
|
||||
def no_return_type():
|
||||
return [1, 2 ,3]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue