()
| 46 | |
| 47 | |
| 48 | def _test_outer(): |
| 49 | x = ops.Const(10) |
| 50 | # test stop_if(False) |
| 51 | with ops.stop_guard() as g1: |
| 52 | _test_inner_stop(x) |
| 53 | |
| 54 | # test stop_if(True) |
| 55 | y = ops.Const(3) |
| 56 | with ops.stop_guard() as g2: |
| 57 | _test_inner_stop(y) |
| 58 | |
| 59 | # test no stop |
| 60 | with ops.stop_guard() as g4: |
| 61 | ops.Const(0) |
| 62 | |
| 63 | # test empty clause |
| 64 | with ops.stop_guard() as g3: |
| 65 | pass |
| 66 | |
| 67 | return ( |
| 68 | g1.has_stopped(), g2.has_stopped(), g3.has_stopped(), g4.has_stopped()) |
| 69 | |
| 70 | |
| 71 | def _test_if(x): |
no test coverage detected
searching dependent graphs…