def test_is_asdf(tmpdir): # test fits fits = pytest.importorskip('astropy.io.fits') hdul = fits.HDUList() phdu = fits.PrimaryHDU() imhdu = fits.ImageHDU(data=np.arange(24).reshape((4, 6))) hdul.append(phdu) hdul.append(imhdu) path = os.path.join(str(tmpdir), 'test.fits') hdul.writeto(path) assert not is_asdf_file(path) assert is_asdf_file(asdf.AsdfFile())
def test_is_asdf(tmpdir): # test fits astropy = pytest.importorskip('astropy') from astropy.io import fits hdul = fits.HDUList() phdu= fits.PrimaryHDU() imhdu= fits.ImageHDU(data=np.arange(24).reshape((4,6))) hdul.append(phdu) hdul.append(imhdu) path = os.path.join(str(tmpdir), 'test.fits') hdul.writeto(path) assert not is_asdf_file(path) assert is_asdf_file(asdf.AsdfFile())