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

Function captured_stdin

Lib/test/support/__init__.py:836–846  ·  view source on GitHub ↗

Capture the input to sys.stdin: with captured_stdin() as stdin: stdin.write('hello\\n') stdin.seek(0) # call test code that consumes from sys.stdin captured = input() self.assertEqual(captured, "hello")

()

Source from the content-addressed store, hash-verified

834 return captured_output("stderr")
835
836def captured_stdin():
837 """Capture the input to sys.stdin:
838
839 with captured_stdin() as stdin:
840 stdin.write('hello\\n')
841 stdin.seek(0)
842 # call test code that consumes from sys.stdin
843 captured = input()
844 self.assertEqual(captured, "hello")
845 """
846 return captured_output("stdin")
847
848
849def gc_collect():

Callers 1

run_cliMethod · 0.90

Calls 1

captured_outputFunction · 0.85

Tested by 1

run_cliMethod · 0.72