()
| 543 | |
| 544 | |
| 545 | def 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 | |
| 590 | def test_with_universe_of(): |
nothing calls this directly
no test coverage detected