py2 fixes

This commit is contained in:
Daniel Hahler 2019-04-06 15:00:12 +02:00
parent df377b589f
commit 2ebb69b50a
1 changed files with 14 additions and 11 deletions

View File

@ -1,3 +1,4 @@
# coding=utf8
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
@ -1268,15 +1269,17 @@ def test_line_with_reprcrash(monkeypatch):
check("some\nmessage", 80, "FAILED some::nodeid - some") check("some\nmessage", 80, "FAILED some::nodeid - some")
# Test unicode safety. # Test unicode safety.
check("😄😄😄😄😄\n2nd line", 25, "FAILED some::nodeid - ...") check(u"😄😄😄😄😄\n2nd line", 25, u"FAILED some::nodeid - ...")
check("😄😄😄😄😄\n2nd line", 26, "FAILED some::nodeid - ...") check(u"😄😄😄😄😄\n2nd line", 26, u"FAILED some::nodeid - ...")
check("😄😄😄😄😄\n2nd line", 27, "FAILED some::nodeid - 😄...") check(u"😄😄😄😄😄\n2nd line", 27, u"FAILED some::nodeid - 😄...")
check("😄😄😄😄😄\n2nd line", 28, "FAILED some::nodeid - 😄...") check(u"😄😄😄😄😄\n2nd line", 28, u"FAILED some::nodeid - 😄...")
check("😄😄😄😄😄\n2nd line", 29, "FAILED some::nodeid - 😄😄...") check(u"😄😄😄😄😄\n2nd line", 29, u"FAILED some::nodeid - 😄😄...")
mocked_pos = "nodeid::😄::withunicode" # NOTE: constructed, not sure if this is supported.
check("😄😄😄😄😄\n2nd line", 29, "FAILED nodeid::😄::withunicode") # It would fail if not using u"" in Python 2 for mocked_pos.
check("😄😄😄😄😄\n2nd line", 40, "FAILED nodeid::😄::withunicode - 😄😄...") mocked_pos = u"nodeid::😄::withunicode"
check("😄😄😄😄😄\n2nd line", 41, "FAILED nodeid::😄::withunicode - 😄😄...") check(u"😄😄😄😄😄\n2nd line", 29, u"FAILED nodeid::😄::withunicode")
check("😄😄😄😄😄\n2nd line", 42, "FAILED nodeid::😄::withunicode - 😄😄😄...") check(u"😄😄😄😄😄\n2nd line", 40, u"FAILED nodeid::😄::withunicode - 😄😄...")
check("😄😄😄😄😄\n2nd line", 80, "FAILED nodeid::😄::withunicode - 😄😄😄😄😄") check(u"😄😄😄😄😄\n2nd line", 41, u"FAILED nodeid::😄::withunicode - 😄😄...")
check(u"😄😄😄😄😄\n2nd line", 42, u"FAILED nodeid::😄::withunicode - 😄😄😄...")
check(u"😄😄😄😄😄\n2nd line", 80, u"FAILED nodeid::😄::withunicode - 😄😄😄😄😄")