()
| 131 | |
| 132 | |
| 133 | def test_nesting_error(): |
| 134 | @pipeline_def(enable_conditionals=True, num_threads=4, batch_size=8, device_id=0) |
| 135 | def pipeline(): |
| 136 | pred = fn.external_source(source=lambda x: np.array(x.idx_in_batch % 2), batch=False) |
| 137 | if pred: |
| 138 | out = {"out": np.array(2), "mismatched": np.array(9999)} |
| 139 | else: |
| 140 | out = {"out": np.array(1)} |
| 141 | return out |
| 142 | |
| 143 | with assert_raises( |
| 144 | ValueError, |
| 145 | glob=( |
| 146 | "*Divergent data found in different branches of `if/else` control" |
| 147 | " flow statement. Variables in all code paths are merged into common" |
| 148 | " output batches. The values assigned to a given variable need to" |
| 149 | " have the same nesting structure in every code path (both `if` branches).*" |
| 150 | "'If' output structure:*" |
| 151 | "'Else' output structure:*" |
| 152 | ), |
| 153 | ): |
| 154 | _ = pipeline() |
nothing calls this directly
no test coverage detected