Add RL unit tests: normalize and match_approximately#3379
Merged
copybara-service[bot] merged 1 commit intomainfrom Mar 11, 2026
Merged
Add RL unit tests: normalize and match_approximately#3379copybara-service[bot] merged 1 commit intomainfrom
copybara-service[bot] merged 1 commit intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
da0bda8 to
1e9ab7e
Compare
|
🤖 Hi @hengtaoguo, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
This PR successfully adds comprehensive unit tests for normalize_final_answer and match_format_approximately in the RL utilities. The added tests correctly evaluate formatting rewards and penalties as well as string normalization edge cases, contributing to better test coverage for RL post-training functionality.
🔍 General Feedback
- Positive Highlight: The test coverage for
normalize_final_answercorrectly anticipates and verifies several tricky LaTeX edge cases such as wrapper extraction and shorthand expansions. - Testing Pattern: Consider breaking down monolithic test methods with multiple assertions (as seen in
test_partial_format_scoresandtest_normalize_final_answer) into smaller, isolated test cases to improve diagnosability. - The mixing of
unittest.TestCasewith@pytest.mark.cpu_onlyremains consistent with the rest of the testing suite in this file, so no immediate action is needed on that front.
f8ebd41 to
3daa122
Compare
ab47c30 to
241383e
Compare
xuefgu
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add two unit tests for RL utils:
normalize_final_answer: Various numeric/string formats ("1,000", "$100", "\boxed{100}", etc.)match_format_approximately: Test reward/penalty logic with 0-4 matching tokensTests
CI
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.