In python3, stdout / stderr are text io wrappers (exposing a buffer property of the underlying bytestream). See issue #1407
(self)
| 859 | pytest.raises(TypeError, f.write, b"hello") |
| 860 | |
| 861 | def test_write_bytes_to_buffer(self) -> None: |
| 862 | """In python3, stdout / stderr are text io wrappers (exposing a buffer |
| 863 | property of the underlying bytestream). See issue #1407 |
| 864 | """ |
| 865 | f = capture.CaptureIO() |
| 866 | f.buffer.write(b"foo\r\n") |
| 867 | assert f.getvalue() == "foo\r\n" |
| 868 | |
| 869 | |
| 870 | class TestTeeCaptureIO(TestCaptureIO): |