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

Method check_input

Lib/test/test_cmd_line.py:462–472  ·  view source on GitHub ↗
(self, code, expected)

Source from the content-addressed store, hash-verified

460 self.assertIn(escaped, data)
461
462 def check_input(self, code, expected):
463 with tempfile.NamedTemporaryFile("wb+") as stdin:
464 sep = os.linesep.encode('ASCII')
465 stdin.write(sep.join((b'abc', b'def')))
466 stdin.flush()
467 stdin.seek(0)
468 with subprocess.Popen(
469 (sys.executable, "-c", code),
470 stdin=stdin, stdout=subprocess.PIPE) as proc:
471 stdout, stderr = proc.communicate()
472 self.assertEqual(stdout.rstrip(), expected)
473
474 def test_stdin_readline(self):
475 # Issue #11272: check that sys.stdin.readline() replaces '\r\n' by '\n'

Callers 2

test_stdin_readlineMethod · 0.95
test_builtin_inputMethod · 0.95

Calls 8

encodeMethod · 0.45
writeMethod · 0.45
joinMethod · 0.45
flushMethod · 0.45
seekMethod · 0.45
communicateMethod · 0.45
assertEqualMethod · 0.45
rstripMethod · 0.45

Tested by

no test coverage detected