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

Function test_restrict

python/pathway/tests/test_errors.py:545–587  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

543
544
545def test_restrict():
546 t1 = pw.debug.table_from_markdown(
547 """
548 | a | b
549 1 | 6 | 2
550 2 | 5 | 5
551 3 | 4 | 1
552 4 | 3 | 3
553 """
554 )
555 t2 = pw.debug.table_from_markdown(
556 """
557 | c
558 1 | 1
559 2 | 2
560 3 | 3
561 5 | 4
562 """
563 )
564 pw.universes.promise_is_subset_of(t2, t1)
565 res = t1.restrict(t2)
566 res = res.select(a=pw.fill_error(res.a, -1), b=pw.fill_error(res.b, -1), c=t2.c)
567 expected = pw.debug.table_from_markdown(
568 """
569 | a | b | c
570 1 | 6 | 2 | 1
571 2 | 5 | 5 | 2
572 3 | 4 | 1 | 3
573 5 | -1 | -1 | 4
574 """
575 )
576 expected_errors = T(
577 """
578 message | line
579 key missing in output table: ^3S2X6B265PV8BRY8MZJ91KQ0Z4 | res = t1.restrict(t2)
580 """,
581 split_on_whitespace=False,
582 )
583 assert_table_equality_wo_index(
584 (res, global_errors()),
585 (expected, expected_errors),
586 terminate_on_error=False,
587 )
588
589
590def test_with_universe_of():

Callers

nothing calls this directly

Calls 5

TFunction · 0.90
global_errorsFunction · 0.85
table_from_markdownMethod · 0.80
restrictMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected