()
| 75 | |
| 76 | |
| 77 | def test_python_file_write(): |
| 78 | buf = BytesIO() |
| 79 | |
| 80 | f = pa.PythonFile(buf) |
| 81 | |
| 82 | assert f.tell() == 0 |
| 83 | |
| 84 | s1 = b'enga\xc3\xb1ado' |
| 85 | s2 = b'foobar' |
| 86 | |
| 87 | f.write(s1) |
| 88 | assert f.tell() == len(s1) |
| 89 | |
| 90 | f.write(s2) |
| 91 | |
| 92 | expected = s1 + s2 |
| 93 | |
| 94 | result = buf.getvalue() |
| 95 | assert result == expected |
| 96 | |
| 97 | assert not f.closed |
| 98 | f.close() |
| 99 | assert f.closed |
| 100 | |
| 101 | with pytest.raises(TypeError, match="binary file expected"): |
| 102 | pa.PythonFile(StringIO()) |
| 103 | |
| 104 | |
| 105 | def test_python_file_read(): |
nothing calls this directly
no test coverage detected