From f6a2d986a723aa3e29a2bd1a087cd453ad522765 Mon Sep 17 00:00:00 2001 From: James Frost Date: Tue, 19 Dec 2023 13:22:26 +0000 Subject: [PATCH] Test additional graph cases --- tests/test_graph.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/test_graph.py b/tests/test_graph.py index 06dc86fc8..8c320ed80 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -18,18 +18,25 @@ import pytest -import CSET.graph +from CSET import graph def test_save_graph(): """Generate a graph from a recipe file without the output specified.""" - CSET.graph.save_graph(Path("tests/test_data/plot_instant_air_temp.yaml")) + graph.save_graph(Path("tests/test_data/plot_instant_air_temp.yaml")) - # Test exception for recipe without an operator in a step. + +def test_save_graph_detailed(tmp_path: Path): + """Generate a graph from a recipe file with the output specified.""" + graph.save_graph( + Path("tests/test_data/plot_instant_air_temp.yaml"), + tmp_path / "graph.svg", + detailed=True, + ) + + +def test_save_graph_no_operators_exception(): + """Exception raised from recipe with no operators.""" with pytest.raises(ValueError): - CSET.graph.save_graph( - """\ - steps: - - argument: no_operators - """ - ) + # Inline YAML form used. + graph.save_graph('{"steps": [{"argument": "no_operators"}]}')