diff --git a/src/imodmodel/functions.py b/src/imodmodel/functions.py index 9ad77dd..67541fe 100644 --- a/src/imodmodel/functions.py +++ b/src/imodmodel/functions.py @@ -10,7 +10,7 @@ def read(filename: os.PathLike, annotation: str = 'contour') -> pd.DataFrame: Parameters ---------- filename : filename to read - annotation: which annotation of the model to return ['contour', 'slicer_angle'] (default: 'contour') + annotation: which annotation of the model to return ['contour', 'slicer_angles'] (default: 'contour') """ model = ImodModel.from_file(filename) return model_to_dataframe(model,annotation) diff --git a/tests/test_functional_api.py b/tests/test_functional_api.py index 7ee3620..6c062e3 100644 --- a/tests/test_functional_api.py +++ b/tests/test_functional_api.py @@ -18,18 +18,19 @@ def test_read(two_contour_model_file, meshed_contour_model_file, slicer_angle_mo assert isinstance(contour_df, pd.DataFrame) assert all(col in expected_contour_columns for col in contour_df.columns) - for file in example_slicer_angle_files: - slicer_angle_df = imodmodel.read(file,annotation='slicer_angle') + slicer_angle_df = imodmodel.read(file, annotation='slicer_angles') assert isinstance(slicer_angle_df, pd.DataFrame) assert all(col in expected_slicer_angle_columns for col in slicer_angle_df.columns) + def test_no_slicer_angles(two_contour_model_file): """Check that an error is raised if a model with no slicer_angles is read with the 'slicer_angle' annotation.""" - with pytest.raises(ValueError,match="Model has no slicer angles."): - df = imodmodel.read(two_contour_model_file, annotation='slicer_angle') + with pytest.raises(ValueError, match="Model has no slicer angles."): + df = imodmodel.read(two_contour_model_file, annotation='slicer_angles') + def test_unknown_annotation(two_contour_model_file): """Check that an error is raised if an unknown annotation is requested.""" - with pytest.raises(ValueError,match="Unknown annotation type: unknown"): + with pytest.raises(ValueError, match="Unknown annotation type: unknown"): df = imodmodel.read(two_contour_model_file, annotation='unknown')