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

Function test_write_options

python/pyarrow/tests/test_csv.py:399–429  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

397
398
399def test_write_options():
400 cls = WriteOptions
401 opts = cls()
402
403 check_options_class(
404 cls, include_header=[True, False], delimiter=[',', '\t', '|'],
405 quoting_style=['needed', 'none', 'all_valid'])
406
407 assert opts.batch_size > 0
408 opts.batch_size = 12345
409 assert opts.batch_size == 12345
410
411 opts = cls(batch_size=9876)
412 assert opts.batch_size == 9876
413
414 opts.validate()
415
416 match = "WriteOptions: batch_size must be at least 1: 0"
417 with pytest.raises(pa.ArrowInvalid, match=match):
418 opts = cls()
419 opts.batch_size = 0
420 opts.validate()
421
422 expected_repr_inner = """
423 include_header=True,
424 batch_size=0,
425 delimiter=',',
426 quoting_style='needed'"""
427
428 assert repr(opts) == f"<pyarrow.csv.WriteOptions>({expected_repr_inner})"
429 assert str(opts) == f"WriteOptions({expected_repr_inner})"
430
431
432class BaseTestCSV(abc.ABC):

Callers

nothing calls this directly

Calls 2

check_options_classFunction · 0.85
validateMethod · 0.45

Tested by

no test coverage detected