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