Skip to content

Commit 152ddb5

Browse files
committed
fix some more test cases for terminal finder
1 parent c496207 commit 152ddb5

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

cylc/flow/graph_parser.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,14 +489,19 @@ def get_graph_terminals(pairs):
489489
{'bar'}
490490
"""
491491
lefts = []
492-
for left, _ in pairs:
492+
rights = []
493+
for left, right in pairs:
493494
if left and ('&' in left or '|' in left):
494495
# RE used because don't want to have to worry about
495496
# mutiple and/or and cleaning whitespace.
496497
lefts += GraphParser._RE_ANDOR.split(left)
497498
else:
498499
lefts.append(left)
499-
return {p[1] for p in pairs}.difference(set(lefts))
500+
if right and ('&' in right or '|' in right):
501+
rights += GraphParser._RE_ANDOR.split(right)
502+
else:
503+
rights.append(right)
504+
return set(rights).difference(set(lefts))
500505

501506
@classmethod
502507
def _report_invalid_lines(cls, lines: List[str]) -> None:

tests/unit/test_graph_parser.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,20 @@ def test_proc_dep_pair(args, err):
10181018
{'foo'},
10191019
id='&-and-|'
10201020
),
1021+
param(
1022+
{
1023+
(None, 'stop1'),
1024+
('stop1', 't3:start&t4:start'),
1025+
('t3:start&t4:start', 'stop2?')
1026+
},
1027+
{'stop2?'},
1028+
id='diamond-graph'
1029+
),
1030+
param(
1031+
{(None, 'stop1'), ('stop1', 't3:start&t4')},
1032+
{'t3:start', 't4'},
1033+
id='y-shape-graph'
1034+
),
10211035
)
10221036
)
10231037
def test_get_graph_terminals(pairs, terminals):

0 commit comments

Comments
 (0)