MCPcopy Index your code
hub / github.com/python/cpython / assertStdinRoundTrip

Method assertStdinRoundTrip

Lib/test/test_winconsoleio.py:168–180  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

166 self.assertEqual(f.write(data), len(data))
167
168 def assertStdinRoundTrip(self, text):
169 stdin = open('CONIN$', 'r')
170 old_stdin = sys.stdin
171 try:
172 sys.stdin = stdin
173 write_input(
174 stdin.buffer.raw,
175 (text + '\r\n').encode('utf-16-le', 'surrogatepass')
176 )
177 actual = input()
178 finally:
179 sys.stdin = old_stdin
180 self.assertEqual(actual, text)
181
182 @requires_resource('console')
183 def test_input(self):

Callers 2

test_inputMethod · 0.95
test_input_nonbmpMethod · 0.95

Calls 4

inputFunction · 0.85
openFunction · 0.50
encodeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected