Skip to content

Commit 1557959

Browse files
committed
The final noodle part 2
1 parent 62af630 commit 1557959

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

tests/test_dimension.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,15 +1502,19 @@ def test_stepping_dim_in_condition_lowering(self):
15021502
# is in the generated code, but indentation etc. seems to vary.
15031503
part1 = 'if (g[t0][x + 1][y + 1] <= 10)\n'
15041504
part2 = 'g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1'
1505-
part2_alt = 'gL0(t1, x + 1, y + 1) = gL0(t0, x + 1, y + 1) + 1'
15061505
whole_code = str(op.ccode)
15071506

1508-
loc = whole_code.find(part1)
1509-
assert loc != -1
1510-
loc = whole_code.find(part2, loc + len(part1))
1511-
# Try the alternative string
1512-
if loc == -1:
1513-
assert whole_code.find(part2_alt, loc + len(part1)) != -1
1507+
try:
1508+
loc = whole_code.find(part1)
1509+
assert loc != -1
1510+
assert whole_code.find(part2, loc + len(part1)) != -1
1511+
except AssertionError:
1512+
# Try the alternative string
1513+
part1 = 'if (gL0(t0, x + 1, y + 1) <= 10)\n'
1514+
part2 = 'gL0(t1, x + 1, y + 1) = gL0(t0, x + 1, y + 1) + 1'
1515+
loc = whole_code.find(part1)
1516+
assert loc != -1
1517+
assert whole_code.find(part2, loc + len(part1)) != -1
15141518

15151519
def test_expr_like_lowering(self):
15161520
"""

0 commit comments

Comments
 (0)