From c2505649f6d539010d2538e81581e710456d56ab Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Mon, 16 Oct 2023 11:22:09 -0400 Subject: [PATCH] Don't assume storage classes are mocked because dataset type name is. Automatic-output connections (configs, logs, metadata) get _mock prefixes from the task label, but don't actually use mock storage classes. --- .../lsst/pipe/base/tests/mocks/_storage_class.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/lsst/pipe/base/tests/mocks/_storage_class.py b/python/lsst/pipe/base/tests/mocks/_storage_class.py index b25c8b6e6..c4cac0314 100644 --- a/python/lsst/pipe/base/tests/mocks/_storage_class.py +++ b/python/lsst/pipe/base/tests/mocks/_storage_class.py @@ -405,16 +405,18 @@ def unmock_dataset_type(mock_type: DatasetType) -> DatasetType: original_type : `lsst.daf.butler.DatasetType` The original dataset type. """ - mock_storage_class = cast(MockStorageClass, mock_type.storageClass) - original_parent_storage_class = None - if mock_type.parentStorageClass is not None: - original_parent_storage_class = cast(MockStorageClass, mock_type.parentStorageClass).original + storage_class = mock_type.storageClass + parent_storage_class = mock_type.parentStorageClass + if isinstance(storage_class, MockStorageClass): + storage_class = storage_class.original + if parent_storage_class is not None and isinstance(parent_storage_class, MockStorageClass): + parent_storage_class = parent_storage_class.original return DatasetType( get_original_name(mock_type.name), mock_type.dimensions, - mock_storage_class.original, + storage_class, isCalibration=mock_type.isCalibration(), - parentStorageClass=original_parent_storage_class, + parentStorageClass=parent_storage_class, ) @staticmethod