When applying a decorator, itβs good to look at it as
<wrapper1> <wrapper2> <wrapper3> **Your Function** </wrapper3> </wrapper2> </wrapper1>
Basically, your function should interact with wrappers in the following order:
wrapper3 β wrapper2 β wrapper1
@wrapper1 @wrapper2 @wrapper3 def your_func(wrapper1.input, wrapper2.input, wrapper3.input):
NOTE. wrapper1.input is not how you really refer to your input
To answer the second part of your question, how mymodule.os knows you need to reference os. With Patching, you actually intercept calls to that particular name. When you call os in mymodule , you actually call mymodule.os . When correcting, you should refer to the class, which is ridiculed by the way it is called in the actual code, and not from the point of view of test modules.
Danhabib
source share