88import pytest
99
1010import RATapi
11- from RATapi .utils .convert import project_class_to_r1 , r1_to_project_class
11+ from RATapi .utils .convert import project_to_r1 , r1_to_project
1212
1313TEST_DIR_PATH = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "test_data" )
1414
@@ -58,9 +58,9 @@ def dspc_bilayer():
5858 ],
5959)
6060@pytest .mark .parametrize ("path_type" , [os .path .join , pathlib .Path ])
61- def test_r1_to_project_class (file , project , path_type , request ):
61+ def test_r1_to_project (file , project , path_type , request ):
6262 """Test that R1 to Project class conversion returns the expected Project."""
63- output_project = r1_to_project_class (path_type (TEST_DIR_PATH , file ))
63+ output_project = r1_to_project (path_type (TEST_DIR_PATH , file ))
6464 expected_project = request .getfixturevalue (project )
6565
6666 # assert statements have to be more careful due to R1 missing features
@@ -83,7 +83,7 @@ def test_r1_to_project_class(file, project, path_type, request):
8383def test_r1_involution (project , request , monkeypatch ):
8484 """Test that converting a Project to an R1 struct and back returns the same project."""
8585 original_project = request .getfixturevalue (project )
86- r1_struct = project_class_to_r1 (original_project , return_struct = True )
86+ r1_struct = project_to_r1 (original_project , return_struct = True )
8787
8888 # rather than writing the struct to a file and reading the file, just directly
8989 # hand the struct over
@@ -93,7 +93,7 @@ def mock_load(ignored_filename, **ignored_settings):
9393
9494 monkeypatch .setattr ("RATapi.utils.convert.loadmat" , mock_load , raising = True )
9595
96- converted_project = r1_to_project_class (project )
96+ converted_project = r1_to_project (project )
9797
9898 for class_list in RATapi .project .class_lists :
9999 assert getattr (converted_project , class_list ) == getattr (original_project , class_list )
@@ -105,7 +105,7 @@ def test_invalid_constraints():
105105 match = r"The parameter (.+) has invalid constraints,"
106106 " these have been adjusted to satisfy the current value of the parameter."
107107 ):
108- output_project = r1_to_project_class (pathlib .Path (TEST_DIR_PATH , "R1DoubleBilayerVolumeModel.mat" ))
108+ output_project = r1_to_project (pathlib .Path (TEST_DIR_PATH , "R1DoubleBilayerVolumeModel.mat" ))
109109
110110 assert output_project .background_parameters [0 ].min == output_project .background_parameters [0 ].value
111111
@@ -117,7 +117,7 @@ def test_matlab_save(path_type, request):
117117 project = request .getfixturevalue ("r1_default_project" )
118118 with tempfile .TemporaryDirectory () as temp :
119119 matfile = path_type (temp , "testfile.mat" )
120- project_class_to_r1 (project , filename = matfile )
121- converted_project = r1_to_project_class (matfile )
120+ project_to_r1 (project , filename = matfile )
121+ converted_project = r1_to_project (matfile )
122122
123123 assert project == converted_project
0 commit comments