Skip to content

Commit 40b9202

Browse files
committed
initial
1 parent 7ecd008 commit 40b9202

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

tests/test_cli.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Smoke tests for se_regimes_explorer.cli."""
2+
3+
from pathlib import Path
4+
5+
from se_regimes_explorer.cli import explorer_data_to_dict, main
6+
7+
8+
def test_explorer_data_to_dict() -> None:
9+
"""Explorer data includes expected regime and transformation counts."""
10+
data = explorer_data_to_dict()
11+
12+
assert len(data["regimes"]) == 9
13+
assert len(data["transformations"]) == 3
14+
assert "OBL" in data["regimes"]
15+
assert "nor_reorg" in data["transformations"]
16+
17+
18+
def test_cli_prints_summary(capsys) -> None:
19+
"""CLI prints a basic summary."""
20+
main()
21+
22+
captured = capsys.readouterr()
23+
24+
assert "SE Regimes Explorer" in captured.out
25+
assert "Regimes: 9" in captured.out
26+
assert "Transformations: 3" in captured.out
27+
28+
29+
def test_cli_writes_output_json(tmp_path: Path, monkeypatch, capsys) -> None:
30+
"""CLI writes JSON output when requested."""
31+
output_path = tmp_path / "regimes.json"
32+
33+
monkeypatch.setattr(
34+
"sys.argv",
35+
["se-regimes-explorer", "--output-json", str(output_path)],
36+
)
37+
38+
main()
39+
40+
captured = capsys.readouterr()
41+
42+
assert output_path.exists()
43+
assert "Output file:" in captured.out
44+
assert '"OBL"' in output_path.read_text(encoding="utf-8")

0 commit comments

Comments
 (0)