Coverage for tests/test_threshold_specification.py : 97%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # See COPYRIGHT file at the top of the source tree. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <https://www.lsstcorp.org/LegalNotices/>. #
"""Test ThresholdSpecification class functionality."""
"""Test initialization patterns.""" # with a fully-specified Name Name('validate_drp.AM1.design'), 5. * u.marcsec, '<')
# with a fully-specified string-based name 'validate_drp.AM1.design', 5. * u.marcsec, '<')
# bad operator 'validate_drp.AM1.design', 5. * u.marcsec, '<<')
# bad quantity 'validate_drp.AM1.design', 5., '<')
# bad name Name(metric='validate_drp'), 5. * u.marcsec, '<')
"""test __eq__.""" Name('validate_drp.AM1.design'), 5. * u.marcsec, '<')
# with compatible units Name('validate_drp.AM1.design'), 5e-3 * u.arcsec, '<')
# incompatible names Name('validate_drp.AM1.stretch'), 5. * u.marcsec, '<')
# incompatible threshold Name('validate_drp.AM1.design'), 5. * u.arcsec, '<')
# incompatible operator Name('validate_drp.AM1.design'), 5. * u.marcsec, '>')
"""Test creating and accessing a specification from a quantity.""" # Sanity-check repr
# Test specification check method s.check(4 * u.mag) ) s.check(4000 * u.mmag) ) s.check(6. * u.mag) ) s.check(6000. * u.mmag) )
# test json output
# rebuild from json
# test datum output
"""Test that strings can be converted into operators.""" ThresholdSpecification.convert_operator_str('<'), operator.lt)
ThresholdSpecification.convert_operator_str('<='), operator.le)
ThresholdSpecification.convert_operator_str('>'), operator.gt)
ThresholdSpecification.convert_operator_str('>='), operator.ge)
ThresholdSpecification.convert_operator_str('=='), operator.eq)
ThresholdSpecification.convert_operator_str('!='), operator.ne)
'camera': 'MegaCam'}) Name('validate_drp.AM1.design_r'), 5. * u.marcsec, '<', metadata_query={'filter_name': 'r'}) Name('validate_drp.AM1.design_i'), 5. * u.marcsec, '<', metadata_query={'filter_name': 'i'}) Name('validate_drp.AM1.design_HSC_r'), 5. * u.marcsec, '<', metadata_query={'filter_name': 'r', 'camera': 'HSC'})
unittest.main() |