Added test for ValueError in custom assert message with % sign (issue #604)
https://bitbucket.org/hpk42/pytest/issue/604/valueerror-unsupported-format-character-in
This commit is contained in:
parent
c7a45d6eaf
commit
ba8ae427e2
|
@ -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