spb/traite-evaluation-qc
Public
1import pytest, numpy as np2from traite import cas2, cas434def test_cas2():5 r = cas2.tout(); b = r["base"]6 assert b["rbe"] == pytest.approx(b["rbp_contrat"] * (1 - 0.03)) and b["rne"] == pytest.approx(b["rbe"] - b["depenses_totales"])7 assert r["indicateurs"]["n"] >= 30 and 0.02 < r["indicateurs"]["taux_median"] < 0.078 assert 300_000 < r["valeur_capitalisation"] < 1_500_000 and 300_000 < r["valeur_mrb"] < 1_500_000910def test_cas4():11 r = cas4.tout(); s = r["sommaire"]12 assert s["total"]["n"] == 48 and abs(s["par_rmr"]["valeur"].sum() - s["total"]["valeur"]) < 113 assert 0 < s["total"]["rpv"] < 114 assert len(r["croissance"]) == 48 and r["croissance"]["croissance_annuelle"].between(-0.05, 0.12).all()15 e = r["effets"]; assert e.loc["inondable", "coef"] > 0 and e.loc["rmr_Saguenay", "coef"] > e.loc["rmr_Québec", "coef"] > 016