(tmp_path: pathlib.Path)
| 464 | |
| 465 | |
| 466 | def test_csv_default_values(tmp_path: pathlib.Path): |
| 467 | data = """ |
| 468 | k | v |
| 469 | a | 42 |
| 470 | b | 43 |
| 471 | c | |
| 472 | """ |
| 473 | input_path = tmp_path / "input.csv" |
| 474 | write_csv(input_path, data) |
| 475 | |
| 476 | class InputSchema(pw.Schema): |
| 477 | k: str = pw.column_definition(primary_key=True) |
| 478 | v: int = pw.column_definition(default_value=0) |
| 479 | |
| 480 | table = pw.io.csv.read( |
| 481 | str(input_path), |
| 482 | schema=InputSchema, |
| 483 | mode="static", |
| 484 | ) |
| 485 | |
| 486 | assert_table_equality( |
| 487 | table, |
| 488 | T( |
| 489 | """ |
| 490 | k | v |
| 491 | a | 42 |
| 492 | b | 43 |
| 493 | c | 0 |
| 494 | """ |
| 495 | ).with_id_from(pw.this.k), |
| 496 | ) |
| 497 | |
| 498 | |
| 499 | def test_csv_skip_column(tmp_path: pathlib.Path): |
nothing calls this directly
no test coverage detected