@@ -61,11 +61,13 @@ def setUp(self):
6161 stop_sequence = ["\n " ],
6262 num_fewshots = 0 ,
6363 )
64+ self .input_task_name = "test|test_reasoning_task|0"
65+ self .task_config_name = self .task_config .full_name
6466
6567 # Create test documents with reasoning tags in expected responses
6668 self .test_docs = [
6769 Doc (
68- task_name = "test|test_reasoning_task|0" ,
70+ task_name = self . input_task_name ,
6971 query = "What is 2+2?" ,
7072 choices = ["4" ],
7173 gold_index = [0 ],
@@ -77,7 +79,7 @@ def setUp(self):
7779 # Mock dataset
7880 self .mock_dataset = {"test" : self .test_docs }
7981
80- def _mock_task_registry (self , task_config , task_docs , responses_with_reasoning_tags ):
82+ def _mock_task_registry (self , input_task_name , task_config , task_docs , responses_with_reasoning_tags ):
8183 """Create a fake registry for testing."""
8284
8385 class FakeTask (LightevalTask ):
@@ -96,13 +98,12 @@ class FakeRegistry(Registry):
9698 def __init__ (
9799 self , tasks : Optional [str ] = None , custom_tasks : Optional [Union [str , Path , ModuleType ]] = None
98100 ):
99- super ().__init__ (tasks = tasks , custom_tasks = custom_tasks )
101+ self .tasks_list = [input_task_name ]
102+ # suite_name, task_name, few_shot = input_task_name.split("|")
103+ self .task_to_configs = {input_task_name : [task_config ]}
100104
101- def get_tasks_configs (self , task : str ):
102- return [task_config ]
103-
104- def get_tasks_from_configs (self , tasks_configs ):
105- return {f"{ task_config .suite [0 ]} |{ task_config .full_name } " : FakeTask (task_config )}
105+ def load_tasks (self ):
106+ return {input_task_name : FakeTask (config = task_config )}
106107
107108 # Create a DummyModel that returns responses with reasoning tags
108109 class TestDummyModel (DummyModel ):
@@ -124,7 +125,7 @@ def test_remove_reasoning_tags_enabled(self):
124125 ]
125126
126127 FakeRegistry , TestDummyModel = self ._mock_task_registry (
127- self .task_config , self .test_docs , responses_with_reasoning
128+ self .input_task_name , self . task_config , self .test_docs , responses_with_reasoning
128129 )
129130
130131 # Initialize accelerator if available
@@ -170,7 +171,7 @@ def test_remove_reasoning_tags_enabled_tags_as_string(self):
170171 ]
171172
172173 FakeRegistry , TestDummyModel = self ._mock_task_registry (
173- self .task_config , self .test_docs , responses_with_reasoning
174+ self .input_task_name , self . task_config , self .test_docs , responses_with_reasoning
174175 )
175176
176177 # Initialize accelerator if available
@@ -216,7 +217,7 @@ def test_remove_reasoning_tags_enabled_default_tags(self):
216217 ]
217218
218219 FakeRegistry , TestDummyModel = self ._mock_task_registry (
219- self .task_config , self .test_docs , responses_with_reasoning
220+ self .input_task_name , self . task_config , self .test_docs , responses_with_reasoning
220221 )
221222
222223 # Initialize accelerator if available
@@ -259,7 +260,7 @@ def test_remove_reasoning_tags_disabled(self):
259260 ]
260261
261262 FakeRegistry , TestDummyModel = self ._mock_task_registry (
262- self .task_config , self .test_docs , responses_with_reasoning
263+ self .input_task_name , self . task_config , self .test_docs , responses_with_reasoning
263264 )
264265
265266 # Initialize accelerator if available
@@ -305,7 +306,7 @@ def test_custom_reasoning_tags(self):
305306 ]
306307
307308 FakeRegistry , TestDummyModel = self ._mock_task_registry (
308- self .task_config , self .test_docs , responses_with_reasoning
309+ self .input_task_name , self . task_config , self .test_docs , responses_with_reasoning
309310 )
310311
311312 # Initialize accelerator if available
@@ -351,7 +352,7 @@ def test_multiple_reasoning_tags(self):
351352 ]
352353
353354 FakeRegistry , TestDummyModel = self ._mock_task_registry (
354- self .task_config , self .test_docs , responses_with_reasoning
355+ self .input_task_name , self . task_config , self .test_docs , responses_with_reasoning
355356 )
356357
357358 # Initialize accelerator if available
0 commit comments