Skip to content

Commit

Permalink
please linter
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSt98 committed Oct 7, 2024
1 parent 6797713 commit 13b73b5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions loki/transformations/tests/test_transform_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from loki import Subroutine
from loki.build import jit_compile, clean_test
from loki.expression import symbols as sym, FindVariables
from loki.frontend import available_frontends, OMNI
from loki.frontend import available_frontends
from loki.ir import (
is_loki_pragma, pragmas_attached, FindNodes, Loop, Conditional,
Assignment
Expand Down Expand Up @@ -1684,7 +1684,7 @@ def test_transform_loop_unroll(tmp_path, frontend):
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == sum([x + 1 for x in range(1, 11)])
assert s == sum(x + 1 for x in range(1, 11))

# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 1
Expand All @@ -1697,7 +1697,7 @@ def test_transform_loop_unroll(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([x + 1 for x in range(1, 11)])
assert s == sum(x + 1 for x in range(1, 11))

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -1726,7 +1726,7 @@ def test_transform_loop_unroll_step(tmp_path, frontend):
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == sum([x + 1 for x in range(1, 11, 2)])
assert s == sum(x + 1 for x in range(1, 11, 2))

# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 1
Expand All @@ -1739,7 +1739,7 @@ def test_transform_loop_unroll_step(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([x + 1 for x in range(1, 11, 2)])
assert s == sum(x + 1 for x in range(1, 11, 2))

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -1770,7 +1770,7 @@ def test_transform_loop_unroll_non_literal_range(tmp_path, frontend):
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == sum([x + 1 for x in range(1, 11)])
assert s == sum(x + 1 for x in range(1, 11))

# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 1
Expand All @@ -1783,7 +1783,7 @@ def test_transform_loop_unroll_non_literal_range(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([x + 1 for x in range(1, 11)])
assert s == sum(x + 1 for x in range(1, 11))

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -1815,7 +1815,7 @@ def test_transform_loop_unroll_nested(tmp_path, frontend):
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 2
Expand All @@ -1828,7 +1828,7 @@ def test_transform_loop_unroll_nested(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -1860,7 +1860,7 @@ def test_transform_loop_unroll_nested_restricted_depth(tmp_path, frontend):
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 2
Expand All @@ -1873,7 +1873,7 @@ def test_transform_loop_unroll_nested_restricted_depth(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -1907,7 +1907,7 @@ def test_transform_loop_unroll_nested_restricted_depth_unrollable(tmp_path, fron
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 2
Expand All @@ -1920,7 +1920,7 @@ def test_transform_loop_unroll_nested_restricted_depth_unrollable(tmp_path, fron
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -1968,7 +1968,7 @@ def test_transform_loop_unroll_nested_counters(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 11)) if b <= a])
assert s == sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 11)) if b <= a)

clean_test(filepath)
clean_test(unrolled_filepath)
Expand Down Expand Up @@ -2006,7 +2006,7 @@ def test_transform_loop_unroll_nested_neighbours(tmp_path, frontend):
# Test the reference solution
s = np.zeros(1)
function(s=s)
assert s == 2 * sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == 2 * sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))
# Apply transformation
assert len(FindNodes(Loop).visit(routine.body)) == 3
loop_unroll(routine)
Expand All @@ -2018,7 +2018,7 @@ def test_transform_loop_unroll_nested_neighbours(tmp_path, frontend):
# Test transformation
s = np.zeros(1)
unrolled_function(s=s)
assert s == 2 * sum([a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6))])
assert s == 2 * sum(a + b + 1 for (a, b) in itertools.product(range(1, 11), range(1, 6)))

clean_test(filepath)
clean_test(unrolled_filepath)

0 comments on commit 13b73b5

Please sign in to comment.