Test code format reward with correct Python format.
(self)
| 484 | |
| 485 | class TestCodeFormat(unittest.TestCase): |
| 486 | def test_correct_python_format(self): |
| 487 | """Test code format reward with correct Python format.""" |
| 488 | completion = [ |
| 489 | [ |
| 490 | { |
| 491 | "content": "<think>\nLet's solve this\nStep 1: First step\n</think>\n<answer>\n```python\ndef hello():\n print('world')\n```\n</answer>" |
| 492 | } |
| 493 | ] |
| 494 | ] |
| 495 | reward_fn = get_code_format_reward(language="python") |
| 496 | rewards = reward_fn(completion) |
| 497 | self.assertEqual(rewards[0], 1.0) |
| 498 | |
| 499 | def test_incorrect_formats(self): |
| 500 | """Test code format reward with various incorrect formats.""" |
nothing calls this directly
no test coverage detected