Skip to content

Commit

Permalink
mg gsc
Browse files Browse the repository at this point in the history
  • Loading branch information
kmantel committed Oct 14, 2023
1 parent b5816f3 commit a8baa3d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/graph_scheduler/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2900,9 +2900,9 @@ class AfterNodes(GSCReposition, GSCWithActions):
def __init__(
self,
*nodes,
owner_senders: typing.Union[Action, str] = Action.KEEP,
owner_senders: typing.Union[Action, str] = Action.REPLACE,
owner_receivers: typing.Union[Action, str] = Action.MERGE,
subject_senders: typing.Union[Action, str, dict] = Action.MERGE,
subject_senders: typing.Union[Action, str, dict] = Action.REPLACE,
subject_receivers: typing.Union[Action, str, dict] = Action.KEEP,
reconnect_non_subject_receivers: bool = True,
):
Expand Down
42 changes: 41 additions & 1 deletion tests/scheduling/test_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'four_node_linear': pytest.helpers.create_graph_from_pathways(['A', 'B', 'C', 'D']),
'four_node_diamond': {'A': set(), 'B': {'A'}, 'C': {'A'}, 'D': {'B', 'C'}},
'five_node_hub': {'A': set(), 'B': set(), 'C': {'A', 'B'}, 'D': {'C'}, 'E': {'C'}},
'five_node_split': pytest.helpers.create_graph_from_pathways(['A', 'B', 'C'], ['A', 'D', 'F']),
'six_node_multilinear': pytest.helpers.create_graph_from_pathways(['A', 'B', 'C'], ['D', 'E'], ['F']),
'nine_node_multi': {
'A': set(),
Expand Down Expand Up @@ -2203,7 +2204,46 @@ def test_BeforeNode(self, graph_name, owner, nodes, warning_pat, expected_graph)
@pytest.mark.parametrize(
'graph_name, owner, nodes, warning_pat, expected_graph',
[
# (),
(
'five_node_hub', 'A', ['C'], None,
{'A': set(), 'B': set(), 'C': {'A', 'B', 'D'}, 'D': {'A', 'B'}, 'E': {'C'}},
),
(
'five_node_hub', 'A', ['D'], None,
{'A': {'D'}, 'B': set(), 'C': {'A', 'B'}, 'D': {'C'}, 'E': {'C'}}
),
(
'five_node_hub', 'D', ['E'], r'.*C is already before D.*Condition is ignored.',
{'A': set(), 'B': set(), 'C': {'A', 'B'}, 'D': {'C'}, 'E': {'C'}},
),
(
'nine_node_multi', 'C', ['E'], None,
{
'A': set(),
'B': set(),
'C': {'A', 'B', 'E'},
'D': {'A', 'C'},
'E': {'A', 'B', 'H'},
'F': {'C', 'D', 'E'},
'G': {'E'},
'H': {'G'},
'I': {'H'}
},
),
(
'nine_node_multi', 'E', ['B'], None,
{
'A': set(),
'B': set(),
'C': {'A', 'B'},
'D': {'A', 'C'},
'E': {'C', 'H'},
'F': {'D', 'E'},
'G': {'C'},
'H': {'G'},
'I': {'H'}
},
),
]
)
def test_WithNode(self, graph_name, owner, nodes, warning_pat, expected_graph):
Expand Down

0 comments on commit a8baa3d

Please sign in to comment.