Closed aballet closed 3 months ago
Hello, Adrien
But why not to use overriding? In this case I'm thinking about "The Zen of Python":
There should be one-- and preferably only one --obvious way to do it.
And mocking through arguments seems like another not very obvious way to mock something.
Hey, thank you for the quick answer.
It's a valid point indeed, I will refactor my tests a bit to work with overriding.
Hello,
I'm wondering why the re-definition of an argument raises an error?
I have this use case in mind: I find it elegant to inject a provider in a method's arguments, but I would love to override it in my unit tests by simply giving a mock as an argument. So far, I was able to do that with dependency-injector which I'm trying to replace, so I was wondering if I was missing the reason behind this error raising?
I'm thinking about defining my own inject to bypass this behavior; maybe it could be a parameter of the decorator?
Adrien.