| 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) |
no outgoing calls