def test_correct_python_format(self):
        """Test code format reward with correct Python format."""
        completion = [
            [
                {
                    "content": "<think>\nLet's solve this\nStep 1: First step\n</think>\n<answer>\n```python\ndef hello():\n    print('world')\n```\n</answer>"
                }
            ]
        ]
        reward_fn = get_code_format_reward(language="python")
        rewards = reward_fn(completion)
        self.assertEqual(rewards[0], 1.0)
Test code format reward with correct Python format.
tests/test_rewards.py