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

Function captured_stderr

Lib/test/support/__init__.py:827–834  ·  view source on GitHub ↗

Capture the output of sys.stderr: with captured_stderr() as stderr: print("hello", file=sys.stderr) self.assertEqual(stderr.getvalue(), "hello\\n")

()

Source from the content-addressed store, hash-verified

825 return captured_output("stdout")
826
827def captured_stderr():
828 """Capture the output of sys.stderr:
829
830 with captured_stderr() as stderr:
831 print("hello", file=sys.stderr)
832 self.assertEqual(stderr.getvalue(), "hello\\n")
833 """
834 return captured_output("stderr")
835
836def captured_stdin():
837 """Capture the input to sys.stdin:

Calls 1

captured_outputFunction · 0.85