MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_stdio

Method test_stdio

Lib/test/test_utf8_mode.py:130–158  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

128 # TODO: RUSTPYTHON
129 @unittest.expectedFailure
130 def test_stdio(self):
131 code = textwrap.dedent('''
132 import sys
133 print(f"stdin: {sys.stdin.encoding}/{sys.stdin.errors}")
134 print(f"stdout: {sys.stdout.encoding}/{sys.stdout.errors}")
135 print(f"stderr: {sys.stderr.encoding}/{sys.stderr.errors}")
136 ''')
137
138 out = self.get_output('-X', 'utf8', '-c', code,
139 PYTHONIOENCODING='')
140 self.assertEqual(out.splitlines(),
141 ['stdin: utf-8/surrogateescape',
142 'stdout: utf-8/surrogateescape',
143 'stderr: utf-8/backslashreplace'])
144
145 # PYTHONIOENCODING has the priority over PYTHONUTF8
146 out = self.get_output('-X', 'utf8', '-c', code,
147 PYTHONIOENCODING="latin1")
148 self.assertEqual(out.splitlines(),
149 ['stdin: iso8859-1/strict',
150 'stdout: iso8859-1/strict',
151 'stderr: iso8859-1/backslashreplace'])
152
153 out = self.get_output('-X', 'utf8', '-c', code,
154 PYTHONIOENCODING=":namereplace")
155 self.assertEqual(out.splitlines(),
156 ['stdin: utf-8/namereplace',
157 'stdout: utf-8/namereplace',
158 'stderr: utf-8/backslashreplace'])
159
160 def test_io(self):
161 code = textwrap.dedent('''

Callers

nothing calls this directly

Calls 4

get_outputMethod · 0.95
dedentMethod · 0.80
assertEqualMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected