Skip to content

Commit

Permalink
slicer_angle -> slicer_angles
Browse files Browse the repository at this point in the history
  • Loading branch information
alisterburt committed Jun 13, 2024
1 parent 80ae4d6 commit d22764c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/imodmodel/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 6 additions & 5 deletions tests/test_functional_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit d22764c

Please sign in to comment.