()
| 397 | |
| 398 | |
| 399 | def 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 | |
| 432 | class BaseTestCSV(abc.ABC): |
nothing calls this directly
no test coverage detected