I want to validate if python function calls are valid without executing them.
Let's say I have the following code:
def func(a, b):
print(a, b)
cond = True
if cond:
func(1, 2)
else:
func(1)
If cond = True
, then everything will run just fine, but if cond = False
, then it will fail throwing the following error:
TypeError: func() takes exactly 2 arguments (1 given)
I need to know if all function calls are valid, without having to call any function.