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

Method _check_roundtrip

python/pyarrow/tests/test_ipc.py:91–107  ·  view source on GitHub ↗
(self, as_table=False)

Source from the content-addressed store, hash-verified

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

test_file_write_tableFunction · 0.80

Calls 5

lenFunction · 0.85
write_batchesMethod · 0.80
BufferReaderMethod · 0.80
get_sourceMethod · 0.80
equalsMethod · 0.80

Tested by

no test coverage detected