mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Add support for integer division in basic arithmetic dataset
This commit is contained in:
parent
3ac07f6558
commit
9d436af2b9
2 changed files with 89 additions and 41 deletions
|
|
@ -2,7 +2,11 @@ from random import Random
|
|||
|
||||
import pytest
|
||||
|
||||
from reasoning_gym.arithmetic.basic_arithmetic import BasicArithmeticDataset, BasicArithmeticDatasetConfig
|
||||
from reasoning_gym.arithmetic.basic_arithmetic import (
|
||||
BasicArithmeticDataset,
|
||||
BasicArithmeticDatasetConfig,
|
||||
eval_floordiv,
|
||||
)
|
||||
|
||||
|
||||
def test_arithmetic_dataset_config_validation():
|
||||
|
|
@ -44,7 +48,7 @@ def test_arithmetic_dataset_items():
|
|||
|
||||
# Verify the answer matches the expression
|
||||
expression = item["metadata"]["expression"]
|
||||
answer = eval(expression) # Safe here as we control the expression
|
||||
answer = eval_floordiv(expression) # Safe here as we control the expression
|
||||
assert str(answer) == item["answer"]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue