1313 PythonTaskData ,
1414 RankCriterion ,
1515 build_task_config ,
16- make_task_definition ,
16+ make_task_definition , MilestoneData ,
1717)
1818
1919
@@ -57,7 +57,6 @@ def test_from_dict_python_task():
5757
5858
5959def test_from_dict_cuda_task ():
60- """Test creating LeaderboardTask from dict with CUDA config"""
6160 """Test creating LeaderboardTask from dict with CUDA config"""
6261 data = {
6362 "lang" : "cu" ,
@@ -93,7 +92,7 @@ def test_type_mismatch():
9392 )
9493
9594
96- def test_to_dict (leaderboard_task ):
95+ def test_to_dict (leaderboard_task : LeaderboardTask ):
9796 """Test converting LeaderboardTask to dict"""
9897 result = leaderboard_task .to_dict ()
9998
@@ -114,15 +113,15 @@ def test_to_dict(leaderboard_task):
114113 ]
115114
116115
117- def test_serialization_roundtrip (leaderboard_task ):
116+ def test_serialization_roundtrip (leaderboard_task : LeaderboardTask ):
118117 """Test to_str and from_str work together"""
119118 json_str = leaderboard_task .to_str ()
120119 reconstructed = LeaderboardTask .from_str (json_str )
121120
122121 assert reconstructed == leaderboard_task
123122
124123
125- def test_build_task_config_python (leaderboard_task ):
124+ def test_build_task_config_python (leaderboard_task : LeaderboardTask ):
126125 """Test build_task_config with Python task and submission content."""
127126 submission_content = "print('Hello World')"
128127 arch = "sm_80"
@@ -180,6 +179,11 @@ def test_build_task_config_python(leaderboard_task):
180179templates:
181180 Python: "template.py"
182181 CUDA: "template.cu"
182+ milestones:
183+ - name: "Milestone"
184+ source: "milestone.py"
185+ description: "This milestone is a test milestone"
186+ exclude_gpus: ["A100"]
183187"""
184188
185189
@@ -190,13 +194,14 @@ def task_directory(tmp_path):
190194 Path .write_text (tmp_path / "kernel.py" , "def kernel(): pass" )
191195 Path .write_text (tmp_path / "template.py" , "# Python template" )
192196 Path .write_text (tmp_path / "template.cu" , "// CUDA template" )
197+ Path .write_text (tmp_path / "milestone.py" , "def milestone(): pass" )
193198
194199 # Create task.yml
195200 Path .write_text (tmp_path / "task.yml" , TASK_YAML )
196201 return tmp_path
197202
198203
199- def test_make_task_definition (task_directory ):
204+ def test_make_task_definition (task_directory : Path ):
200205 """Test make_task_definition with a complete YAML structure"""
201206
202207 # Test the function
@@ -206,6 +211,7 @@ def test_make_task_definition(task_directory):
206211 assert isinstance (result , LeaderboardDefinition )
207212 assert result .description == "Test task description"
208213 assert result .templates == {"Python" : "# Python template" , "CUDA" : "// CUDA template" }
214+ assert result .milestones == [MilestoneData (name = "Milestone" , code = "def milestone(): pass" , description = "This milestone is a test milestone" , exclude_gpus = ["A100" ])]
209215
210216 # Verify the task
211217 task = result .task
0 commit comments