Skip to content

Commit 4a3c286

Browse files
author
Álvaro Bartolomé
authored
Add regression test for ArrowWriter.write_batch when batch is empty (#4510)
* Fix if-statement logic in `write_batch` * Add regression test on `test_write_batch` * Replace AND-condition with OR in `write_batch` * Remove `write_batch({})` in `test_write_batch` * Add valid batch as `write_batch` arg * Revert if-statement change in `write_batch`
1 parent db26897 commit 4a3c286

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/test_arrow_writer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def test_write_batch(fields, writer_batch_size):
179179
schema = pa.schema(fields) if fields else None
180180
with ArrowWriter(stream=output, schema=schema, writer_batch_size=writer_batch_size) as writer:
181181
writer.write_batch({"col_1": ["foo", "bar"], "col_2": [1, 2]})
182+
writer.write_batch({"col_1": [], "col_2": []})
182183
num_examples, num_bytes = writer.finalize()
183184
assert num_examples == 2
184185
assert num_bytes > 0

0 commit comments

Comments
 (0)