testutil.shouldFail: mention the 'which' string in substring failures too

This commit is contained in:
Brian Warner 2008-05-16 16:08:38 -07:00
parent 304abfee32
commit 1121df6664

View File

@ -74,8 +74,8 @@ class ShouldFailMixin:
res.trap(expected_failure)
if substring:
self.failUnless(substring in str(res),
"substring '%s' not in '%s'"
% (substring, str(res)))
"%s: substring '%s' not in '%s'"
% (which, substring, str(res)))
else:
self.fail("%s was supposed to raise %s, not get '%s'" %
(which, expected_failure, res))