If I have a function like this:
def any_function(type_name, field_name):
def another_function(name):
...
How would I go about testing any_function
?
In case I used the wrong definition of testing, I mean by writing
print(any_function(...))
You wouldn't test an inner function. You'd just test the functionality of the outer function; the inner function is an implementation detail, not the API presented by the unit. You'd normally use an inner function to produce a closure, making the inner function dependent on the scope.
Now, if the inner function is returned by the outer, test that return value, like you would the product of any function.
If the inner function is independent and requires tests of its own, you shouldn't be nesting it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With