MCPcopy
hub / github.com/pathwaycom/pathway / test_csv_default_values

Function test_csv_default_values

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

Source from the content-addressed store, hash-verified

464
465
466def 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
499def test_csv_skip_column(tmp_path: pathlib.Path):

Callers

nothing calls this directly

Calls 3

write_csvFunction · 0.90
TFunction · 0.90
with_id_fromMethod · 0.80

Tested by

no test coverage detected