In python3, stdout / stderr are text io wrappers (exposing a buffer property of the underlying bytestream). See issue #1407
(self)
| 910 | f.write(b"hello") # type: ignore[arg-type] |
| 911 | |
| 912 | def test_write_bytes_to_buffer(self) -> None: |
| 913 | """In python3, stdout / stderr are text io wrappers (exposing a buffer |
| 914 | property of the underlying bytestream). See issue #1407 |
| 915 | """ |
| 916 | f = capture.CaptureIO() |
| 917 | f.buffer.write(b"foo\r\n") |
| 918 | assert f.getvalue() == "foo\r\n" |
| 919 | |
| 920 | |
| 921 | class TestTeeCaptureIO(TestCaptureIO): |