MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / test_parse_winner

Method test_parse_winner

tests/arenas/test_scml.py:136–159  ·  view source on GitHub ↗
(self, tmp_log_dir)

Source from the content-addressed store, hash-verified

134
135class TestSCMLResults:
136 def test_parse_winner(self, tmp_log_dir):
137 arena = SCMLOneShotArena.__new__(SCMLOneShotArena)
138 arena.log_local = tmp_log_dir
139 arena.logger = type("Logger", (), {"error": lambda self, msg: None})()
140 round_dir = tmp_log_dir / "rounds" / "1"
141 round_dir.mkdir(parents=True)
142 (round_dir / "scml_results.json").write_text(
143 json.dumps(
144 {
145 "average_scores": {"Alice": 1.25, "Bob": 0.75},
146 "details": ['{"sim": 0, "player": "Alice", "score": 1.25}'],
147 }
148 )
149 )
150
151 agents = [MockPlayer("Alice"), MockPlayer("Bob")]
152 stats = RoundStats(round_num=1, agents=agents)
153
154 arena.get_results(agents, 1, stats)
155
156 assert stats.winner == "Alice"
157 assert stats.scores == {"Alice": 1.25, "Bob": 0.75}
158 assert stats.player_stats["Alice"].score == 1.25
159 assert stats.details == ['{"sim": 0, "player": "Alice", "score": 1.25}']
160
161 def test_parse_tie(self, tmp_log_dir):
162 arena = SCMLOneShotArena.__new__(SCMLOneShotArena)

Callers

nothing calls this directly

Calls 3

RoundStatsClass · 0.90
MockPlayerClass · 0.85
get_resultsMethod · 0.45

Tested by

no test coverage detected