Using addDetail() is fiddly for simple cases
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
I want to be able to write, for example:
with ExpectedExcepti
but instead I have to write:
from testtools.content import text_content
with ExpectedExcepti
or:
from testtools.content import Content
from testtools.
with ExpectedExcepti
It would make my life better if addDetail() did something sensible
with non-Content objects.
For example something as simple the following might be reasonable:
def addDetail(self, name, content_object):
if not isinstance(
...
I think something like this is a good idea, and that attaching a repr of an object as text content is a sensible default.
Would probably prefer expressing this with an alternative parameter or a different function name, e.g.
self. addDetail( "return_ value", None, return_value)
(can't think of a good keyword arg name right now). Or:
self. attachObject( "return_ value", return_value)
Am not overly enamoured of that name either.