def test_wcs_1d(wcs_1d_l): ec = ExtraCoords(wcs=wcs_1d_l, mapping=(0, )) assert ec.keys() == ('spectral', ) assert ec.mapping == (0, ) assert ec.wcs is wcs_1d_l subec = ec[1:] assert ec.keys() == ('spectral', ) assert ec.mapping == (0, ) assert np.allclose(ec.wcs.pixel_to_world_values(1), subec.wcs.pixel_to_world_values(1)) subec = ec[0] assert subec.wcs is None
def test_empty_ec(wcs_1d_l): ec = ExtraCoords() # Test slice of an empty EC assert ec[0].wcs is None assert ec.mapping == tuple() assert ec.wcs is None assert ec.keys() == tuple() ec.wcs = wcs_1d_l assert ec.wcs is wcs_1d_l ec.mapping = (0, ) assert ec.mapping == (0, )