Escape % character in the assertion message. closes #604

This commit is contained in:
Anatoly Bubenkov
2014-10-07 01:01:21 +02:00
parent ba8ae427e2
commit a759da0208
4 changed files with 16 additions and 19 deletions

View File

@@ -172,6 +172,18 @@ class TestAssertionRewrite:
"*assert 1 == 2*",
])
def test_assertion_message_escape(self, testdir):
testdir.makepyfile("""
def test_foo():
assert 1 == 2, 'To be escaped: %'
""")
result = testdir.runpytest()
assert result.ret == 1
result.stdout.fnmatch_lines([
"*AssertionError: To be escaped: %",
"*assert 1 == 2",
])
def test_boolop(self):
def f():
f = g = False