Spaces:
Running
Running
Fix CI: import scoring from evaluate_runner instead of openra_rl_util
Browse filesopenra_rl_util is not in requirements.txt (scoring is inlined in
evaluate_runner.py). Switch evaluate.py and tests to use the inlined
functions so CI passes without the optional dependency.
- evaluate.py +1 -1
- tests/test_evaluate.py +21 -21
evaluate.py
CHANGED
|
@@ -37,7 +37,7 @@ from pathlib import Path
|
|
| 37 |
from typing import Any, Dict, List
|
| 38 |
from urllib.request import urlopen
|
| 39 |
|
| 40 |
-
from
|
| 41 |
|
| 42 |
# Evaluation results file
|
| 43 |
RESULTS_FILE = Path(__file__).parent / "data" / "results.csv"
|
|
|
|
| 37 |
from typing import Any, Dict, List
|
| 38 |
from urllib.request import urlopen
|
| 39 |
|
| 40 |
+
from evaluate_runner import compute_composite_score as compute_composite_score_from_games, compute_game_metrics
|
| 41 |
|
| 42 |
# Evaluation results file
|
| 43 |
RESULTS_FILE = Path(__file__).parent / "data" / "results.csv"
|
tests/test_evaluate.py
CHANGED
|
@@ -154,24 +154,24 @@ class TestAppendResults:
|
|
| 154 |
assert len(RESULTS_COLUMNS) == 13
|
| 155 |
|
| 156 |
|
| 157 |
-
class
|
| 158 |
-
"""Verify scoring uses the
|
| 159 |
-
|
| 160 |
-
def
|
| 161 |
-
"""
|
| 162 |
-
from
|
| 163 |
-
from
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
assert
|
|
|
|
| 154 |
assert len(RESULTS_COLUMNS) == 13
|
| 155 |
|
| 156 |
|
| 157 |
+
class TestScoringSource:
|
| 158 |
+
"""Verify scoring uses the inlined functions from evaluate_runner."""
|
| 159 |
+
|
| 160 |
+
def test_evaluate_imports_from_runner(self):
|
| 161 |
+
"""evaluate.py should import scoring from evaluate_runner."""
|
| 162 |
+
from evaluate import compute_composite_score_from_games
|
| 163 |
+
from evaluate_runner import compute_composite_score
|
| 164 |
+
assert compute_composite_score_from_games is compute_composite_score
|
| 165 |
+
|
| 166 |
+
def test_compute_game_metrics_from_runner(self):
|
| 167 |
+
"""evaluate.py should import compute_game_metrics from evaluate_runner."""
|
| 168 |
+
from evaluate import compute_game_metrics
|
| 169 |
+
from evaluate_runner import compute_game_metrics as runner_fn
|
| 170 |
+
assert compute_game_metrics is runner_fn
|
| 171 |
+
|
| 172 |
+
def test_score_calculation_basic(self):
|
| 173 |
+
"""Inlined compute_composite_score should produce valid scores."""
|
| 174 |
+
from evaluate_runner import compute_composite_score
|
| 175 |
+
games = [{"win": True, "kills_cost": 3000, "deaths_cost": 1000, "assets_value": 8000}]
|
| 176 |
+
score = compute_composite_score(games)
|
| 177 |
+
assert 0 < score <= 100
|