Skip to content

Commit

Permalink
Add test for dataset type serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed Nov 1, 2024
1 parent f3eb476 commit 7d49ac0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
DataCoordinate,
DataCoordinateSequence,
DataCoordinateSet,
DatasetType,
Dimension,
DimensionConfig,
DimensionElement,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7d49ac0

Please sign in to comment.