()
| 618 | |
| 619 | |
| 620 | def test_if(): |
| 621 | @R.function |
| 622 | def f(cond: R.Tensor((), dtype="bool")) -> R.Tensor((), dtype="int32"): |
| 623 | if cond: |
| 624 | x = R.const(1) |
| 625 | else: |
| 626 | x = R.const(2) |
| 627 | return x |
| 628 | |
| 629 | body = normalize(f).body |
| 630 | assert isinstance(body, rx.SeqExpr) |
| 631 | body_str = strip_whitespace(dump_ast(body)) |
| 632 | # we expect both branches to be seq exprs |
| 633 | assert "If" in body_str |
| 634 | assert "true_branch=SeqExpr(" in body_str |
| 635 | assert "false_branch=SeqExpr(" in body_str |
| 636 | |
| 637 | |
| 638 | def test_tuple_get_item(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…