|
17 | 17 |
|
18 | 18 | # Check that various deprecation warnings are raised |
19 | 19 |
|
| 20 | +# flake8: noqa |
| 21 | + |
20 | 22 | import pyarrow as pa |
21 | 23 | import pytest |
22 | | - |
23 | | - |
24 | | -def test_inmemory_output_stream(): |
25 | | - with pytest.warns(FutureWarning): |
26 | | - stream = pa.InMemoryOutputStream() |
27 | | - assert isinstance(stream, pa.BufferOutputStream) |
28 | | - |
29 | | - |
30 | | -def test_file_reader_writer(): |
31 | | - data = [ |
32 | | - pa.array([1, 2, 3, 4]), |
33 | | - pa.array(['foo', 'bar', 'baz', None]), |
34 | | - pa.array([True, None, False, True]) |
35 | | - ] |
36 | | - batch = pa.RecordBatch.from_arrays(data, ['f0', 'f1', 'f2']) |
37 | | - |
38 | | - sink = pa.BufferOutputStream() |
39 | | - |
40 | | - with pytest.warns(FutureWarning): |
41 | | - stream_writer = pa.StreamWriter(sink, batch.schema) |
42 | | - assert isinstance(stream_writer, pa.RecordBatchStreamWriter) |
43 | | - |
44 | | - sink2 = pa.BufferOutputStream() |
45 | | - with pytest.warns(FutureWarning): |
46 | | - file_writer = pa.FileWriter(sink2, batch.schema) |
47 | | - assert isinstance(file_writer, pa.RecordBatchFileWriter) |
48 | | - |
49 | | - file_writer.write_batch(batch) |
50 | | - stream_writer.write_batch(batch) |
51 | | - |
52 | | - file_writer.close() |
53 | | - stream_writer.close() |
54 | | - |
55 | | - buf = sink.get_result() |
56 | | - buf2 = sink2.get_result() |
57 | | - |
58 | | - with pytest.warns(FutureWarning): |
59 | | - stream_reader = pa.StreamReader(buf) |
60 | | - assert isinstance(stream_reader, pa.RecordBatchStreamReader) |
61 | | - |
62 | | - with pytest.warns(FutureWarning): |
63 | | - file_reader = pa.FileReader(buf2) |
64 | | - assert isinstance(file_reader, pa.RecordBatchFileReader) |
0 commit comments