I am writing the following copy, in which I am comparing two multilingual blocks of Unicode text to generate a decent error message. I try. The internal method that compares increases the argument, but the default explanation is worthless to me
I need to add something as code:
Def assert_long_strings_equal (one, other): line_on = one. Splitlines () line 1 for line1, zip in line 2 (line_on, line_th): try: my_assert_equal (line1, line2) except error, leave error: error: # Print information about the error of adding some information ?? Raise
I do not know how I can change the printed error message in assertionerror. Always Bearing error: u'something '! = 'Some more'
, which only shows the first line of output.
How can I change the message message?
If this is relevant, then I am using the nose
to run the test.
Use e.args
, e.message < / Code> has been deleted.
Try: Wrong, "hello!" E: e.args + = ('some other', 'important', 'notice', 42) increase
This protects the original traceback. The last part of this appears:
Error of assignment: ('hello!', 'Some other', 'important', 'notice', 42)
< P> Both works in Python 2.7 and Python 3.
Comments
Post a Comment