Skip to content

Commit

Permalink
Add tests for exposure summary stats column forwarding.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Sep 11, 2023
1 parent 8fe467b commit 6e9d76d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import dataclasses
import os.path
import unittest
import warnings

import numpy as np
from numpy.testing import assert_allclose
Expand Down Expand Up @@ -1158,6 +1159,30 @@ def testExposureSummaryExtraComponents(self):
self.assertEqual(summaryStats.ra, testDict['ra'])
self.assertEqual(summaryStats.dec, testDict['dec'])

def testExposureSummaryForwardComponents(self):
"""Test that we can forward extra components (e.g. decl->dec).
"""
testDict = {'ra': 10.0,
'decl': 10.0}
bytes = yaml.dump(testDict, encoding='utf-8')
with warnings.catch_warnings():
warnings.simplefilter("error")
summaryStats = lsst.afw.image.ExposureSummaryStats._read(bytes)

self.assertEqual(summaryStats.ra, testDict['ra'])
self.assertEqual(summaryStats.dec, testDict['decl'])

# And check if there are both listed, it should use the new dec value.
testDict = {'ra': 10.0,
'dec': 5.0,
'decl': 10.0}
bytes = yaml.dump(testDict, encoding='utf-8')
with self.assertWarns(FutureWarning):
summaryStats = lsst.afw.image.ExposureSummaryStats._read(bytes)

self.assertEqual(summaryStats.ra, testDict['ra'])
self.assertEqual(summaryStats.dec, testDict['dec'])

def testExposureSummarySchema(self):
"""Test that we can make a schema for an exposure summary and populate
records with that schema.
Expand Down

0 comments on commit 6e9d76d

Please sign in to comment.