Skip to content

Commit fa61bda

Browse files
committed
add loop examples
1 parent bf5af91 commit fa61bda

File tree

7 files changed

+91
-10
lines changed

7 files changed

+91
-10
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"list": [
3+
{
4+
"id": "test_loop",
5+
"module": "loop",
6+
"inputs": [
7+
{
8+
"param": "iteration",
9+
"value": [
10+
{"number":1,"type":"raster"},
11+
{"number":2,"type":"raster"},
12+
{"number":3,"type":"raster"},
13+
{"number":4,"type":"raster"}
14+
]
15+
}
16+
]
17+
}
18+
],
19+
"version": "1"
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"list": [
3+
{
4+
"id": "test_simple_loop",
5+
"module": "loop_simple",
6+
"inputs": [
7+
{
8+
"param": "iteration",
9+
"value": [1,2,3,4]
10+
}
11+
]
12+
}
13+
],
14+
"version": "1"
15+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"id": "loop",
3+
"description": "Example loop with multiple parameters",
4+
"template": {
5+
"list": [
6+
{% for i in iteration %}
7+
{
8+
"id": "r_mapcalc",
9+
"module": "r.mapcalc",
10+
"inputs": [
11+
{
12+
"param": "expression",
13+
"value": "baum={{ i.number }}"
14+
}
15+
]
16+
},
17+
{
18+
"id": "g.list",
19+
"module": "g.list",
20+
"inputs": [
21+
{
22+
"param": "type",
23+
"value": "{{ i.type }}"
24+
}
25+
]
26+
}{{ "," if not loop.last }}
27+
{% endfor %}
28+
],
29+
"version": "1"
30+
}
31+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"id": "loop_simple",
3+
"description": "Simple loop",
4+
"template": {
5+
"list": [
6+
{% for i in iteration %}
7+
{
8+
"id": "r_mapcalc",
9+
"module": "r.mapcalc",
10+
"inputs": [
11+
{
12+
"param": "expression",
13+
"value": "baum={{ i }}"
14+
}
15+
]
16+
}{{ "," if not loop.last }}
17+
{% endfor %}
18+
],
19+
"version": "1"
20+
}
21+
}

tests/test_modules.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"slope_aspect",
2929
"vector_area",
3030
"index_NDVI",
31+
"loop_simple",
32+
"loop",
3133
]
3234
someVirtualModules = GrassModules + someActiniaModules
3335

tests/test_modules_actinia_global.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"slope_aspect",
2929
"vector_area",
3030
"index_NDVI",
31+
"loop_simple",
32+
"loop",
3133
]
3234

3335

tests/test_modules_actinia_user.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@
2323
delete_user_template,
2424
)
2525

26-
someActiniaModules = [
27-
"add_enumeration",
28-
"default_value",
29-
"nested_modules_test",
30-
"point_in_polygon",
31-
"slope_aspect",
32-
"vector_area",
33-
"index_NDVI",
34-
]
35-
3626

3727
class ActiniaModulesTest(ActiniaTestCase):
3828
def test_read_user_module_get(self):

0 commit comments

Comments
 (0)