Renommage Fuel Advisor (titre, header, favicon SVG/PNG, apple-touch-icon, logo SVG servis localement). Oracle: contrainte de penalty corrigee (portee inversee), quantites non entieres ecartees avant rejeu, double comptage de penalite supprime. Audit economique regenerer: plafonds omniscients coherents et positifs; deux lignes non resolues conservees telles quelles.
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
from datetime import date, timedelta
|
|
|
|
from signal_audit import audit_rows
|
|
|
|
|
|
def test_q90_uses_only_strictly_previous_scores():
|
|
rows = []
|
|
for i in range(80):
|
|
rows.append(
|
|
dict(
|
|
t=(date(2020, 1, 1) + timedelta(days=i)).isoformat(),
|
|
score={"up_3": float(i)},
|
|
target=dict(
|
|
available_at=(date(2020, 1, 1) + timedelta(days=i + 15)).isoformat(),
|
|
future_max_delta=i,
|
|
events={"up_3": {"hit": i >= 3}},
|
|
),
|
|
)
|
|
)
|
|
result = audit_rows(rows, minimum=2)
|
|
assert all(p["threshold_source_max"] < p["t"] for p in result)
|
|
assert all(p["threshold"] < p["score"] for p in result)
|
|
|
|
|
|
def test_immature_future_amplitudes_do_not_affect_past_decisions():
|
|
rows = []
|
|
for i in range(80):
|
|
rows.append(
|
|
dict(
|
|
t=(date(2020, 1, 1) + timedelta(days=i)).isoformat(),
|
|
score={"up_3": 0.2},
|
|
target=dict(
|
|
available_at=(date(2020, 1, 1) + timedelta(days=i + 15)).isoformat(),
|
|
future_max_delta=i,
|
|
events={"up_3": {"hit": i >= 3}},
|
|
),
|
|
)
|
|
)
|
|
before = [p for p in audit_rows(rows, minimum=2) if p["t"] <= "2020-02-15"]
|
|
for r in rows:
|
|
if r["target"]["available_at"] >= "2020-02-15":
|
|
r["target"]["future_max_delta"] = 999999
|
|
after = [p for p in audit_rows(rows, minimum=2) if p["t"] <= "2020-02-15"]
|
|
assert before == after
|
|
assert all(p["amplitude_source_max"] is None or p["amplitude_source_max"] < p["t"] for p in after)
|