Open GoogleCodeExporter opened 9 years ago
Should also mention, accompanying tests were added at the bottom of
testmocksignature.py.
Original comment by airpor...@gmail.com
on 23 Mar 2011 at 4:08
Original comment by fuzzyman
on 24 Mar 2011 at 12:33
This is an interesting patch and technique.
I solved this problem a different way for the new "autospec" functionality. It
generates functions with a (*args, **kwargs) signature that delegate to a mock,
but also call a function with the same signature as the original.
This still does the argument checking - but only calls the mock in the same way
as the user code.
I can't do this for mocksignature as it is backwards incompatible (the asserts
are different). I'm considering deprecating mocksignature because autospec (and
create_autospec) obsoletes it. This is implemented in the mercurial repo.
The only downside is that the generated functions don't have the same signature
as the original - but this only matters for code doing signature introspection
which is a pretty rare use case.
Original comment by fuzzyman
on 24 May 2011 at 11:24
Very cool. Does autospec have the "smart parameter checking" feature? If not,
would you like me to have a crack at it?
Original comment by airpor...@gmail.com
on 25 May 2011 at 1:45
Original issue reported on code.google.com by
airpor...@gmail.com
on 23 Mar 2011 at 4:06