[issue9110] contextlib.ContextDecorator

Michael Foord report at bugs.python.org
Tue Jun 29 16:13:38 CEST 2010


Michael Foord <michael at voidspace.org.uk> added the comment:

Hey Nick,

The tests are pretty much just copied from the previous version, so they aren't all appropriate. In fact I think that the first two tests (and even the typo tests) can just go as they really just test Python semantics and not the ContextDecorator itself.

The method tests are testing that the arguments (including keyword arguments) are properly passed through to the decorated function. I started to write a comment to that effect as I realised it wasn't obvious, but forgot to finish the comment... Separate instantiations just mean we don't need to worry about previous values.

(I did them as methods as I was *starting* to write a test for general descriptor decorating - but the general case for that is very hard to solve so people just have to use their decorators in the right order instead. Nonetheless it is nice to have a test that decorates a method as well as the other function decorating tests.)

Your improvement to the exceptions tests are good.

----------

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


More information about the Python-bugs-list mailing list