MCPcopy
hub / github.com/huggingface/datasets / test_write_with_keys

Function test_write_with_keys

tests/test_arrow_writer.py:136–147  ·  view source on GitHub ↗
(writer_batch_size)

Source from the content-addressed store, hash-verified

134
135@pytest.mark.parametrize("writer_batch_size", [None, 2, 10])
136def test_write_with_keys(writer_batch_size):
137 output = pa.BufferOutputStream()
138 with ArrowWriter(
139 stream=output,
140 writer_batch_size=writer_batch_size,
141 ) as writer:
142 writer.write({"col_1": "foo", "col_2": 1})
143 writer.write({"col_1": "bar", "col_2": 2})
144 num_examples, num_bytes = writer.finalize()
145 assert num_examples == 2
146 assert num_bytes > 0
147 _check_output(output.getvalue(), expected_num_chunks=num_examples if writer_batch_size == 1 else 1)
148
149
150@pytest.mark.parametrize("writer_batch_size", [None, 1, 10])

Callers

nothing calls this directly

Calls 4

ArrowWriterClass · 0.90
_check_outputFunction · 0.85
finalizeMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected