File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
packages/dask-task-models-library/tests/container_tasks Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -184,3 +184,32 @@ def test_objects_are_compatible_with_dask_requirements(model_cls, model_cls_exam
184184 model_instance = model_cls .model_validate (example )
185185 reloaded_instance = loads (dumps (model_instance ))
186186 assert reloaded_instance == model_instance
187+
188+
189+ def test_create_task_output_from_task_ignores_additional_entries (
190+ tmp_path : Path , faker : Faker
191+ ):
192+ task_output_schema = TaskOutputDataSchema .model_validate (
193+ {
194+ "some_output_1" : {
195+ "required" : True ,
196+ },
197+ "some_output_2" : {
198+ "required" : True ,
199+ },
200+ }
201+ )
202+ output_file = _create_fake_outputs (task_output_schema , tmp_path , False , faker )
203+ assert output_file
204+ # Add more data to the output file to simulate additional entries
205+ file_path = tmp_path / output_file
206+ data = json .loads (file_path .read_text ())
207+ data ["extra_key" ] = "extra_value"
208+ file_path .write_text (json .dumps (data ))
209+
210+ task_output_data = TaskOutputData .from_task_output (
211+ schema = task_output_schema ,
212+ output_folder = tmp_path ,
213+ output_file_ext = output_file ,
214+ )
215+ assert len (task_output_data ) == 2 , "Should only contain the expected keys"
You can’t perform that action at this time.
0 commit comments