(tmp_path: pathlib.Path)
| 947 | |
| 948 | |
| 949 | def test_json_optional_values(tmp_path: pathlib.Path): |
| 950 | data = """ |
| 951 | {"k": "a", "v": 1} |
| 952 | {"k": "b", "v": 2, "w": 512} |
| 953 | """ |
| 954 | input_path = tmp_path / "input.csv" |
| 955 | write_lines(input_path, data) |
| 956 | |
| 957 | class InputSchema(pw.Schema): |
| 958 | k: str = pw.column_definition(primary_key=True) |
| 959 | v: int = pw.column_definition(default_value=0) |
| 960 | w: int = pw.column_definition(default_value=1024) |
| 961 | |
| 962 | table = pw.io.jsonlines.read( |
| 963 | str(input_path), |
| 964 | schema=InputSchema, |
| 965 | mode="static", |
| 966 | ) |
| 967 | |
| 968 | assert_table_equality( |
| 969 | table, |
| 970 | T( |
| 971 | """ |
| 972 | k | v | w |
| 973 | a | 1 | 1024 |
| 974 | b | 2 | 512 |
| 975 | """ |
| 976 | ).with_id_from(pw.this.k), |
| 977 | ) |
| 978 | |
| 979 | |
| 980 | def test_json_optional_values_with_paths(tmp_path: pathlib.Path): |
nothing calls this directly
no test coverage detected