()
| 2082 | |
| 2083 | |
| 2084 | def test_output_stream_duck_typing(): |
| 2085 | # Accept objects having the right file-like methods... |
| 2086 | class DuckWriter: |
| 2087 | def __init__(self): |
| 2088 | self.buf = pa.BufferOutputStream() |
| 2089 | |
| 2090 | def close(self): |
| 2091 | pass |
| 2092 | |
| 2093 | @property |
| 2094 | def closed(self): |
| 2095 | return False |
| 2096 | |
| 2097 | def write(self, data): |
| 2098 | self.buf.write(data) |
| 2099 | |
| 2100 | duck_writer = DuckWriter() |
| 2101 | stream = pa.output_stream(duck_writer) |
| 2102 | assert stream.write(b'hello') |
| 2103 | assert duck_writer.buf.getvalue().to_pybytes() == b'hello' |
| 2104 | |
| 2105 | |
| 2106 | def test_output_stream_file_path(tmpdir): |
nothing calls this directly
no test coverage detected