Capture the output of sys.stderr: with captured_stderr() as stderr: print("hello", file=sys.stderr) self.assertEqual(stderr.getvalue(), "hello\\n")
()
| 913 | return captured_output("stdout") |
| 914 | |
| 915 | def 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 | |
| 924 | def captured_stdin(): |
| 925 | """Capture the input to sys.stdin: |
searching dependent graphs…