@@ -169,18 +169,21 @@ def test_design_space_limits():
169169 session .responses .append (mock_response )
170170
171171 # Then
172- with pytest .raises (ValueError ) as excinfo :
173- collection .register (too_big )
172+ with pytest .deprecated_call ():
173+ with pytest .raises (ValueError ) as excinfo :
174+ collection .register (too_big )
174175 assert "only supports" in str (excinfo .value )
175176
176177 # test register
177- collection .register (just_right )
178+ with pytest .deprecated_call ():
179+ collection .register (just_right )
178180
179181 # add back the response for the next test
180182 session .responses .append (mock_response )
181183
182184 # test update
183- collection .update (just_right )
185+ with pytest .deprecated_call ():
186+ collection .update (just_right )
184187
185188
186189@pytest .mark .parametrize ("predictor_version" , (2 , "1" , "latest" , None ))
@@ -312,12 +315,12 @@ def test_create_default_with_config(valid_product_design_space, ingredient_fract
312315 assert default_design_space .dump () == expected_response
313316
314317
315- def test_list_design_spaces (valid_formulation_design_space_data , valid_enumerated_design_space_data ):
318+ def test_list_design_spaces (valid_product_design_space_data , valid_hierarchical_design_space_data ):
316319 # Given
317320 session = FakeSession ()
318321 collection = DesignSpaceCollection (uuid .uuid4 (), session )
319322 session .set_response ({
320- 'response' : [valid_formulation_design_space_data , valid_enumerated_design_space_data ]
323+ 'response' : [valid_product_design_space_data , valid_hierarchical_design_space_data ]
321324 })
322325
323326 # When
@@ -331,12 +334,12 @@ def test_list_design_spaces(valid_formulation_design_space_data, valid_enumerate
331334 assert len (design_spaces ) == 2
332335
333336
334- def test_list_all_design_spaces (valid_formulation_design_space_data , valid_enumerated_design_space_data ):
337+ def test_list_all_design_spaces (valid_product_design_space_data , valid_hierarchical_design_space_data ):
335338 # Given
336339 session = FakeSession ()
337340 collection = DesignSpaceCollection (uuid .uuid4 (), session )
338341 session .set_response ({
339- 'response' : [valid_formulation_design_space_data , valid_enumerated_design_space_data ]
342+ 'response' : [valid_product_design_space_data , valid_hierarchical_design_space_data ]
340343 })
341344
342345 # When
@@ -350,12 +353,12 @@ def test_list_all_design_spaces(valid_formulation_design_space_data, valid_enume
350353 assert len (design_spaces ) == 2
351354
352355
353- def test_list_archived_design_spaces (valid_formulation_design_space_data , valid_enumerated_design_space_data ):
356+ def test_list_archived_design_spaces (valid_product_design_space_data , valid_hierarchical_design_space_data ):
354357 # Given
355358 session = FakeSession ()
356359 collection = DesignSpaceCollection (uuid .uuid4 (), session )
357360 session .set_response ({
358- 'response' : [valid_formulation_design_space_data , valid_enumerated_design_space_data ]
361+ 'response' : [valid_product_design_space_data , valid_hierarchical_design_space_data ]
359362 })
360363
361364 # When
@@ -369,13 +372,13 @@ def test_list_archived_design_spaces(valid_formulation_design_space_data, valid_
369372 assert len (design_spaces ) == 2
370373
371374
372- def test_archive (valid_formulation_design_space_data ):
375+ def test_archive (valid_product_design_space_data ):
373376 session = FakeSession ()
374377 dsc = DesignSpaceCollection (uuid .uuid4 (), session )
375378 base_path = DesignSpaceCollection ._path_template .format (project_id = dsc .project_id )
376- ds_id = valid_formulation_design_space_data ["id" ]
379+ ds_id = valid_product_design_space_data ["id" ]
377380
378- response = deepcopy (valid_formulation_design_space_data )
381+ response = deepcopy (valid_product_design_space_data )
379382 response ["metadata" ]["archived" ] = response ["metadata" ]["created" ]
380383 session .set_response (response )
381384
@@ -387,13 +390,13 @@ def test_archive(valid_formulation_design_space_data):
387390 ]
388391
389392
390- def test_restore (valid_formulation_design_space_data ):
393+ def test_restore (valid_product_design_space_data ):
391394 session = FakeSession ()
392395 dsc = DesignSpaceCollection (uuid .uuid4 (), session )
393396 base_path = DesignSpaceCollection ._path_template .format (project_id = dsc .project_id )
394- ds_id = valid_formulation_design_space_data ["id" ]
397+ ds_id = valid_product_design_space_data ["id" ]
395398
396- response = deepcopy (valid_formulation_design_space_data )
399+ response = deepcopy (valid_product_design_space_data )
397400 if "archived" in response ["metadata" ]:
398401 del response ["metadata" ]["archived" ]
399402 session .set_response (deepcopy (response ))
@@ -563,3 +566,28 @@ def test_locked(valid_product_design_space_data):
563566 assert ds .is_locked
564567 assert ds .locked_by == lock_user
565568 assert ds .lock_time == lock_time
569+
570+
571+ @pytest .mark .parametrize ("ds_data_fixture_name" , ("valid_formulation_design_space_data" ,
572+ "valid_enumerated_design_space_data" ,
573+ "valid_data_source_design_space_dict" ))
574+ def test_deprecated_top_level_design_spaces (request , ds_data_fixture_name ):
575+ ds_data = request .getfixturevalue (ds_data_fixture_name )
576+
577+ session = FakeSession ()
578+ session .set_response (ds_data )
579+ dc = DesignSpaceCollection (uuid .uuid4 (), session )
580+
581+ with pytest .deprecated_call ():
582+ ds = dc .get (uuid .uuid4 ())
583+
584+ with pytest .deprecated_call ():
585+ dc .register (ds )
586+
587+ with pytest .deprecated_call ():
588+ dc .update (ds )
589+
590+ session .set_response ({"response" : [ds_data ]})
591+
592+ with pytest .deprecated_call ():
593+ next (dc .list ())
0 commit comments