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:
pytry 2014-10-05 14:49:15 +02:00
parent 9e549a1acf
commit 24468a6f34
1 changed files with 18 additions and 0 deletions

View File

@ -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