(tmp_path: pathlib.Path)
| 577 | |
| 578 | |
| 579 | def test_json_default_values(tmp_path: pathlib.Path): |
| 580 | data = """ |
| 581 | {"k": "a", "b": 1, "c": "foo" } |
| 582 | {"k": "b", "b": 2, "c": null } |
| 583 | {"k": "c" } |
| 584 | """ |
| 585 | input_path = tmp_path / "input.csv" |
| 586 | write_lines(input_path, data) |
| 587 | |
| 588 | class InputSchema(pw.Schema): |
| 589 | k: str = pw.column_definition(primary_key=True) |
| 590 | b: int = pw.column_definition(default_value=0) |
| 591 | c: str | None = pw.column_definition(default_value="default") |
| 592 | |
| 593 | table = pw.io.jsonlines.read( |
| 594 | str(input_path), |
| 595 | schema=InputSchema, |
| 596 | mode="static", |
| 597 | ) |
| 598 | |
| 599 | assert_table_equality( |
| 600 | table, |
| 601 | T( |
| 602 | """ |
| 603 | k | b | c |
| 604 | a | 1 | foo |
| 605 | b | 2 | |
| 606 | c | 0 | default |
| 607 | """ |
| 608 | ).with_id_from(pw.this.k), |
| 609 | ) |
| 610 | |
| 611 | |
| 612 | def test_subscribe(): |
nothing calls this directly
no test coverage detected