[TIP] Can you mock a function that has a decorator applies to it?
brianna.laugher at gmail.com
Wed Jul 4 18:01:00 PDT 2012
On 5 July 2012 03:35, John Wong <gokoproject at gmail.com> wrote:
> There are times when decorator really shine and I don't see a way to Mock
> out the decorator. I know it replaces the current function.... is there a
> way out of this?
Can't you just call the decorator on your mocked function explicitly?
'@foo' is just syntactic sugar for 'fn = foo(fn)' anyway right?
I put a simple example with 'property' here:
Hope that explains it, not sure if you are trying to do something more
complicated than that.
They've just been waiting in a mountain for the right moment:
More information about the testing-in-python