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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17987>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to