v0.5.109: hero role toolbar, skill side-by-side layout, taller detail panel.
Move role filters between grid and detail, fix skill video/text layout and detail height jump, unify item dividers, drop OpenDota matchup cross, sync docs and assets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Unit tests for STRATZ matchup ranking + OpenDota cross classification.
|
||||
"""Unit tests for STRATZ matchup ranking + cache helpers.
|
||||
|
||||
Run from repo root:
|
||||
python -m unittest shared.tests.test_matchup_cross -v
|
||||
python -m unittest shared.tests.test_stratz_matchups -v
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -13,11 +13,6 @@ from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
|
||||
from shared.matchup_cross import ( # noqa: E402
|
||||
classify_cross_source,
|
||||
enrich_entry_cross,
|
||||
enrich_hero_matchups_cross,
|
||||
)
|
||||
from web.fetch_stratz_meta import ( # noqa: E402
|
||||
annotate_matchup_cell,
|
||||
build_matchup_file_payload,
|
||||
@@ -125,80 +120,5 @@ class MatchupCacheHelpersTests(unittest.TestCase):
|
||||
self.assertIn("antimage", loaded)
|
||||
|
||||
|
||||
class CrossClassifyTests(unittest.TestCase):
|
||||
def test_agree_conflict_weak(self) -> None:
|
||||
self.assertEqual(
|
||||
classify_cross_source(
|
||||
stratz_signed=5.0, odota_adv_val=0.04, odota_games=200
|
||||
),
|
||||
"agree",
|
||||
)
|
||||
self.assertEqual(
|
||||
classify_cross_source(
|
||||
stratz_signed=5.0, odota_adv_val=-0.04, odota_games=200
|
||||
),
|
||||
"conflict",
|
||||
)
|
||||
self.assertEqual(
|
||||
classify_cross_source(
|
||||
stratz_signed=5.0, odota_adv_val=0.04, odota_games=10
|
||||
),
|
||||
"weak",
|
||||
)
|
||||
|
||||
def test_countered_uses_restored_sign(self) -> None:
|
||||
# Display advantage for countered is +8 (negated); original vs was -8.
|
||||
by_odota = {
|
||||
"1": {
|
||||
"2": {"games": 200, "wins": 80}, # AM wr 40% vs peer
|
||||
}
|
||||
}
|
||||
# Baseline for hero 1 ≈ 0.4 from only this matchup.
|
||||
from shared.matchup_cross import build_baseline
|
||||
|
||||
baseline = build_baseline(by_odota)
|
||||
entry = enrich_entry_cross(
|
||||
{
|
||||
"hero_id": 2,
|
||||
"games": 100,
|
||||
"wins": 40,
|
||||
"advantage": 8.0,
|
||||
"wr": 0.6,
|
||||
},
|
||||
hero_id=1,
|
||||
kind="countered",
|
||||
by_odota=by_odota,
|
||||
baseline=baseline,
|
||||
min_games=80,
|
||||
)
|
||||
# odota_adv = 0.4 - 0.4 = 0 → weak
|
||||
self.assertEqual(entry["cross"]["status"], "weak")
|
||||
|
||||
def test_enrich_hero_keeps_stale_flag(self) -> None:
|
||||
cell = {
|
||||
"counters": [
|
||||
{
|
||||
"hero_id": 94,
|
||||
"games": 100,
|
||||
"wins": 60,
|
||||
"advantage": 3.0,
|
||||
"wr": 0.6,
|
||||
}
|
||||
],
|
||||
"countered": [],
|
||||
"synergies": [],
|
||||
"fetched_at": "t0",
|
||||
"stale": True,
|
||||
}
|
||||
out = enrich_hero_matchups_cross(
|
||||
cell,
|
||||
hero_id=1,
|
||||
by_odota={},
|
||||
baseline={},
|
||||
)
|
||||
self.assertTrue(out["stale"])
|
||||
self.assertEqual(out["cross"] if False else out["counters"][0]["cross"]["status"], "weak")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user