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

Function captured_stderr

Lib/test/support/__init__.py:915–922  ·  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

913 return captured_output("stdout")
914
915def captured_stderr():
916 """Capture the output of sys.stderr:
917
918 with captured_stderr() as stderr:
919 print("hello", file=sys.stderr)
920 self.assertEqual(stderr.getvalue(), "hello\\n")
921 """
922 return captured_output("stderr")
923
924def captured_stdin():
925 """Capture the input to sys.stdin:

Calls 1

captured_outputFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…