mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-25 17:10:51 +00:00
add rectangle count dataset
This commit is contained in:
parent
a174f44361
commit
2fa1ea106d
3 changed files with 157 additions and 0 deletions
19
tests/test_rectangle_count.py
Normal file
19
tests/test_rectangle_count.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import pytest
|
||||
|
||||
from reasoning_gym.cognition.rectangle_count import RectangleCountConfig, RectangleCountDataset
|
||||
|
||||
|
||||
def test_dice():
|
||||
"""Test basic properties and solution of generated items"""
|
||||
config = RectangleCountConfig(seed=42, size=50, max_rectangles=15, width=40, height=40)
|
||||
dataset = RectangleCountDataset(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
|
||||
Loading…
Add table
Add a link
Reference in a new issue