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

Function test_write_options

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

Source from the content-addressed store, hash-verified

412
413
414def test_write_options():
415 cls = WriteOptions
416 opts = cls()
417
418 check_options_class(
419 cls, include_header=[True, False], delimiter=[',', '\t', '|'],
420 quoting_style=['needed', 'none', 'all_valid'])
421
422 assert opts.batch_size > 0
423 opts.batch_size = 12345
424 assert opts.batch_size == 12345
425
426 opts = cls(batch_size=9876)
427 assert opts.batch_size == 9876
428
429 opts.validate()
430
431 match = "WriteOptions: batch_size must be at least 1: 0"
432 with pytest.raises(pa.ArrowInvalid, match=match):
433 opts = cls()
434 opts.batch_size = 0
435 opts.validate()
436
437 expected_repr_inner = """
438 include_header=True,
439 batch_size=0,
440 delimiter=',',
441 quoting_style='needed'"""
442
443 assert repr(opts) == f"<pyarrow.csv.WriteOptions>({expected_repr_inner})"
444 assert str(opts) == f"WriteOptions({expected_repr_inner})"
445
446
447class BaseTestCSV(abc.ABC):

Callers

nothing calls this directly

Calls 2

check_options_classFunction · 0.85
validateMethod · 0.45

Tested by

no test coverage detected