From 7084db94d58a511795fae2e0d4567ff9a81ddecd Mon Sep 17 00:00:00 2001 From: alisterburt Date: Wed, 8 May 2024 01:36:06 -0700 Subject: [PATCH] add test for construction of section data with Path objects and fix bug found by Morgan Beeby (#26) --- src/mdocfile/data_models.py | 2 +- tests/test_data_models.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mdocfile/data_models.py b/src/mdocfile/data_models.py index d8c8e45..0bd5b84 100644 --- a/src/mdocfile/data_models.py +++ b/src/mdocfile/data_models.py @@ -98,7 +98,7 @@ class MdocSectionData(BaseModel): AlignedPieceCoords: Optional[Union[Tuple[float, float], Tuple[float, float, float]]] = None AlignedPieceCoordsVS: Optional[ Union[Tuple[float, float], Tuple[float, float, float]]] = None - SubFramePath: Optional[PureWindowsPath] = None + SubFramePath: Optional[Union[PureWindowsPath, Path]] = None NumSubFrames: Optional[int] = None FrameDosesAndNumbers: Optional[Sequence[Tuple[float, int]]] = None DateTime: Optional[str] = None diff --git a/tests/test_data_models.py b/tests/test_data_models.py index 3b62693..50076ad 100644 --- a/tests/test_data_models.py +++ b/tests/test_data_models.py @@ -89,3 +89,6 @@ def test_to_string_is_valid_mdoc(tilt_series_mdoc_file): for (k1, v1), (k2, v2) in zip(mdoc_dict.items(), mdoc2_dict.items()): assert v1 == v2 assert k1 == k2 + +def test_section_data_from_path(): + section = MdocSectionData(SubFramePath=Path('bla.tif')) \ No newline at end of file