Merge pull request #104 from zixuanguo786-ctrl/codex/preserve-fractional-hard-score
[codex] Preserve fractional rollout hard scores
This commit is contained in:
+15
-2
@@ -3,8 +3,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from skillopt.types import Edit, Patch
|
||||
|
||||
from skillopt.types import Edit, Patch, RolloutResult
|
||||
|
||||
# ── Edit ────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -247,3 +246,17 @@ class TestPatchEdgeCases:
|
||||
assert isinstance(p.edits[0], Edit)
|
||||
assert p.edits[0].op == "append"
|
||||
assert p.edits[0].content == "hello"
|
||||
|
||||
|
||||
# ── RolloutResult ────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
class TestRolloutResultRoundTrip:
|
||||
"""RolloutResult.to_dict() / RolloutResult.from_dict() round-trip."""
|
||||
|
||||
def test_preserves_fractional_hard_score(self) -> None:
|
||||
"""Hard can be a continuous reward and must not be truncated."""
|
||||
result = RolloutResult.from_dict({"id": "episode-1", "hard": 0.75, "soft": 0.5})
|
||||
|
||||
assert result.hard == pytest.approx(0.75)
|
||||
assert result.to_dict()["hard"] == pytest.approx(0.75)
|
||||
|
||||
Reference in New Issue
Block a user