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

Function test_left_join_preserving_id

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

Source from the content-addressed store, hash-verified

498
499
500def test_left_join_preserving_id():
501 t1 = pw.debug.table_from_markdown(
502 """
503 a
504 1
505 2
506 3
507 """
508 )
509 t2 = pw.debug.table_from_markdown(
510 """
511 b
512 1
513 1
514 1
515 2
516 """
517 )
518 res = (
519 t1.join_left(t2, pw.left.a == pw.right.b, id=pw.left.id)
520 .select(pw.left.a, pw.right.b)
521 .with_columns(b=pw.fill_error(pw.this.b, -1))
522 )
523 expected = pw.debug.table_from_markdown(
524 """
525 a | b
526 1 | -1
527 2 | 2
528 3 |
529 """
530 )
531 expected_errors = T(
532 """
533 message | line
534 duplicate key: ^X1MXHYYG4YM0DB900V28XN5T4W | t1.join_left(t2, pw.left.a == pw.right.b, id=pw.left.id)
535 """,
536 split_on_whitespace=False,
537 )
538 assert_table_equality_wo_index(
539 (res, global_errors()),
540 (expected, expected_errors),
541 terminate_on_error=False,
542 )
543
544
545def test_restrict():

Callers

nothing calls this directly

Calls 6

TFunction · 0.90
global_errorsFunction · 0.85
table_from_markdownMethod · 0.80
with_columnsMethod · 0.80
join_leftMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected