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

Fred L. Drake, Jr. report at bugs.python.org
Tue May 28 14:25:35 CEST 2013


Fred L. Drake, Jr. added the comment:

Joining the documentation for captured_stderr and captured_stdout makes
sense, as they can really use a single example, and the usage is
completely parallel.

I'd rather see captured_stdin handled separately, perhaps with some
additional comments in the example, to emphasize the intended usage
pattern:

     with support.captured_stdin() as s:
         # Prepare simulated input:
         s.write('hello\n')
         s.seek(0)
         # Call test code that consumes from stdin:
         captured = input()
     self.assertEqual(captured, "hello")

----------

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


More information about the docs mailing list