()
| 412 | |
| 413 | |
| 414 | def 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 | |
| 447 | class BaseTestCSV(abc.ABC): |
nothing calls this directly
no test coverage detected