New submission from R. David Murray <rdmur...@bitdance.com>:

I just spent an hour figuring out why my test was failing because I tried to do 
this:
   mymock.side_effect = (AuthenticationError, None)

expecting the first call to raise an auth error and the second time it was 
called to get a normal return.

Since there are almost zero circumstances in which one would really want to 
return an exception, is there any reason not to have mock check for exceptions 
and raise them in this circumstance?  (If one did need to return an exception 
one could write a function...which is what one has to do now for the above 
case, but the above case seems more commonly needed than returning an exception 
would be.)

----------
components: Library (Lib)
keywords: easy
messages: 158883
nosy: michael.foord, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: Mock could check for exceptions in side effect list
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to