def test_wavelength_error(): with pytest.raises(TypeError): w1 = attrs.Wavelength('wobble') with pytest.raises(TypeError): w1 = attrs.Wavelength(3.24) with pytest.raises(TypeError): w1 = attrs.Wavelength((3, 3))
def test_post_wavelength(): responses = client.query(attrs.Time('2010/07/30T13:30:00','2010/07/30T14:00:00'),attrs.Series('aia.lev1_euv_12s'), attrs.Wavelength(193*u.AA)|attrs.Wavelength(335*u.AA), attrs.Notify('*****@*****.**')) aa = client.request_data(responses, return_resp=True) tmpresp = aa[0].json() assert tmpresp['status'] == 2 assert tmpresp['protocol'] == 'FITS,compress Rice' assert tmpresp['method'] == 'url' assert tmpresp['rcount'] == 302
def test_post_wavelength(): responses = client.search( vso_attrs.Time('2010/07/30T13:30:00', '2010/07/30T14:00:00'), attrs.Series('aia.lev1_euv_12s'), attrs.Wavelength(193 * u.AA) | attrs.Wavelength(335 * u.AA), attrs.Notify('*****@*****.**')) aa = client.request_data(responses) [r.wait() for r in aa] tmpresp = aa[0]._d assert tmpresp['protocol'] == 'fits' assert tmpresp['method'] == 'url' assert tmpresp['count'] == '302' tmpresp = aa[1]._d assert tmpresp['protocol'] == 'fits' assert tmpresp['method'] == 'url' assert tmpresp['count'] == '302'
def test_search_metadata(): metadata = client.search_metadata( vso_attrs.Time('2014-01-01T00:00:00', '2014-01-01T00:02:00'), attrs.Series('aia.lev1_euv_12s'), attrs.Wavelength(304 * u.AA)) assert isinstance(metadata, pd.DataFrame) assert metadata.shape == (11, 176) for i in metadata.index.values: assert (i.startswith('aia.lev1_euv_12s') and i.endswith('[304]'))
def test_post_wave_series(): with pytest.raises(TypeError): client.query( attrs.Time('2012/1/1T00:00:00', '2012/1/1T00:00:45'), attrs.Series('hmi.M_45s') | attrs.Series('aia.lev1_euv_12s'), attrs.Wavelength(193 * u.AA) | attrs.Wavelength(335 * u.AA))
def test_random(): w1 = attrs.Wavelength(193*u.AA) w2 = attrs.Series('spam') assert jsoc.jsoc.and_(w1 | w2) == AttrOr([w1, w2])
def test_duplicate(): w1 = attrs.Wavelength(193*u.AA) w2 = attrs.Wavelength(193*u.AA) assert jsoc.jsoc.and_(w1 | w2).min is w1.min
def test_wave_self(): w1 = attrs.Wavelength(193*u.AA) assert jsoc.jsoc.and_(w1 | w1) is w1