mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-30 17:40:45 +00:00
basic jugs
This commit is contained in:
parent
3adf5b6c22
commit
3eef5841f6
3 changed files with 339 additions and 0 deletions
22
tests/test_jugs.py
Normal file
22
tests/test_jugs.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from reasoning_gym.algorithmic.jugs import JugsConfig, JugsDataset
|
||||
|
||||
|
||||
def test_jugs():
|
||||
"""Test basic properties and solution of generated items"""
|
||||
config = JugsConfig(seed=42, size=10, num_jugs=3, difficulty=20)
|
||||
dataset = JugsDataset(config)
|
||||
|
||||
# easy
|
||||
for item in dataset:
|
||||
assert isinstance(item, dict)
|
||||
assert "question" in item
|
||||
assert "answer" in item
|
||||
assert "metadata" in item
|
||||
|
||||
# Test the scoring
|
||||
assert dataset.score_answer(answer=json.dumps(item["metadata"]["possible_answer"]), entry=item) == 1.0
|
||||
assert dataset.score_answer(answer=None, entry=item) == 0.0
|
||||
Loading…
Add table
Add a link
Reference in a new issue