Peano
Loading...
Searching...
No Matches
test_task_groups.py
Go to the documentation of this file.
1
from
peano4.api.solversteps
import
SynchroniseActionSets, get_task_groups
2
3
4
class
_FakeActionSet
:
5
def
__init__
(self, name, parallel):
6
self.
name
= name
7
self.
parallel
= parallel
8
9
10
def
_names
(groups):
11
return
[[action_set.name
for
action_set
in
group]
for
group
in
groups]
12
13
14
def
test_runs_of_parallel_action_sets_form_groups
():
15
v = [
_FakeActionSet
(f
"v{i}"
, parallel)
for
i, parallel
in
enumerate([
True
,
True
,
False
,
True
,
True
], start=1)]
16
assert
_names
(get_task_groups(v)) == [[
"v1"
,
"v2"
], [
"v3"
], [
"v4"
,
"v5"
]]
17
18
19
def
test_sequential_action_sets_form_groups_of_their_own
():
20
v = [
_FakeActionSet
(f
"v{i}"
,
False
)
for
i
in
range(1, 4)]
21
assert
_names
(get_task_groups(v)) == [[
"v1"
], [
"v2"
], [
"v3"
]]
22
23
24
def
test_marker_separates_groups_and_is_not_part_of_any_group
():
25
v1, v2, v3, v4 = (
_FakeActionSet
(f
"v{i}"
,
True
)
for
i
in
range(1, 5))
26
assert
_names
(get_task_groups([v1, v2, SynchroniseActionSets(), v3, v4])) == [[
"v1"
,
"v2"
], [
"v3"
,
"v4"
]]
27
28
29
def
test_parallel_action_set_after_sequential_one_starts_a_new_group
():
30
v1, v2, v3 =
_FakeActionSet
(
"v1"
,
False
),
_FakeActionSet
(
"v2"
,
True
),
_FakeActionSet
(
"v3"
,
True
)
31
assert
_names
(get_task_groups([v1, v2, v3])) == [[
"v1"
], [
"v2"
,
"v3"
]]
test_task_groups._FakeActionSet
Definition
test_task_groups.py:4
test_task_groups._FakeActionSet.__init__
__init__(self, name, parallel)
Definition
test_task_groups.py:5
test_task_groups._FakeActionSet.parallel
parallel
Definition
test_task_groups.py:7
test_task_groups._FakeActionSet.name
name
Definition
test_task_groups.py:6
peano4.api.solversteps
The Python-side model of "what happens during one mesh sweep".
Definition
__init__.py:1
test_task_groups.test_runs_of_parallel_action_sets_form_groups
test_runs_of_parallel_action_sets_form_groups()
Definition
test_task_groups.py:14
test_task_groups.test_sequential_action_sets_form_groups_of_their_own
test_sequential_action_sets_form_groups_of_their_own()
Definition
test_task_groups.py:19
test_task_groups.test_parallel_action_set_after_sequential_one_starts_a_new_group
test_parallel_action_set_after_sequential_one_starts_a_new_group()
Definition
test_task_groups.py:29
test_task_groups._names
_names(groups)
Definition
test_task_groups.py:10
test_task_groups.test_marker_separates_groups_and_is_not_part_of_any_group
test_marker_separates_groups_and_is_not_part_of_any_group()
Definition
test_task_groups.py:24
tests
unit
test_task_groups.py
Generated on
for Peano by
1.15.0