MCPcopy Create free account
hub / github.com/apache/arrow / FileFormatFixture

Class FileFormatFixture

python/pyarrow/tests/test_ipc.py:83–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83class FileFormatFixture(IpcFixture):
84
85 is_file = True
86 options = None
87
88 def _get_writer(self, sink, schema):
89 return pa.ipc.new_file(sink, schema, options=self.options)
90
91 def _check_roundtrip(self, as_table=False):
92 batches = self.write_batches(as_table=as_table)
93 file_contents = pa.BufferReader(self.get_source())
94
95 reader = pa.ipc.open_file(file_contents)
96
97 assert reader.num_record_batches == len(batches)
98
99 for i, batch in enumerate(batches):
100 # it works. Must convert back to DataFrame
101 batch = reader.get_batch(i)
102 assert batches[i].equals(batch)
103 assert reader.schema.equals(batches[0].schema)
104
105 assert isinstance(reader.stats, pa.ipc.ReadStats)
106 assert isinstance(self.write_stats, pa.ipc.WriteStats)
107 assert tuple(reader.stats) == tuple(self.write_stats)
108
109
110class StreamFormatFixture(IpcFixture):

Callers 2

file_fixtureFunction · 0.85
test_file_read_allFunction · 0.85

Calls

no outgoing calls

Tested by 2

file_fixtureFunction · 0.68
test_file_read_allFunction · 0.68