Spaces:
Running on T4
Running on T4
Download AI-coach-agent/tests/test_cli.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 962 Bytes
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/AI-coach-agent/tests/test_cli.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/AI-coach-agent/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/AI-coach-agent/tests/test_cli.py
962 Bytes
| import json | |
| from ai_coach.cli import main | |
| from .helpers import EXAMPLES | |
| def test_cli_fallback_only_prints_a_note(capsys, monkeypatch, tmp_path): | |
| monkeypatch.setenv("COACH_CACHE_PATH", str(tmp_path / "c.sqlite3")) | |
| monkeypatch.setenv("COACH_LOG_DIR", str(tmp_path / "logs")) | |
| code = main([str(EXAMPLES / "hitting_overstride_240fps.json"), "--fallback-only"]) | |
| out = capsys.readouterr() | |
| assert code == 0 and "What to work on" in out.out and "Mechanics score" in out.out and "source=rules" in out.err | |
| def test_cli_json_output_is_valid(capsys, monkeypatch, tmp_path): | |
| monkeypatch.setenv("COACH_CACHE_PATH", str(tmp_path / "c.sqlite3")) | |
| monkeypatch.setenv("COACH_LOG_DIR", str(tmp_path / "logs")) | |
| main([str(EXAMPLES / "pitching_short_stride_240fps.json"), "--fallback-only", "--json"]) | |
| data = json.loads(capsys.readouterr().out) | |
| assert data["meta"]["source"] == "rules" and data["focus"][0]["problem_key"] == "short_stride" | |