diff --git a/reasoning_gym/algorithmic/cryptarithm.py b/reasoning_gym/algorithmic/cryptarithm.py index 784e1702..952943b8 100644 --- a/reasoning_gym/algorithmic/cryptarithm.py +++ b/reasoning_gym/algorithmic/cryptarithm.py @@ -95,7 +95,10 @@ def verify_cryptarithm_solution( # Check if sum is correct computed_sum = sum(word_numbers) if computed_sum != result_number: - return False, f"Arithmetic equation not satisfied: {word_numbers} sums to {computed_sum}, expected {result_number}" + return ( + False, + f"Arithmetic equation not satisfied: {word_numbers} sums to {computed_sum}, expected {result_number}", + ) except (KeyError, ValueError) as e: return False, f"Error applying mapping: {e}" diff --git a/tests/test_cryptarithm.py b/tests/test_cryptarithm.py index 1d454be1..396b8b3c 100644 --- a/tests/test_cryptarithm.py +++ b/tests/test_cryptarithm.py @@ -125,7 +125,9 @@ def test_cryptarithm_score_answer(): for pair in correct_answer_str.split(","): alpha, num_str = pair.split("=") correct_mapping[alpha] = int(num_str) - reversed_answer = ",".join(f"{letter}={correct_mapping[letter]}" for letter in reversed(sorted(correct_mapping.keys()))) + reversed_answer = ",".join( + f"{letter}={correct_mapping[letter]}" for letter in reversed(sorted(correct_mapping.keys())) + ) score = dataset.score_answer(answer=reversed_answer, entry=puzzle) assert score == 1.0, f"Expected 1.0 for correct answer in different order, got {score}"