Added test for ValueError in custom assert message with % sign (issue #604)
https://bitbucket.org/hpk42/pytest/issue/604/valueerror-unsupported-format-character-in --HG-- branch : test_for_issue_604
This commit is contained in:
parent
9e549a1acf
commit
24468a6f34
|
@ -0,0 +1,18 @@
|
|||
|
||||
def test_assert_message_fail():
|
||||
'''
|
||||
Check if custom message with % sign do not raise ValueError
|
||||
Later test can be parametrized with other problematic chars
|
||||
'''
|
||||
|
||||
MESSAGE = 'Message with %'
|
||||
|
||||
try:
|
||||
assert False, MESSAGE
|
||||
except ValueError, ve:
|
||||
assert False, 'ValueError was raised with the following message: ' \
|
||||
+ ve.message
|
||||
except AssertionError, ae:
|
||||
assert MESSAGE == ae.message, 'Assertion message: ' + ae.message \
|
||||
+ ' is different than expected: ' + MESSAGE
|
||||
|
Loading…
Reference in New Issue