[issue24134] assertRaises can behave differently

Magnus Carlsson report at bugs.python.org
Wed May 6 15:54:58 CEST 2015


Magnus Carlsson added the comment:

"The solution to that is to always have a test that your decorator actually returns a function. That's what I do."

Yes, I agree that with more tests I would have found the problem, but sometimes you forget things. And to me I want the tests to fail by default or for cases that are unspecified.

I think the sentinel solution would come a long way of solving both the issue that I reported but still keep the context solution intact.

Out of curiosity, would it be a solution to have the sentinel be a real function?

def _sentinel():
    pass

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24134>
_______________________________________


More information about the Python-bugs-list mailing list