Skip to content

Commit 22891bf

Browse files
committed
remove unnecessary tests
1 parent ddefe22 commit 22891bf

File tree

1 file changed

+11
-58
lines changed

1 file changed

+11
-58
lines changed

tests/unit_tests/rl/test_language_reward.py

Lines changed: 11 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ def setUp(self):
1818
self.LanguageReward = LanguageReward
1919
self.reward_en = LanguageReward(target_language="en")
2020
self.reward_ja = LanguageReward(target_language="ja")
21-
self.custom_reward = LanguageReward(
22-
target_language="ja",
23-
match_reward=0.9,
24-
no_match_reward=0.1,
25-
)
2621

2722
def test_init_default_values(self):
2823
"""Test LanguageReward initialization with default values."""
@@ -97,9 +92,7 @@ def test_call_with_chinese_thinking(self):
9792

9893
def test_call_with_spanish_thinking(self):
9994
"""Test __call__ with Spanish text in thinking blocks."""
100-
response = (
101-
"<思考>Este es un razonamiento en español sobre problemas matemáticos.</思考>"
102-
)
95+
response = "<思考>Este es un razonamiento en español sobre problemas matemáticos.</思考>"
10396
reward_es = self.LanguageReward(target_language="es")
10497
result = reward_es("prompt", response)
10598
# langid should detect this as Spanish (es)
@@ -152,12 +145,6 @@ def test_call_with_proper_tags(self):
152145
result = self.reward_ja("prompt", response)
153146
self.assertEqual(result, 1.0)
154147

155-
def test_call_with_whitespace_in_tags(self):
156-
"""Test __call__ with whitespace in thinking tags."""
157-
response = "< 思考 >This is English reasoning.</ 思考 >"
158-
result = self.reward_en("prompt", response)
159-
self.assertEqual(result, 1.0)
160-
161148
def test_call_multiple_thinking_blocks(self):
162149
"""Test __call__ with multiple thinking blocks - detects whole response language."""
163150
response = """
@@ -169,17 +156,6 @@ def test_call_multiple_thinking_blocks(self):
169156
# Multiple blocks -> detect whole response, English detected -> match_reward
170157
self.assertEqual(result, 1.0)
171158

172-
def test_call_multiple_thinking_blocks_mixed_languages(self):
173-
"""Test __call__ with multiple thinking blocks in different languages."""
174-
response = """
175-
<思考>First thought in English with lots of content here.</思考>
176-
<思考>これは短い日本語。</思考>
177-
"""
178-
result = self.reward_en("prompt", response)
179-
# Multiple blocks -> detect whole response, langid will detect dominant language
180-
# Should return match_reward (1.0) if English dominant, or no_match_reward (0.0) if not
181-
self.assertIn(result, [0.0, 1.0])
182-
183159
def test_call_multiline_thinking_block(self):
184160
"""Test __call__ with multiline thinking blocks."""
185161
response = """<思考>
@@ -201,20 +177,6 @@ def test_call_none_response(self):
201177
result = self.reward_en("prompt", None)
202178
self.assertEqual(result, 0.0)
203179

204-
def test_call_with_target_parameter(self):
205-
"""Test __call__ with target parameter (should be ignored)."""
206-
response = "<思考>This is English reasoning.</思考>"
207-
result = self.reward_en("prompt", response, target="some target")
208-
self.assertEqual(result, 1.0)
209-
210-
# English text without tags -> detect whole response -> match_reward
211-
result = self.reward_en(
212-
"prompt",
213-
"This is a response without thinking tags but in English language.",
214-
target="some target",
215-
)
216-
self.assertEqual(result, 1.0)
217-
218180
def test_call_custom_reward_values(self):
219181
"""Test __call__ with custom reward values."""
220182
response_ja_single = "<思考>これは日本語です。</思考>"
@@ -223,24 +185,21 @@ def test_call_custom_reward_values(self):
223185
response_en = "<思考>This is English.</思考>"
224186
response_none = ""
225187

188+
custom_reward = LanguageReward(
189+
target_language="ja",
190+
match_reward=0.9,
191+
no_match_reward=0.1,
192+
)
226193
# Test custom match reward (single block, correct language)
227-
self.assertEqual(self.custom_reward("prompt", response_ja_single), 0.9)
194+
self.assertEqual(custom_reward("prompt", response_ja_single), 0.9)
228195
# Test custom match reward (multiple blocks -> whole response, correct language)
229-
self.assertEqual(self.custom_reward("prompt", response_ja_multiple), 0.9)
196+
self.assertEqual(custom_reward("prompt", response_ja_multiple), 0.9)
230197
# Test custom match reward (no blocks -> whole response, correct language)
231-
self.assertEqual(self.custom_reward("prompt", response_ja_no_tags), 0.9)
198+
self.assertEqual(custom_reward("prompt", response_ja_no_tags), 0.9)
232199
# Test custom no_match reward (wrong language)
233-
self.assertEqual(self.custom_reward("prompt", response_en), 0.1)
200+
self.assertEqual(custom_reward("prompt", response_en), 0.1)
234201
# Test empty response
235-
self.assertEqual(self.custom_reward("prompt", response_none), 0.1)
236-
237-
def test_call_zero_custom_values(self):
238-
"""Test __call__ with zero custom values."""
239-
zero_reward = self.LanguageReward(
240-
target_language="en", match_reward=0.0, no_match_reward=0.0
241-
)
242-
result = zero_reward("prompt", "<思考>This is English.</思考>")
243-
self.assertEqual(result, 0.0)
202+
self.assertEqual(custom_reward("prompt", response_none), 0.1)
244203

245204
def test_call_with_special_characters(self):
246205
"""Test __call__ with special characters in thinking blocks."""
@@ -269,12 +228,6 @@ def test_call_with_numbers_and_symbols(self):
269228
# Should still detect as English due to words like "Calculate" and "then"
270229
self.assertEqual(result, 1.0)
271230

272-
def test_call_very_long_thinking_block(self):
273-
"""Test __call__ with very long thinking blocks."""
274-
long_content = "This is English content. " * 1000
275-
result = self.reward_en("prompt", f"<思考>{long_content}</思考>")
276-
self.assertEqual(result, 1.0)
277-
278231
def test_call_with_code_in_thinking(self):
279232
"""Test __call__ with code snippets in thinking blocks."""
280233
response = """<思考>

0 commit comments

Comments
 (0)