Skip to content

Add unit tests for check_answer#3368

Open
Shuwen-Fang wants to merge 1 commit intomainfrom
check_answer
Open

Add unit tests for check_answer#3368
Shuwen-Fang wants to merge 1 commit intomainfrom
check_answer

Conversation

@Shuwen-Fang
Copy link
Collaborator

@Shuwen-Fang Shuwen-Fang commented Mar 10, 2026

Description

Add unit tests for check_answer to cover the following cases:

  • Correct, whitespace-stripped, ratio-threshold, and incorrect answers
  • DAPO dataset_name triggers normalize_final_answer
  • Completions where match_format_regex finds no match

Tests

pytest -rs tests/unit/rl_utils_test.py passes

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Shuwen-Fang Shuwen-Fang force-pushed the check_answer branch 2 times, most recently from 40118d2 to e86792c Compare March 10, 2026 20:53
Create unit tests for check_answer

formatting
responses=[
"<reasoning>Need to use <reasoning> and </reasoning>, "
"<answer> and </answer></reasoning><answer>11/3</answer>"
"<reasoning>Need to use <reasoning> and </reasoning>, " "<answer> and </answer></reasoning><answer>11/3</answer>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to reformat this file because of the pyink error.

Try pyink --pyink-indentation=2 --line-length=122 ., only keep the changes in rl_utils_test.py and revert the others for now.

@Shuwen-Fang Shuwen-Fang self-assigned this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants