mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Fix(reasoning_gym/games/countdown): Resolve SymPy parsing conflict for 10+ input numbers (#514)
* Refactor expression generation and substitution logic Updated symbol naming and added safe replacement for expressions. * Add expr_str to return values in countdown.py Modified return statement to include the modified expression string. * Implement test for min_numbers exceeding 10 Add test for CountdownDataset with more than 10 numbers * Remove trailing-whitespace * Improve readability of CountdownDataset initialization Refactor CountdownDataset initialization for readability.
This commit is contained in:
parent
de2e89d21d
commit
7d68a6cc70
2 changed files with 29 additions and 4 deletions
|
|
@ -114,6 +114,16 @@ def test_edge_cases_2():
|
|||
assert dataset.score_answer(answer=answer, entry=item) != 1.0
|
||||
|
||||
|
||||
def test_countdown_more_numbers():
|
||||
"""Test when min_numbers exceed 10"""
|
||||
dataset = CountdownDataset(
|
||||
CountdownConfig(min_numbers=11, max_numbers=11, shuffle=False, size=5, seed=42)
|
||||
) # Set 11 engaged numbers for testing
|
||||
|
||||
for item in dataset:
|
||||
assert item["metadata"]["target"] == int(eval(item["metadata"]["expression"]))
|
||||
|
||||
|
||||
def test_countdown_game_randomization():
|
||||
"""Test number randomization configuration"""
|
||||
config = CountdownConfig(min_numbers=4, max_numbers=4, shuffle=False, size=10, seed=42) # Fixed size for testing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue