MCPcopy Index your code
hub / github.com/pathwaycom/pathway / test_json_default_values

Function test_json_default_values

python/pathway/tests/test_io.py:579–609  ·  view source on GitHub ↗
(tmp_path: pathlib.Path)

Source from the content-addressed store, hash-verified

577
578
579def 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
612def test_subscribe():

Callers

nothing calls this directly

Calls 3

write_linesFunction · 0.90
TFunction · 0.90
with_id_fromMethod · 0.80

Tested by

no test coverage detected