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

Method test_stdin_loader

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

Source from the content-addressed store, hash-verified

156 self.assertIn(expected, out)
157
158 def test_stdin_loader(self):
159 # Unfortunately, there's no way to automatically test the fully
160 # interactive REPL, since that code path only gets executed when
161 # stdin is an interactive tty.
162 p = spawn_python()
163 try:
164 p.stdin.write(b"print(__loader__)\n")
165 p.stdin.flush()
166 finally:
167 out = kill_python(p)
168 expected = repr(importlib.machinery.BuiltinImporter).encode("utf-8")
169 self.assertIn(expected, out)
170
171 @contextlib.contextmanager
172 def interactive_python(self, separate_stderr=False):

Callers

nothing calls this directly

Calls 6

spawn_pythonFunction · 0.90
kill_pythonFunction · 0.90
assertInMethod · 0.80
writeMethod · 0.45
flushMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected