Martin Panter added the comment:
Maybe it would be even better to wrap this up using
unittest.mock.patch.object(). That is an obscure function that is hard to learn
from the documentation, but very useful for testing. There is also
test.support.swap_attr(), which is easier to figure out. Something like:
with patch.object(sub.__class__.spam, '__doc__', 'Spam'):
self.assertEqual(sub.__class__.spam.__doc__, 'Spam')
----------
nosy: +martin.panter
stage: -> patch review
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25755>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com