Output organizzato per analisi: cartella input/, output/<csv>/ con domini, sovrapposizione e report
- dati/ rinominata input/ (CSV ignorati, cartella tracciata con .gitkeep)
- lavoro/ sostituita da output/<nome csv>/{01_domini,02_sovrapposizione,03_report}
- report.md con indice, tabella equazioni e immagini incorporate
- sovrapposizione complessiva dati-equazioni per serie
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d92bcd198b
commit
da0964be4d
11 files changed
+186
-106
No files matched your search
+2
-2
@@ -36,8 +36,8 @@ def sintetico():
|
||||
|
||||
@pytest.fixture(params=SEEDS)
|
||||
def csv_gen(request):
|
||||
"""CSV prodotto da gen_data per il seed; il test è saltato se il file non c'è (dati/ non è in git)."""
|
||||
percorso = RADICE / f"dati/gen_{request.param}.csv"
|
||||
"""CSV prodotto da gen_data per il seed; il test è saltato se il file non c'è (input/*.csv non è in git)."""
|
||||
percorso = RADICE / f"input/gen_{request.param}.csv"
|
||||
if not percorso.exists():
|
||||
pytest.skip(f"{percorso} assente: rigenera con gen_data (vedi README)")
|
||||
return percorso
|
||||
+13
-10
@@ -1,4 +1,4 @@
|
||||
"""Integrazione sui CSV di gen_data (dati/gen_{1,2,3}.csv, ignorati da git: i test sono saltati se mancano) e sulla CLI."""
|
||||
"""Integrazione sui CSV di gen_data (input/gen_{1,2,3}.csv, ignorati da git: i test sono saltati se mancano) e sulla CLI."""
|
||||
|
||||
import pytest
|
||||
from conftest import RADICE
|
||||
@@ -36,22 +36,25 @@ def test_riscaldamento_eredita_costanti(csv_gen, cfg):
|
||||
|
||||
|
||||
def test_cli_domini_e_analizza(tmp_path, capsys):
|
||||
csv = RADICE / "dati/gen_1.csv"
|
||||
csv = RADICE / "input/gen_1.csv"
|
||||
if not csv.exists():
|
||||
pytest.skip(f"{csv} assente")
|
||||
lavoro = tmp_path / "lavoro"
|
||||
base = ["--config", str(RADICE / "config.toml"), "--lavoro", str(lavoro)]
|
||||
base = ["--config", str(RADICE / "config.toml"), "--output", str(tmp_path)]
|
||||
out = tmp_path / "gen_1"
|
||||
cli.main([*base, "domini", str(csv)])
|
||||
assert (lavoro / "domini.toml").exists() and (lavoro / "proposta.png").exists()
|
||||
assert not (lavoro / "out").exists() # `domini` non fa nessun fit
|
||||
cli.main([*base, "analizza", str(csv), "--domini", str(lavoro / "domini.toml")]) # domini corretti a mano
|
||||
for f in ("out/report.md", "out/risultati.json", "out/dominio4_T_C.png"):
|
||||
assert (lavoro / f).exists(), f
|
||||
assert (out / "01_domini/domini.toml").exists() and (out / "01_domini/domini.png").exists()
|
||||
assert not (out / "03_report").exists() or not any((out / "03_report").iterdir()) # `domini` non fa nessun fit
|
||||
cli.main([*base, "analizza", str(csv), "--domini", str(out / "01_domini/domini.toml")]) # domini corretti a mano
|
||||
for f in ("02_sovrapposizione/sovrapposizione_T_C.png", "02_sovrapposizione/dominio4_T_C.png",
|
||||
"03_report/report.md", "03_report/risultati.json"):
|
||||
assert (out / f).exists(), f
|
||||
report = (out / "03_report/report.md").read_text()
|
||||
assert "../01_domini/domini.png" in report and "../02_sovrapposizione/dominio4_T_C.png" in report
|
||||
assert "dominio 4 raffreddamento" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_cli_errori(tmp_path):
|
||||
base = ["--config", str(RADICE / "config.toml"), "--lavoro", str(tmp_path)]
|
||||
base = ["--config", str(RADICE / "config.toml"), "--output", str(tmp_path)]
|
||||
with pytest.raises(SystemExit) as e:
|
||||
cli.main([*base, "domini", str(tmp_path / "non_esiste.csv")])
|
||||
assert e.value.code == 4
|
||||
|
||||
Reference in new issue
Block a user