Skip to content

Commit

Permalink
Update test for minor query system differences
Browse files Browse the repository at this point in the history
Tweak the registry query unit tests to handle minor differences between the old and new query systems.
  • Loading branch information
dhirving committed Jul 30, 2024
1 parent 56cdc0c commit 5a406b3
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions python/lsst/daf/butler/registry/tests/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,12 +1378,20 @@ def testSkyMapDimensions(self):
self.assertCountEqual({dataId["patch"] for dataId in rows}, (2, 4, 6, 7))
self.assertCountEqual({dataId["band"] for dataId in rows}, ("i",))

# Specifying non-existing skymap is an exception
with self.assertRaisesRegex(DataIdValueError, "Unknown values specified for governor dimension"):
rows = registry.queryDataIds(
def do_query():
return registry.queryDataIds(
dimensions, datasets=[calexpType, mergeType], collections=run, where="skymap = 'Mars'"
).toSet()

if self.supportsQueryGovernorValidation:
# Specifying non-existing skymap is an exception
with self.assertRaisesRegex(DataIdValueError, "Unknown values specified for governor dimension"):
do_query()
else:
# New query system returns zero rows instead of raising an
# exception.
self.assertEqual(len(do_query()), 0)

def testSpatialJoin(self):
"""Test queries that involve spatial overlap joins."""
registry = self.makeRegistry()
Expand Down Expand Up @@ -2663,11 +2671,12 @@ def testSkipCalibs(self):
)
with self.assertRaises(exception_type):
list(registry.queryDatasets("bias", collections=coll_list, findFirst=True))
# explicit list will raise if there are temporal dimensions
with self.assertRaises(NotImplementedError):
registry.queryDataIds(
["instrument", "detector", "exposure"], datasets="bias", collections=coll_list
).count()
if not self.supportsCalibrationCollectionInFindFirst:
# explicit list will raise if there are temporal dimensions
with self.assertRaises(NotImplementedError):
registry.queryDataIds(
["instrument", "detector", "exposure"], datasets="bias", collections=coll_list
).count()

# chain will skip
datasets = list(registry.queryDatasets("bias", collections=chain))
Expand Down

0 comments on commit 5a406b3

Please sign in to comment.