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

Method captured_stdout_with_buffer

Lib/test/test_calendar.py:1071–1080  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1069
1070 @contextlib.contextmanager
1071 def captured_stdout_with_buffer(self):
1072 orig_stdout = sys.stdout
1073 buffer = io.BytesIO()
1074 sys.stdout = io.TextIOWrapper(buffer)
1075 try:
1076 yield sys.stdout
1077 finally:
1078 sys.stdout.flush()
1079 sys.stdout.buffer.seek(0)
1080 sys.stdout = orig_stdout
1081
1082 @contextlib.contextmanager
1083 def captured_stderr_with_buffer(self):

Callers 2

run_cli_okMethod · 0.95
test_helpMethod · 0.95

Calls 2

flushMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected