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

Function test_write_options

python/pyarrow/tests/test_csv.py:414–445  ·  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 eol=['\n', '\r\n'], null_string=['', 'NA'],
421 quoting_style=['needed', 'none', 'all_valid'])
422
423 assert opts.batch_size > 0
424 opts.batch_size = 12345
425 assert opts.batch_size == 12345
426
427 opts = cls(batch_size=9876)
428 assert opts.batch_size == 9876
429
430 opts.validate()
431
432 match = "WriteOptions: batch_size must be at least 1: 0"
433 with pytest.raises(pa.ArrowInvalid, match=match):
434 opts = cls()
435 opts.batch_size = 0
436 opts.validate()
437
438 expected_repr_inner = """
439 include_header=True,
440 batch_size=0,
441 delimiter=',',
442 quoting_style='needed'"""
443
444 assert repr(opts) == f"<pyarrow.csv.WriteOptions>({expected_repr_inner})"
445 assert str(opts) == f"WriteOptions({expected_repr_inner})"
446
447
448class BaseTestCSV(abc.ABC):

Callers

nothing calls this directly

Calls 2

check_options_classFunction · 0.85
validateMethod · 0.45

Tested by

no test coverage detected