From b0ec142b55b922cc23e21108e2b7b29368461b5a Mon Sep 17 00:00:00 2001 From: Hilary James Oliver Date: Mon, 16 Dec 2024 04:27:11 +0000 Subject: [PATCH] Add graph parser unit tests. Co-authored-by: Tim Pillinger --- tests/unit/test_graph_parser.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/unit/test_graph_parser.py b/tests/unit/test_graph_parser.py index 354209c109..ed45e51415 100644 --- a/tests/unit/test_graph_parser.py +++ b/tests/unit/test_graph_parser.py @@ -139,6 +139,36 @@ def test_graph_syntax_errors_2(seq, graph, expected_err): 'Invalid cycle point offsets only on right', id='no-cycle-point-RHS' ), + # See https://github.com/cylc/cylc-flow/issues/6523 + # For the next 4 tests: + param( + # Yes I know it's circular, but it's here to + # demonstrate that the test below is broken: + "foo:finished => foo", + 'Output foo:succeeded can\'t be both required and' + ' optional', + id='finish-implies-success-optional' + ), + param( + "foo[-P1]:finish => foo", + 'Output foo:succeeded can\'t be both required and' + ' optional', + id='finish-implies-success-optional-offset' + ), + param( + "foo[-P1]:succeeded | foo[-P1]:failed => bar", + ( + 'Opposite outputs foo:succeeded and foo:failed' + ' must both be optional if both are used' + ), + id='succeed-or-failed-mustbe-optional' + ), + param( + "foo[-P1]:succeeded? | foo[-P1]:failed? => foo", + 'Output foo:succeeded can\'t be both required and' + ' optional', + id='succeed-or-failed-implies-success-optional' + ), ] ) def test_graph_syntax_errors(graph, expected_err):