Skip to content

Commit

Permalink
Test additional graph cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrost-mo committed Dec 19, 2023
1 parent b1f519f commit f6a2d98
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}]}')

0 comments on commit f6a2d98

Please sign in to comment.