def test_soft_overlong_punishment_intermediate_completion(self):
        """Test soft overlong punishment reward function for intermediate length completion."""
        reward_fn = get_soft_overlong_punishment(max_completion_len=100, soft_punish_cache=20)
        completion_ids = [[1] * 90]  # 90 is between 80 and 100
        rewards = reward_fn(completion_ids)
        self.assertAlmostEqual(rewards[0], -0.5, places=4)
Test soft overlong punishment reward function for intermediate length completion.
tests/test_rewards.py