[docs] [issue17987] test.support.captured_stderr, captured_stdin not documented

Dmi Baranov report at bugs.python.org
Mon May 27 20:51:11 CEST 2013


Dmi Baranov added the comment:

Yes, I agree that this is not an obvious sample, but:

$ ./python -m test.test_support | grep test_captured_stdin
test_captured_stdin (__main__.TestSupport) ... ok

What's about that?

with captured_stdin() as s:
    s.write('hello\n')
    s.seek(0)
    captured = input()

assert captured == 'hello'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17987>
_______________________________________


More information about the docs mailing list