Is it possible to find the values of the local variables in a function by mocking?
class A:
def f(self):
a = 5000 * 10
B().someFunction(a)
How do I write a unit test for this function? I have mocked someFunction
as I do not want the testing scope to go outside the block. The only way I can test the rest of the function is by checking if the value of variable a is 50000 at the end of the function. How do I do this?
A function that does not return anything, doesn't modify anything and does not raise any error is a function that basically have no reason to be.
If none of the above, just delete your function and forget about it :)
With interaction testing, you could check what value someFunction was called with. What happens inside that function, should be tested in the unit test of that function.
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