@@ -1492,8 +1492,29 @@ def test_stepping_dim_in_condition_lowering(self):
14921492 op .apply (time_M = threshold + 3 )
14931493 assert np .all (g .data [0 , :, :] == threshold )
14941494 assert np .all (g .data [1 , :, :] == threshold + 1 )
1495- assert 'if (g[t0][x + 1][y + 1] <= 10)\n ' + \
1496- '{\n g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1' in str (op .ccode )
1495+
1496+ # We want to assert that the following snippet:
1497+ # ```
1498+ # if (g[t0][x + 1][y + 1] <= 10)
1499+ # {
1500+ # g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1
1501+ # ```
1502+ # is in the generated code, but indentation etc. seems to vary.
1503+ part1 = 'if (g[t0][x + 1][y + 1] <= 10)\n '
1504+ part2 = 'g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1'
1505+ whole_code = str (op .ccode )
1506+
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
14971518
14981519 def test_expr_like_lowering (self ):
14991520 """
0 commit comments