def test_bad_temporalwcs(self): bad_temporal_wcs = TimeTestUtil.bad_ctype_wcs() with pytest.raises(InvalidWCSError) as ex: wcsvalidator._validate_temporal_wcs(bad_temporal_wcs) assert ('unexpected TIMESYS, CTYPE' in str(ex)) bad_temporal_wcs = TimeTestUtil.bad_cunit_wcs() with pytest.raises(InvalidWCSError) as ex: wcsvalidator._validate_temporal_wcs(bad_temporal_wcs) assert ('unexpected CUNIT' in str(ex)) bad_temporal_wcs = TimeTestUtil.bad_range_wcs() with pytest.raises(InvalidWCSError) as ex: wcsvalidator._validate_temporal_wcs(bad_temporal_wcs) assert ('range.end not >= range.start' in str(ex)) bad_temporal_wcs = TimeTestUtil.bad_delta() with pytest.raises(InvalidWCSError) as ex: wcsvalidator._validate_temporal_wcs(bad_temporal_wcs) assert ('delta must be greater than 0.0' in str(ex))
def test_bad_temporalwcs(self): bad_temporal_wcs = TimeTestUtil.bad_ctype_wcs() with six.assertRaisesRegex(self, InvalidWCSError, 'unexpected TIMESYS, CTYPE'): wcsvalidator._validate_temporal_wcs(bad_temporal_wcs) bad_temporal_wcs = TimeTestUtil.bad_cunit_wcs() with six.assertRaisesRegex(self, InvalidWCSError, 'unexpected CUNIT'): wcsvalidator._validate_temporal_wcs(bad_temporal_wcs) bad_temporal_wcs = TimeTestUtil.bad_range_wcs() with six.assertRaisesRegex(self, InvalidWCSError, 'range.end not >= range.start'): wcsvalidator._validate_temporal_wcs(bad_temporal_wcs)
def test_temporalwcs_validator(self): good_temporal_wcs = TimeTestUtil.good_wcs() assert (good_temporal_wcs.axis.function is not None) wcsvalidator._validate_temporal_wcs(good_temporal_wcs) wcsvalidator._validate_temporal_wcs(None)