MCPcopy
hub / github.com/pytest-dev/pytest / test_terminalwriter_not_unicode

Function test_terminalwriter_not_unicode

testing/io/test_terminalwriter.py:57–63  ·  view source on GitHub ↗

If the file doesn't support Unicode, the string is unicode-escaped (#7475).

()

Source from the content-addressed store, hash-verified

55
56
57def test_terminalwriter_not_unicode() -> None:
58 """If the file doesn't support Unicode, the string is unicode-escaped (#7475)."""
59 buffer = io.BytesIO()
60 file = io.TextIOWrapper(buffer, encoding="cp1252")
61 tw = terminalwriter.TerminalWriter(file)
62 tw.write("hello 🌀 wôrld אבג", flush=True)
63 assert buffer.getvalue() == rb"hello \U0001f300 w\xf4rld \u05d0\u05d1\u05d2"
64
65
66win32 = int(sys.platform == "win32")

Callers

nothing calls this directly

Calls 2

writeMethod · 0.95
getvalueMethod · 0.45

Tested by

no test coverage detected