def test1(): '''ASTRODATA-iter TEST 1: Compare for AD and for HDUList (MEF)''' ad = AstroData(sci123) aditerImageObjectIdList = [] hduImageObjectIdList = [] for a in ad: aditerImageObjectIdList.append(id(a.hdulist[1])) for phu in ad.hdulist[1:]: hduImageObjectIdList.append(id(phu)) ok_(aditerImageObjectIdList == hduImageObjectIdList, \ msg='Object ids are not the same') ad.close()
def test5(): '''ASTRODATA-mode TEST 5: Clobber changed readonly file''' outfile = 'testmode5.fits' if os.path.exists(outfile): os.remove(outfile) shutil.copy(sci123, outfile) ad = AstroData(outfile, mode='update') ad.hdulist[0].header['INSTRUME'] = 'GMOS-S' ad.write(clobber=True) ad.close() ad = AstroData(outfile) ok_(ad.hdulist[0].header['INSTRUME'] == 'GMOS-S', msg='Keyword is different') os.remove(outfile) ad.close()