mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-22 16:49:06 +00:00
20 lines
606 B
Python
20 lines
606 B
Python
import pytest
|
|
|
|
from reasoning_gym.logic.zebra_puzzles import ZebraConfig, ZebraDataset
|
|
|
|
|
|
def test_zebra_puzzles():
|
|
"""Test basic properties and solution of generated items"""
|
|
|
|
config = ZebraConfig(seed=42, size=10, k=4, m=4)
|
|
dataset = ZebraDataset(config)
|
|
|
|
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=item["answer"], entry=item) == 1.0
|
|
assert dataset.score_answer(answer=None, entry=item) == 0.0
|