diff --git a/tests/test_dimensions.py b/tests/test_dimensions.py index 3a7fe2b9f6..a613572e33 100644 --- a/tests/test_dimensions.py +++ b/tests/test_dimensions.py @@ -42,6 +42,7 @@ DataCoordinate, DataCoordinateSequence, DataCoordinateSet, + DatasetType, Dimension, DimensionConfig, DimensionElement, @@ -411,6 +412,19 @@ def testPickling(self): group2 = pickle.loads(pickle.dumps(group1)) self.assertIs(group1, group2) + def testSerialization(self): + # Check that dataset types round-trip correctly through serialization. + dataset_type = DatasetType( + "flat", + dimensions=["instrument", "detector", "physical_filter", "band"], + isCalibration=True, + universe=self.universe, + storageClass="int", + ) + roundtripped = DatasetType.from_simple(dataset_type.to_simple(), universe=self.universe) + + self.assertEqual(dataset_type, roundtripped) + @dataclass class SplitByStateFlags: