[TIP] Mocking the .decode(...) method on a string

Ned Batchelder ned at nedbatchelder.com
Wed Aug 29 07:13:46 PDT 2012


On 8/29/2012 10:02 AM, Alexander O'Donovan-Jones wrote:
>
> Creating a mock object that raises the exceptions required is exactly 
> the route I'm taking now.
>
Yes, I can see that, but it's causing you trouble, and you can instead 
simply use two arguments to the function that will raise the exception, 
no?  I'm not sure why mocking is the better approach here.

--Ned.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20120829/9b8c9066/attachment.htm>


More information about the testing-in-python mailing list