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

Method test_block_sizes

python/pyarrow/tests/test_json.py:151–170  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

149 assert [c.name for c in table.columns] == names
150
151 def test_block_sizes(self):
152 rows = b'{"a": 1}\n{"a": 2}\n{"a": 3}'
153 read_options = ReadOptions()
154 parse_options = ParseOptions()
155
156 for data in [rows, rows + b'\n']:
157 for newlines_in_values in [False, True]:
158 parse_options.newlines_in_values = newlines_in_values
159 read_options.block_size = 4
160 with pytest.raises(ValueError, match="try to increase block size"):
161 self.read_bytes(data, read_options=read_options,
162 parse_options=parse_options)
163
164 # Validate reader behavior with various block sizes.
165 # There used to be bugs in this area.
166 for block_size in range(9, 20):
167 read_options.block_size = block_size
168 table = self.read_bytes(data, read_options=read_options,
169 parse_options=parse_options)
170 assert table.to_pydict() == {'a': [1, 2, 3]}
171
172 def test_no_newline_at_end(self):
173 rows = b'{"a": 1,"b": 2, "c": 3}\n{"a": 4,"b": 5, "c": 6}'

Callers

nothing calls this directly

Calls 3

read_bytesMethod · 0.95
ReadOptionsClass · 0.90
ParseOptionsClass · 0.90

Tested by

no test coverage detected