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

Method test_block_sizes

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

Source from the content-addressed store, hash-verified

142 assert [c.name for c in table.columns] == names
143
144 def test_block_sizes(self):
145 rows = b'{"a": 1}\n{"a": 2}\n{"a": 3}'
146 read_options = ReadOptions()
147 parse_options = ParseOptions()
148
149 for data in [rows, rows + b'\n']:
150 for newlines_in_values in [False, True]:
151 parse_options.newlines_in_values = newlines_in_values
152 read_options.block_size = 4
153 with pytest.raises(ValueError,
154 match="try to increase block size"):
155 self.read_bytes(data, read_options=read_options,
156 parse_options=parse_options)
157
158 # Validate reader behavior with various block sizes.
159 # There used to be bugs in this area.
160 for block_size in range(9, 20):
161 read_options.block_size = block_size
162 table = self.read_bytes(data, read_options=read_options,
163 parse_options=parse_options)
164 assert table.to_pydict() == {'a': [1, 2, 3]}
165
166 def test_no_newline_at_end(self):
167 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