
    HR-e{                         d dl Z d dlZd dlZd dlZd dlmZmZ d dlm	Z
 d dlmZ d dlmZmZmZmZmZmZ d dlmZmZmZ d dlmZmZmZ d dlmZmZmZ d d	l m!Z! d d
l"m#Z# d dl$m%Z& d dl'm(Z( d dl)m*Z* d dl+m,Z, d dl-m.Z. d dl/m0Z0m1Z1 d dl2m3Z3 g dZ4d  ej5                    D             Zd  ej5                    D             Z6d  ej5                    D             Zd Z7 G d d          Z8 G d d          Z9d Z:d Z;ej<        =                    dg d          d             Z>ej<        =                    d g d!          d"             Z?ej<        =                    d#g d$          d%             Z@d& ZAd' ZBd( ZCd) ZDd* ZEd;d,ZFd- ZGej<        =                    d.eef          d/             ZHej<        =                    d0 eI ej5                                        ej<        =                    d.eef          d1                         ZJej<        =                    d0e65                                          ej<        K                    d23          d4                         ZLd5 ZMej<        =                    d6g d7          d8             ZNd9 ZOd: ZPdS )<    N)assert_allcloseassert_array_equal)units)fits)BinTableHDUHDUListImageHDU
PrimaryHDUconnecttable_to_hdu)_fortran_to_python_format_parse_tdisp_formatpython_to_tdisp)compare_attrs
mixin_colsserialized_names)ColumnQTableTable)simple_table)Time)allclose)UnitScaleError)QuantityInfo)NUMPY_LT_1_22)get_pkg_data_filename)AstropyDeprecationWarningAstropyUserWarning)_NOT_OVERWRITING_MSG_MATCH)valueshapeformatscalelocationc                 h    i | ]/\  }}|t          |t                    rt          nt          |         0S  )
isinstancer   
time_attrsr   .0namecols      Blib/python3.11/site-packages/astropy/io/fits/tests/test_connect.py
<dictcomp>r.   %   sF       c 	C..G::M$4G      c                     i | ]q\  }}t          |t                    r|j        j        d k    sDt          |t          j                  r|j        j        dk    st          |t          j	                  n||rS )r&   O)
r'   r   r$   r!   npndarraydtypekinduLogQuantityr)   s      r-   r.   r.   +   s     
 
 
c3	

 L"$$c2:&& %INc!!c1=)) " 	# "!!r/   c                 ,    i | ]\  }}|t           v||S r&   )unsupported_colsr)   s      r-   r.   r.   6   s0       $TAQ5Q5QD#5Q5Q5Qr/   c                 R     t           fd j        j        D                       S )Nc              3   `   K   | ](}t          j        |         |         k              V  )d S N)r2   all)r*   r+   abs     r-   	<genexpr>zequal_data.<locals>.<genexpr><   s:      DDdrvag4())DDDDDDr/   )r=   r4   names)r>   r?   s   ``r-   
equal_datarB   ;   s.    DDDDDagmDDDDDDr/   c                   P   e Zd Zd Zd Zd Zd Zd Zd Ze	j
                            deef          d             Zd	 Ze	j
                            deef          d
             Ze	j
                            deef          d             Zd Ze	j
                            dddg          d             Zd Zd Zd Ze	j
                            deef          d             Zd Ze	j
                            dd          d             Zd Zd Zd Zd Zd Zd Zd Z d  Z!d! Z"d"S )#TestSingleTablec           
          t          j        t          t          g dg dg d                    dt          fddt
          fg          | _        d S )N            r>   r?   cdffffff@      @g@g!@r>   r?   U1rL   r4   )r2   arraylistzipintfloatdataselfs    r-   setup_classzTestSingleTable.setup_class@   sY    H\\\#7#7#79M9M9MNNOO:{S%L9
 
 
			r/   c                     |dz  }t          | j                  }|                    |d           t          j        |          }t	          ||          sJ d S )Ntest_simple.ftsT	overwriter   rY   writereadrB   r[   tmp_pathfilenamet1t2s        r-   test_simplezTestSingleTable.test_simpleF   ]    //49
T***Z!!"b!!!!!!!r/   c                     |dz  }t          | j                  }|                    |d           t          j        |          }t	          ||          sJ d S )Nztest_simple.fitTr_   ra   rd   s        r-   test_simple_pathlibz#TestSingleTable.test_simple_pathlibM   rj   r/   c                 L   |dz  }t          | j                  }d|j        d<   d|j        d<   d|j        d<   g d|j        d	<   g d
|j        d<   |                    |d           t          j        |          }t          ||          sJ |j        D ]}t          |j        t                    rUt          t          |j        |                             D ],}|j        |         |         |j        |         |         k    sJ -q|j        |         |j        |         k    sJ d S )Ntest_simple.fitsrG   ArO   BspamC)thisisr>   longcommentcommentsfirstsecondthirdHISTORYTr_   )
r   rY   metarb   rc   rB   r'   rU   rangelen)r[   re   rf   rg   rh   keyis          r-   test_simple_metaz TestSingleTable.test_simple_metaT   s?   0049DDD
999	
T***Z!!"b!!!!!7 	4 	4C"'4(( 4s273<0011 > >A73<?bgcl1o=====> ws|rws|33333	4 	4r/   c                 
   |dz  }t          | j                  }d|j        d<   t          j        t
          d          5 }|                    |d           d d d            n# 1 swxY w Y   t          |          dk    sJ d S )	Nrn   rq   ttype1zXMeta-data keyword ttype1 will be ignored since it conflicts with a FITS reserved keywordmatchTr_   rG   )r   rY   r}   pytestwarnsr   rb   r   )r[   re   rf   rg   ws        r-   test_simple_meta_conflictingz,TestSingleTable.test_simple_meta_conflictingf   s    0049"\#
 
 
 	/ HHXH...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 1vv{{{{{{s   A##A'*A'c                     |dz  }t          | j                  }|                    |dd           t          j        |          }t	          ||          sJ dS )zE
        Test that file type is recognized without extension
        ri   Tr   )r`   r"   Nra   rd   s        r-   test_simple_noextensionz'TestSingleTable.test_simple_noextensionu   s`     m+49
T&999Z!!"b!!!!!!!r/   
table_typec                    |dz  } || j                   }t          j        |d         _        t          j        t          j        z  |d         _        |                    |d           |                    |          }t          ||          sJ |d         j        t          j        k    sJ |d         j        t          j        t          j        z  k    sJ d S )Ntest_with_units.fitsr>   rL   Tr_   )	rY   r6   munitkmsrb   rc   rB   r[   r   re   rf   rg   rh   s         r-   test_with_unitszTestSingleTable.test_with_units   s    44Z	""s3tacz3
T***__X&&"b!!!!!#w|qs""""#w|qtacz))))))r/   c                 V   |dz  }t          j        d          }t                      }t          j        d          |z  |d<   t          j        t                    5 }|                    |d           d d d            n# 1 swxY w Y   t          |          dk    sJ dt          |d         j                  v sJ t          j        t           j        d	
          5 }t          j        |          }d d d            n# 1 swxY w Y   t          |          dk    sJ t          |d         j        t           j                  sJ t          |d         j                  dk    sJ t          j        |d         j        |d         j        k              sJ t          j        |          5  t          j        |          }|d         j        |u sJ t)          ||          sJ t          j        t                    5  |                    |d           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j        dt           j        i          5  t          j        |          }|d         j        t           j        u sJ 	 d d d            d S # 1 swxY w Y   d S )Nr   bandpass_sol_lum   lTr_   rG   r   z 'bandpass_sol_lum' did not parser   )r6   def_unitr   r2   onesr   r   r   rb   r   strmessageUnitsWarningrc   r'   r   UnrecognizedUnitr=   r    add_enabled_unitsrB   set_enabled_aliasesLsun)r[   re   rf   r   tr   rh   t3s           r-   test_with_custom_units_qtablez-TestSingleTable.test_with_custom_units_qtable   s    44z,--HHd"#\,-- 	.GGHG---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.1vv{{{{!S1%6%66666\N"D
 
 
 	'X&&B	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 1vv{{{{"S',(:;;;;;2c7<  $66666vbgmqv|344444  && 	3 	3X&&Bc7<4''''b!$$$$$ 011 3 3T2223 3 3 3 3 3 3 3 3 3 3 3 3 3 3	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 "$6#?@@ 	* 	*X&&Bc7<16)))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*sm   A??BBC>>DD)AH5:HH5H"	"H5%H"	&H55H9<H9 0JJ"%J"c                     t          | j                  }d|j        d         _        d|j        d         _        t	          j        t          t          j        t          j                            5  |	                    |          }d d d            n# 1 swxY w Y   |d         j        t          j        k    sJ |d         j        t          j        t          j
        t          j        z  t          j        z  z  k    sJ d S )N	Angstromsr   zergs/(cm.s.Angstroms)rH   )r   ergsr>   rL   )r   rY   columnsr   r6   r   dictAAergrc   cmr   )r[   r   hdur   s       r-   test_read_with_unit_aliasesz+TestSingleTable.test_read_with_unit_aliases   s   $)$$)A5A"4!$QU#C#C#CDD 	% 	%$$A	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%v{ad""""v{aeqtaczAD'89999999s   0BBBc                 l   |dz  } || j                   }d|d         _        d|d         _        d|d         _        |                    |d	           |                    |          }t	          ||          sJ |d         j        dk    sJ |d         j        dk    sJ |d         j        dk    sJ d S )
Nztest_with_format.fitsz{:5d}r>   z{:>20}r?   z{:6.2f}rL   Tr_   )rY   r"   rb   rc   rB   r   s         r-   test_with_formatz TestSingleTable.test_with_format   s    55Z	"" 3!3"3
T***__X&&"b!!!!!#w~((((#w~))))#w~******r/   c                    |dz  }t          | j        d          }g d|j        d<   g d|j        d<   g d|j        d	<   |                    |d
           t          j        |          }t          ||          sJ t          j        |d         j        |d         j        k              sJ t          j        |d         j        |d         j        k              sJ t          j        |d	         j        |d	         j        k              sJ d S )Nztest_masked.fitsTmaskedrG   r   rG   r   r>   rG   r   r   rG   r?   )r   rG   rG   r   rL   r_   )r   rY   maskrb   rc   rB   r2   r=   rd   s        r-   test_maskedzTestSingleTable.test_masked   s   0049T***#||#||#||
T***Z!!"b!!!!!vbglbgl233333vbglbgl233333vbglbgl23333333r/   r   TFc                    |dz  }t           j                            g dg d          }t           j                            g dg dd          }t           j                            ||gd	
          }t	          |||gg d|          }|                    |d           t	          j        |          }t          |d         j        t           j	        dt           j	        dg           t          |d         j        t           j	        ddt           j	        g           t          |d         j        t          j        |d         j        |d         j        gd	
                     t          j
        |d         j        |d         j        k              sJ t          j
        |d         j        |d         j        k              sJ t          j
        |d         j        |d         j        k              sJ dS )zCheck that masked values by default are replaced by NaN.

        This should work for any shape and be independent of whether the
        Table is formally masked or not.

        test_masked_nan.fitsg      @      !@g      @      @r   r   g      @rP         @g     !@r   f4)r   r4   axisr>   r?   rL   )rA   r   Tr_   r>   r   r   r?   rP   r   rL   N)r2   maMaskedArraystackr   rb   rc   r   rY   nanr=   r   )	r[   r   re   rf   r>   r?   rL   rg   rh   s	            r-   test_masked_nanzTestSingleTable.test_masked_nan   s    44E555LLLIIE555LLLPTUUEKKARK((Aq!9OOOFCCC
T***Z!!2c7<"&#rvt)DEEE2c7<"&#tRV)DEEEsGL"(BsGL"S',#?bIII	
 	
 	
 vbglbgl233333vbglbgl233333vbglbgl23333333r/   c                    |dz  }t           j                            g dg d          }t           j                            g dg d          }t           j                            ||gd          }t	          |||gg d	
          }|                    |d           t	          j        |          }t          |d         j        g d           t          |d         j        g d           t          |d         j        t          j        |d         j        |d         j        gd                     t          j	        |d         j
        |d         j
        k              sJ t          j	        |d         j
        |d         j
        k              sJ t          j	        |d         j
        |d         j
        k              sJ d S )Nr   r   r   r   r   r   r   r   r   rA   Tr_   r>   r?   rL   )r2   r   r   r   r   rb   rc   r   rY   r=   r   )r[   re   rf   r>   r?   rL   rg   rh   s           r-   test_masked_serialize_data_maskz/TestSingleTable.test_masked_serialize_data_mask   s   44E555LLLIIE555LLLIIEKKARK((Aq!9OOO444
T***Z!!2c7<)@)@)@AAA2c7<)@)@)@AAAsGL"(BsGL"S',#?bIII	
 	
 	
 vbglbgl233333vbglbgl233333vbglbgl23333333r/   c                    |dz  }t          | j                  }|                    |d           t          |d          5 }t	          j        |          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nztest_read_from_fileobj.fitsTr_   rb)r   rY   writetoopenr   rc   rB   )r[   re   rf   r   fr   s         r-   test_read_from_fileobjz&TestSingleTable.test_read_from_fileobj   s    ;;$)$$H---(D!! 	Q
1A	 	 	 	 	 	 	 	 	 	 	 	 	 	 	!TY'''''''s   A""A&)A&c                 `   t          | j                  }d|j        d         _        d|j        d         _        d|j        d         _        t	          j        t          j        d          5  t          j	        |          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )	NRADIANSr   rq   rG   	millieggsrH   zdid not parse as fits unitr   )r   rY   r   r   r   r   r6   r   r   rc   rB   r[   r   r   s      r-    test_read_with_nonstandard_unitsz0TestSingleTable.test_read_with_nonstandard_units  s    $)$$'A$A)A\!.0LMMM 	  	 
3A	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 !TY'''''''s   +BBBc                 (   |dz  }t          j        d          } |            }g d|z  |d<   t          j        t          d          5 }|                    |           d d d            n# 1 swxY w Y   t          |          dk    sJ |t          u rdt          |d         j	                  v sJ nd	t          |d         j	                  v sJ t          j        |          5 }|d         }d
|j        vsJ 	 d d d            d S # 1 swxY w Y   d S )Nztest_nonstandard_units.fitsrq   )      ?       @g      @r>   r   rG   z cannot be recovered in reading. r   z lost to non-astropy fits readersTUNIT1)r6   r   r   r   r   rb   r   r   r   r   r   r   header)	r[   r   re   rf   rq   r   r   ffr   s	            r-   !test_write_drop_nonstandard_unitsz1TestSingleTable.test_write_drop_nonstandard_units  s    ;;z&!!JLL 4'#\,F;;; 	qGGH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	1vv{{{{5QqT\9J9JJJJJJ5QqT\9J9JJJJJYx   	.BQ%C3:-----	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s$   	A++A/2A/%DDDc                    |dz  }t          | j                  }|                    |d           t          j        |d          }t          j        |d          }t	          ||          sJ ~~~t          j                     d S )Nr^   Tr_   Fmemmap)r   rY   rb   rc   rB   gccollect)r[   re   rf   rg   rh   r   s         r-   test_memmapzTestSingleTable.test_memmap$  s    //49
T***Z///Z..."b!!!!! B

r/   r   )FTc                 r   |dz  }t          | j                  }|                    |d           t          j        |d|          }t          j        |d|          }|d         j        j        dk    sJ |d         j        j        dk    sJ t          ||          sJ ~~~t          j                     d S )	Nr^   Tr_   F)character_as_bytesr   r?   US)	r   rY   rb   rc   r4   r5   rB   r   r   )r[   re   r   rf   rg   rh   r   s          r-   test_character_as_bytesz'TestSingleTable.test_character_as_bytes0  s    //49
T***ZU6JJJZT&III#w}!S((((#w}!S(((("b!!!!! B

r/   c                     |dz  }t          ddgdggi          }|                    |d           t          j        |          }|d         j        dk    sJ t	          |d         d                   dk    sJ d S )	Nztest_oned_single_element.fitsxrG   rH   Tr_   )rH   rG   r   )r   rb   rc   r!   r   )r[   re   rf   tablerc   s        r-   test_oned_single_elementz(TestSingleTable.test_oned_single_element?  s    ==saS1#J'((H---z(##Cy&((((49Q<  A%%%%%%r/   c                    t          | j                  }t          |          dfd	}|dz  }|                    |d           |                    |d            ||d           |                    |dd           |                    |d            ||d           |                    |d           |                    |d            ||d	           t          t	          j        dd	g                    }|                    |d           |                    |d            ||dd	
           t          |t          j        |d                    sJ d S )NrG   c                    t          j        |           5 }t          |          |k    sJ ||d          D ]8}|j        j        k    sJ t	          j        |j        j        k              sJ 9	 d d d            d S # 1 swxY w Y   d S r<   )r   r   r   r   r2   r=   rY   )rf   expected
start_fromhdu_list	hdu_tabler   s        r-   check_equalz6TestSingleTable.test_write_append.<locals>.check_equalL  s    8$$ >8}}0000!)*++!6 > >I$+sz99996).CH"<======>> > > > > > > > > > > > > > > > > >s   AA==BBztest_write_append.fitsT)appendrI   )r   r`   r_   rH   )r   r   )rG   )r   rY   r   rb   r2   rT   rB   rc   )r[   re   r   r   rf   rh   r   s         @r-   test_write_appendz!TestSingleTable.test_write_appendH  s   $)1oo	> 	> 	> 	> 	> 	> 66	&&&	&&&Ha    	
666	&&&Ha    	
D)))	D)))Ha    28QF##$$
T***	&&&HaA...."ejq999:::::::r/   c                 *   t          | j                  }|dz  }|                    |           t          j        t
          t                    5  |                    |           d d d            n# 1 swxY w Y   |                    |d           d S )Nztest_write_overwrite.fitsr   Tr_   )r   rY   rb   r   raisesOSErrorr   )r[   re   r   rf   s       r-   test_write_overwritez$TestSingleTable.test_write_overwritei  s    $)99	]7*DEEE 	 	GGH	 	 	 	 	 	 	 	 	 	 	 	 	 	 		D)))))s   A11A58A5c                    |dz  }t          j        dt          j        ddt          j        g          d          }t           j                            |g          }|                    |           t          j	        |          }t          |j                  sJ |j        d         sJ t          j	        |d          }|j        J t          j	        |d	
          }|j        J d S )Nz&test_inexact_format_parse_on_read.fitsr>   rG   rH   Er+   rT   r"   Fmask_invalidTr   )r   r   r2   rT   r   TableHDUfrom_columnsr   r   rc   anyr   )r[   re   rf   c1	table_hdutabs         r-   test_mask_nans_on_readz&TestSingleTable.test_mask_nans_on_readq  s    FF[c1a.)A)A#NNNM..t44	(###j""38}}x{j666x j$///xr/   c                 N   |dz  }t          j        dt          j        g dd          ddd	          }t           j                            |g          }|                    |d
           t          j        |          }t          |j
                  sJ |j
        d         sJ d S )N#test_null_format_parse_on_read.fitsr>   )rG   rH   c   i`  u2rS   Ir  i   )r+   rT   r"   nullbzeroTr_   rH   r   r   r2   rT   r   r  r   r   rc   r  r   r[   re   rf   r,   bin_table_hdur  s         r-   test_mask_null_on_readz&TestSingleTable.test_mask_null_on_read  s    CCk(,,,D999
 
 
 (55se<<h$777j""38}}x{r/   c                    |dz  }t          j        dt          j        g dd          d          }t           j                            |g          }|                    |d	           t          j        |          }t          |j
                  sJ |j
        d
         sJ t          j        |d          }|j
        J d S )Nr
  r>   )s   foos   barr/   z|S3rS   A3r   Tr_   rH   Fr   r  r  s         r-   test_mask_str_on_readz%TestSingleTable.test_mask_str_on_read  s    CCkBH%:%:%:%HHHQU
 
 
 (55se<<h$777j""38}}x{j666xr/   c                 |   |dz  }d}t          j        ddg          }t          j        g d          }t          j        ||gt                    }t          d|i          }t	          j        t          |          5  |                    |           d	d	d	           n# 1 swxY w Y   t          j        d
dg          }t          j        g d          }t          j        ||gt                    }t	          j        t          |          5  |                    |           d	d	d	           d	S # 1 swxY w Y   d	S )zB
        Check the behaviour of heterogeneous VLA object.
        test_table_object.fitsz@Column 'col1' contains unsupported object types or mixed types: -      )g      &@g      (@   rS   col1r   Nfivethirty)r2   rT   objectr   r   r   	TypeErrorrb   )r[   re   rf   msgr>   r?   varr  s           r-   test_heterogeneous_VLA_tablesz-TestSingleTable.test_heterogeneous_VLA_tables  s    66P Hb"XH%%%&&h1vV,,,VSM""]9C000 	  	 IIh	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  Hfh'((H%%%&&h1vV,,,]9C000 	  	 IIh	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s$   =BB#&B#D11D58D5c                     |dz  }d}t          ddgi          }t          j        t          |          5  |                    |           ddd           dS # 1 swxY w Y   dS )zz
        Write objects with the unified I/O interface.
        See https://github.com/astropy/astropy/issues/1906
        r  zNColumn 'col1' contains unsupported object types or mixed types: {dtype\('O'\)}r  Nr   )r   r   r   r   rb   )r[   re   rf   r!  r  s        r-   %test_write_object_tables_with_unifiedz5TestSingleTable.test_write_object_tables_with_unified  s    
 66_VdV$%%]9C000 	  	 IIh	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s   AAAc                    |dz  }t          j        ddg          }t          j        g d          }t          j        g d          }t          j        |||gt                    }t          d|i          }|                    |           t          j        |          }t          j        |d         d         t          j        ddg                    sJ t          j        |d	         d         t          j        g d                    sJ t          j        |d
         d         t          j        g d                    sJ dS )z
        Write VLA objects with the unified I/O interface.
        See https://github.com/astropy/astropy/issues/11323
        ztest_table_VLA.fitsr  r  )      r  )r  7   A   K   rS   r  r   rG   rH   N)r2   rT   r  r   rb   rc   array_equal)	r[   re   rf   r>   r?   rL   r"  tabwr  s	            r-   "test_write_VLA_tables_with_unifiedz2TestSingleTable.test_write_VLA_tables_with_unified  s*    33Hb"XH\\\""H%%%&&h1ay///fc]##

8j""~c!fVnbhBx.@.@AAAAA~c!fVnbh|||.D.DEEEEE~c!fVnbh7G7G7G.H.HIIIIIIIr/   N)#__name__
__module____qualname__r\   ri   rl   r   r   r   r   markparametrizer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r#  r%  r.  r&   r/   r-   rD   rD   ?   s~       
 
 
" " "" " "4 4 4$  " " " [\E6?;;	* 	* <;	*$* $* $*L [\E6?;;: : <;: [\E6?;;+ + <;+4 4 4 [Xe}554 4 654.4 4 4"( ( (( ( ( [\E6?;;. . <;.&
 
 
 [X}55  65& & &; ; ;B* * *     "             ,
  
  
 J J J J Jr/   rD   c                   f   e Zd Zd Zd Zd Zd Zd Zej	        
                    dddg          d	             Zej	        
                    dd
dg          d             Zej	        
                    dddg          d             Zd Zej	        
                    dg d          d             Zej	        
                    dg d          d             Zej	        
                    dg d          d             Zd Zd Zej	        
                    dg d          d             Zej	        
                    dddg          d             Zej	        
                    dd
dg          d             Zej	        
                    dddg          d             Zej	        
                    dg d          d             Zej	        
                    dg d          d             Zej	        
                    dg d          d              Zej	        
                    dg d!          d"             Zd#S )$TestMultipleHDUc           
         t          j        t          t          g dg dg d                    dt          fddt
          fg          | _        t          j        t          t          g dg d                    d	t
          fd
t
          fg          | _        t          j        t          t          g dg d                    dt          fdt
          fg          | _        t                      }t          | j        d          }t          | j        d          }t          t          j        d          d          }t          | j                  }t          |||||g          | _        t          ||||g          | _        t          |||g          | _        t          |||g          | _        t          ||g          | _        d S )NrF   rK   rN   r>   rQ   rL   rS   )gffffff?rO   g	@g@pqro   rp   ry   )r+   rz   )rI   rI   r{   )r2   rT   rU   rV   rW   rX   data1data2data3r
   r   r	   r   r   hdushdusbhdus3hdus2hdus1)r[   hdu0hdu1hdu2hdu3hdu4s         r-   r\   zTestMultipleHDU.setup_class  s   X\\\#7#7#79M9M9MNNOO:{S%L9
 
 

 X)))+?+?+?@@AA<#u.
 
 

 X\\\#7#7#78899:U|,
 
 

 ||4:G4444:H555g6664:&&T4tT:;;	dD$566
dD$/00
dD$/00
dD\**


r/   c                 
    | ` d S r<   )r<  rZ   s    r-   teardown_classzTestMultipleHDU.teardown_class  s    IIIr/   c                 .    t          j        d           d S )Nalways)warningsfilterwarnings)r[   methods     r-   setup_methodzTestMultipleHDU.setup_method  s    )))))r/   c                    |dz  }| j                             |           t          j        t          d          5  t          j        |          }d d d            n# 1 swxY w Y   t          || j                  sJ |dz  }| j	                            |           t          j        t          d          5  t          j        |          }d d d            n# 1 swxY w Y   t          || j
                  sJ d S )Nztest_read.fitsbhdu= was not specified but multiple tables are present, reading in first available table \(hdu=1\)r   ztest_read_2.fitsbhdu= was not specified but multiple tables are present, reading in first available table \(hdu=2\))r<  r   r   r   r   r   rc   rB   r9  r=  r:  )r[   re   rf   r   r   s        r-   	test_readzTestMultipleHDU.test_read  s   ..	(###\
 
 
 	% 	% 
8$$A	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% !TZ(((((00
8$$$\
 
 
 	& 	& H%%B	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& "dj)))))))s#   AA #A 8CC Cc                    |dz  }| j                             |           t          j        t                    5 }t          j        |d           d d d            n# 1 swxY w Y   |j        j        d         dk    sJ d S )Nztest_read_with_hdu_0.fitsr   r   No table found in hdu=0)	r<  r   r   r   
ValueErrorr   rc   r    args)r[   re   rf   excs       r-   test_read_with_hdu_0z$TestMultipleHDU.test_read_with_hdu_0  s    99	(###]:&& 	(#JxQ''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(y~a $=======s   AA #A r   rG   ry   c                     |dz  }| j                             |           t          j        ||          }t	          || j                  sJ d S )Nztest_read_with_hdu_1.fitsr   )r<  r   r   rc   rB   r9  r[   re   r   rf   r   s        r-   test_read_with_hdu_1z$TestMultipleHDU.test_read_with_hdu_1  U    99	(###JxS)))!TZ(((((((r/   rH   rz   c                     |dz  }| j                             |           t          j        ||          }t	          || j                  sJ d S )Nztest_read_with_hdu_2.fitsr   )r<  r   r   rc   rB   r:  rY  s        r-   test_read_with_hdu_2z$TestMultipleHDU.test_read_with_hdu_2  r[  r/   rI   r{   c                     |dz  }| j                             |           t          j        t          d          5  t          j        ||           d d d            d S # 1 swxY w Y   d S )Nztest_read_with_hdu_3.fitsNo table found in hdu=3r   r   )r<  r   r   r   rT  r   rc   )r[   re   r   rf   s       r-   test_read_with_hdu_3z$TestMultipleHDU.test_read_with_hdu_3%  s    99	(###]:-FGGG 	* 	*JxS))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   AA#&A#c                     |dz  }| j                             |           t          j        |d          }t	          || j                  sJ d S )Nztest_read_with_hdu_4.fitsrJ   r   )r<  r   r   rc   rB   r;  )r[   re   rf   r   s       r-   test_read_with_hdu_4z$TestMultipleHDU.test_read_with_hdu_4,  sU    99	(###JxQ'''!TZ(((((((r/   )rH   rI   1rz    c                    |dz  }| j                             |           t          j        t          d| d          5  t          j        ||          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nztest_warn_with_hdu_1.fitsSpecified hdu=6 not found, reading in first available table \(hdu=1\)r   r   )	r@  r   r   r   r   r   rc   rB   r9  )r[   re   r   rf   rg   s        r-   test_read_with_hdu_missingz*TestMultipleHDU.test_read_with_hdu_missing2  s    99
8$$$\%:C : : :
 
 
 	/ 	/
 H#...B	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ "dj)))))))   A""A&)A&)r   rH   r{   c                    |dz  }| j                             |           t          j        t          d| d          5  t          j        ||          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nztest_warn_with_hdu_2.fits No table found in specified hdu=,, reading in first available table \(hdu=1\)r   r   )	r?  r   r   r   r   r   rc   rB   r9  )r[   re   r   rf   rh   s        r-   test_read_with_hdu_warningz*TestMultipleHDU.test_read_with_hdu_warning>      99
8$$$\%:c : : :
 
 
 	/ 	/
 H#...B	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ "dj)))))))ri  )r   rG   r{   c                    |dz  }| j                             |           t          j        t          d| d          5  t          j        ||          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nztest_warn_with_hdu_3.fitsrk  ,, reading in first available table \(hdu=2\)r   r   )	r>  r   r   r   r   r   rc   rB   r:  )r[   re   r   rf   r   s        r-   test_read_in_last_hduz%TestMultipleHDU.test_read_in_last_hduJ  rn  ri  c                    t          j        t          d          5  t          j        | j                  }d d d            n# 1 swxY w Y   t          || j                  sJ t          j        t          d          5  t          j        | j                  }d d d            n# 1 swxY w Y   t          || j	                  sJ d S )NrO  r   rP  )
r   r   r   r   rc   r<  rB   r9  r=  r:  )r[   r   r   s      r-   test_read_from_hdulistz&TestMultipleHDU.test_read_from_hdulistV  sJ   \
 
 
 	& 	& 
49%%A	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& !TZ(((((\
 
 
 	( 	( DJ''B	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( "dj)))))))s#   AA	A?B%%B),B)c                     t          j        t                    5 }t          j        | j        d           d d d            n# 1 swxY w Y   |j        j        d         dk    sJ d S )Nr   r   rS  )r   r   rT  r   rc   r<  r    rU  )r[   rV  s     r-   !test_read_from_hdulist_with_hdu_0z1TestMultipleHDU.test_read_from_hdulist_with_hdu_0i  s    ]:&& 	)#Jtya((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)y~a $=======s   AA	A)rG   ry   Nc                 j    t          j        | j        |          }t          || j                  sJ d S Nr   )r   rc   r@  rB   r9  r   s      r-   (test_read_from_hdulist_with_single_tablez8TestMultipleHDU.test_read_from_hdulist_with_single_tablen  s6    Jtzs+++!TZ(((((((r/   c                 j    t          j        | j        |          }t          || j                  sJ d S rw  r   rc   r<  rB   r9  r   s      r-   !test_read_from_hdulist_with_hdu_1z1TestMultipleHDU.test_read_from_hdulist_with_hdu_1s  6    Jtyc***!TZ(((((((r/   c                 j    t          j        | j        |          }t          || j                  sJ d S rw  )r   rc   r<  rB   r:  r   s      r-   !test_read_from_hdulist_with_hdu_2z1TestMultipleHDU.test_read_from_hdulist_with_hdu_2x  r|  r/   c                     t          j        t          d          5  t          j        | j        |           d d d            d S # 1 swxY w Y   d S )Nr_  r   r   )r   r   rT  r   rc   r<  )r[   r   s     r-   !test_read_from_hdulist_with_hdu_3z1TestMultipleHDU.test_read_from_hdulist_with_hdu_3}  s    ]:-FGGG 	+ 	+Jtyc****	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   AA	A	c                     t          j        t          d| d          5  t          j        | j        |          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nrk  rl  r   r   )r   r   r   r   rc   r?  rB   r9  )r[   r   rh   s      r-   'test_read_from_hdulist_with_hdu_warningz7TestMultipleHDU.test_read_from_hdulist_with_hdu_warning      \%:c : : :
 
 
 	1 	1
 DJC000B	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 "dj)))))))   AAAc                     t          j        t          d| d          5  t          j        | j        |          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nrf  rg  r   r   )r   r   r   r   rc   r@  rB   r9  )r[   r   rg   s      r-   'test_read_from_hdulist_with_hdu_missingz7TestMultipleHDU.test_read_from_hdulist_with_hdu_missing  s    \%:C : : :
 
 
 	1 	1
 DJC000B	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 "dj)))))))r  c                     t          j        t          d| d          5  t          j        | j        |          }d d d            n# 1 swxY w Y   t          || j                  sJ d S )Nrk  rp  r   r   )r   r   r   r   rc   r>  rB   r:  )r[   r   r   s      r-   "test_read_from_hdulist_in_last_hduz2TestMultipleHDU.test_read_from_hdulist_in_last_hdu  r  r  )NrG   ry   c                 r    t          j        | j        d                   }t          || j                  sJ d S )NrG   rz  r   s      r-   test_read_from_single_hduz)TestMultipleHDU.test_read_from_single_hdu  s5    Jty|$$!TZ(((((((r/   N)r/  r0  r1  r\   rG  rM  rQ  rW  r   r2  r3  rZ  r]  r`  rb  rh  rm  rq  rs  ru  rx  r{  r~  r  r  r  r  r  r&   r/   r-   r5  r5    sT       + + +2  * * ** * *.> > > [UQL11) ) 21) [UQM22) ) 32) [UQL11* * 21*) ) ) [U$=$=$=>>	* 	* ?>	* [UOOO44	* 	* 54	* [UOOO44	* 	* 54	** * *&> > >
 [U$6$6$677) ) 87) [UQL11) ) 21) [UQM22) ) 32) [UQL11+ + 21+ [UOOO44* * 54* [U$=$=$=>>* * ?>* [UOOO44* * 54* [U$6$6$677) ) 87) ) )r/   r5  c                     t          j        t          d                    } t          j        | d         j        t          j        ddg          k              sJ t          | d         d          rJ t          | d         d          rJ t          | d         d          rJ t          j        | d         j        t          j        dd	g          k              sJ t          j        | d         j        t          j        d
dg          k              sJ t          | d         j        t          j        ddg                     t          j        | d         j        t          j        ddg          k              sJ dS )z
    Regression test for #1795 - this bug originally caused columns where TNULL
    was not defined to have their first element masked.
    zdata/tb.fitsr  Fc2r   c3c4rG   rH   s   abcs   xy g"Z3@g@TN)
r   rc   r   r2   r=   r   rT   hasattrrY   r   )r   s    r-   test_masking_regression_1795r    sR   
 	
(8899A6!D',"(E5>":"::;;;;;qw'''''qw'''''qw'''''6!D',"(Aq6"2"22333336!D',"(FF+;"<"<<=====AdGL"(M<+H"I"IJJJ6!D',"(E4="9"99:::::::r/   c                      g d} g d}g d}t          | ||gdddi          }d|d	         _        t          j        t          d
          5  |                    ddd           d d d            d S # 1 swxY w Y   d S )N)rG   rJ   r   )r   g      @gffffff @)r   yzr   r+   zfirst table)rA   r}   z1.2r>   zThe column 'a' could not be stored in FITS format because it has a scale '\(1\.2\)' that is not recognized by the FITS standard\. Either scale the data or change the units\.r   zt.fitsr   T)r"   r`   )r   r   r   r   r   rb   )r>   r?   rL   r   s       r-   test_scale_errorr    s    		AAAq!Qifm5LMMMAAcFK	0
 
 
 9 9 	
48889 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9s   A22A69A6ztdisp_str, format_return))zEN10.5)EN105N)zF6.2)F62N)zB5.10)rp   r  r  N)zE10.5E3)r   r  r  3)A21)ro   21NNc                 0    t          |           |k    sJ d S r<   )r   )	tdisp_strformat_returns     r-   test_parse_tdisp_formatr    s#     y))]::::::r/   ztdisp_str, format_str_return))zG15.4E2z{:15.4g})zZ5.10z{:5x})zI6.5z{:6d})L8z{:>8})zE20.7z{:20.7e}c                 0    t          |           |k    sJ d S r<   )r   )r  format_str_returns     r-   test_fortran_to_python_formatr    s$     %Y//3DDDDDDDr/   zfmt_str, tdisp_str))z{:3d}I3)3dr  )z7.3fzF7.3)z{:>4}A4)z{:7.4f}zF7.4)z%5.3gzG5.3)z%10sA10)z%.4fzF13.4c                 0    t          |           |k    sJ d S r<   r   )fmt_strr  s     r-   test_python_to_tdispr    s#     7##y000000r/   c                  4    t          dd          dk    sJ d S )Nz{:>7}T)logical_dtypeL7r  r&   r/   r-   test_logical_python_to_tdispr    s&    7$7774??????r/   c                    t          j        dt                    }|ddd         t           j        k     t	          |g          }|                    | dz  d           t          j        | dz            5 }|d         j        d	         j	        t          j	        d
          k    sJ t          j
        |d         j        d	         |k              sJ 	 ddd           dS # 1 swxY w Y   dS )z
    Regression test for https://github.com/astropy/astropy/issues/1953

    Ensures that Table columns of bools are properly written to a FITS table.
    r   rS   NrH   	test.fitsTr_   rG   col0bool)r2   r   r  False_r   rb   r   r   rY   r4   r=   )re   arrr   hduls       r-   test_bool_columnr    s    '!4
 
 
 C!H	seAGGH{"dG333	8k)	*	* 3dAw|F#)RXf-=-=====vd1gl6*c12222223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s   6AC  C$'C$c                 L   t          t          j        g d          g          }|                    | dz  d           t	          j        | dz            5 }t          j        |d         j        d         g dk              sJ |d         j        d         dk    sJ 	 d	d	d	           n# 1 swxY w Y   t          t          j        d
g          g          }t          j
        t                    5  |                    | dz  d           d	d	d	           d	S # 1 swxY w Y   d	S )a  
    Test that a column of unicode strings is still written as one
    byte-per-character in the FITS table (so long as the column can be ASCII
    encoded).

    Regression test for one of the issues fixed in
    https://github.com/astropy/astropy/pull/4228
    )r>   r?   cdr  Tr_   rG   r  TFORM12ANu   ☃)r   r2   rT   rb   r   r   r=   rY   r   r   r   UnicodeEncodeError)re   r   r  rh   s       r-   test_unicode_columnr  	  s    	rx((())*++AGGH{"dG333	8k)	*	* 0dvd1gl6*.>.>.>>?????Aw~h'4/////0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-))*	+	+B	)	*	* 9 9
K'48889 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9s%   AB**B.1B.1DD Dc                    | dz  }t          ddgddggddg          }d	|d         _        d
|d         _        t          j        t          j        d          5 }|                    |d           d d d            n# 1 swxY w Y   t          |          dk    sJ t          j        t          j        d          5 }t          j        |d           d d d            d S # 1 swxY w Y   d S )Nztest_unit.fitsrG   rH   rI   rJ   r>   r?   r   zm/sz
not-a-unitz''not-a-unit' did not parse as fits unitr   Tr_   r   )	r   r   r   r   r6   r   rb   r   rc   )re   rf   rg   r   s       r-   test_unit_warnings_read_writer     sy   **H	AASz	2	2	2BBsGLBsGL		G
 
 
 +	

T***+ + + + + + + + + + + + + + + q66Q;;;;		G
 
 
 $	

8####$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s$   A==BB=C!!C%(C%c                      t          d          } t          j        t          d          5  t	          j        |           }ddd           n# 1 swxY w Y   |j        d         g dk    sJ dS )zL
    Regression test for https://github.com/astropy/astropy/issues/6079
    zdata/stddata.fitsz6hdu= was not specified but multiple tables are presentr   Nrw   )	rd  z  *** End of mandatory fields ***rd  rd  z *** Column names ***rd  rd  z *** Column formats ***rd  )r   r   r   r   r   rc   r}   )rf   r   s     r-   test_convert_comment_conventionr  2  s     %%899H	G
 
 
 ! ! Jx  	! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 6* 
" 
" 
" 
 
 
 
 
 
s   AAATc                 z   |r| j         |j         u sJ g d}||z   D ]}| }|}|                    d          D ]C}	 t          ||          }t          ||          }$# t          $ r ||         }||         }Y @w xY w|dk    r|i }|i }t	          |t
          j                  r%|j        j        dk    rt          ||d          sJ t	          |t
          j                  r<t          r|j        r|j        |j        k    sJ t          j        ||d          sJ t          j        ||k              sJ d S )	N)z	info.namezinfo.formatz	info.unitzinfo.description	info.metaz
info.dtype.r  r   gV瞯<)rtolsafe)casting)	__class__splitgetattrAttributeErrorr'   r2   r3   r4   r5   quantity_allcloser   rA   can_castr=   )	obj1obj2attrscompare_class
info_attrsattra1a2subattrs	            r-   assert_objects_equalr  J  s    0~////  J 
" $ $zz# 	! 	!G!R))R))! ! ! ![[! ;zzb"*%% 	$"(-3*>*>$R%8888888BH%% 
	$  ; ;x28+++++{2r6:::::::6"(######?$ $s    AA98A9c                 l   | dz  }t          t                    }t          d |D             |          }|                    |d           t	          j        |dd          }|j        |j        k    sJ |j                                        D ]\  }}||         }t          |t                    r|j        |_        t          |         }d}	t          |j        t                    r<t          |          t           u sJ dg}d	}	t#          j        |j        |k              sJ t)          ||||	           d
S )zWTest writing as QTable and reading as Table.  Ensure correct classes
    come out.
    rn   c                 (    g | ]}t           |         S r&   r   r*   r+   s     r-   
<listcomp>z4test_fits_mixins_qtable_to_table.<locals>.<listcomp>  s    333T
4 333r/   r   r   r"   Tr"   astropy_nativer   FN)sortedr   r   rb   r   rc   colnamesr   itemsr'   r   r"   r   infor   typer   r2   r=   r    r  )
re   rf   rA   r   rh   r+   r,   col2r  r  s
             r-    test_fits_mixins_qtable_to_tabler  x  sG    ,,H:E33U3335AAAAGGHVG$$$	HVD	A	A	AB:$$$$Y__&& > >	c$x dD!! 	%*DKd#ch-- 	-::''''HE!M6#)t+,,,,,S$}====)> >r/   	table_clsc                    |dz  }t          t                    }g }t          t                    D ]E}|                    t          t          |         t                    r|gnt
          |                    F | d |D             |          }d|j        d<   g d|j        d<   g d|j        d	<   |                    |d
           |                     |d
d          }|j        d         dk    sJ |j        d         g dk    sJ |j        d         g dk    sJ |j	        |j	        k    sJ t          j        |          5 }|d         j        j        |k    sJ 	 ddd           dS # 1 swxY w Y   dS )zGTest write/read all cols at once and validate intermediate column namesrn   c                 (    g | ]}t           |         S r&   r  r  s     r-   r  z+test_fits_mixins_as_one.<locals>.<listcomp>  s    666:d#666r/   r   rq   rr   )rs   rt   r>   rv   rw   rx   historyr   r  Tr  r|   rG   N)r  r   extendr'   r   r   r}   rb   rc   r  r   r   r   rA   )	r  re   rf   rA   all_serialized_namesr+   r   rh   r<  s	            r-   test_fits_mixins_as_oner    s    ,,H:Ez"" 
 
## D!1488TTFF>Nt>T	
 	
 	
 	
 		66666eDDDAAF3K777AF:444AF9GGHVG$$$		E	EB73<6!!!!7:"@"@"@@@@@79!=!=!=====:$$$$ 
8		 =Aw$(<<<<<<= = = = = = = = = = = = = = = = = =s   E((E,/E,name_colc                    |dz  }|\  }}ddg} | |||gd|dg          }d||         j         _        t          t          d                    d	d
id||         j         _        |j        st          j        d           |                    |d           | 	                    |dd          }t          |t                    r|j        ||         _        |j        |j        k    sJ |j        D ]3}	|	dv rdgnt          |	         }
t          ||	         ||	         |
           4|                    d          rJ||         j        j        j        t(          j        u sJ ||         j        j        j        t(          j        u sJ dS dS )z<Test write/read one col at a time and do detailed validationrn   r   r   r  r  r   zmy 


 description2   r>   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)rU   r   z7column is not a mixin (e.g. Quantity subclass in Table)r   r  Tr  )r  r  rY   tmN)r  descriptionrU   r~   r}   has_mixin_columnsr   skiprb   rc   r'   r   r"   r  r   r  
startswith_timejd1r  r2   r3   jd2)r  r  re   rf   r+   r,   rL   r   rh   colnamecompares              r-   test_fits_mixins_per_columnr    s    ,,HID#	c
A	1c1+dD$%7888A6AdGL!%eBii3	:JKKAdGL OMNNNGGHVG$$$		E	EB#t %*4:$$$$: ? ?%556((=;QQwZGg>>>> t :$x~!+rz9999$x~!+rz9999: :99r/   zcolumn type unsupported)reasonc                 j    |dz  }|\  }}t          |g|g                              |d           d S )Nrn   r   r   r  )r   rb   )r[   r  re   rf   r+   r,   s         r-   test_fits_unsupported_mixinr    sH    
 ,,HID#	3%v$$Xf$=====r/   c                 d   | dz  }t          ddgg          }d|d         _        d|d         _        ddi|d         j        d	<   |                    |d
           t          j        |          }|d         j        dk    sJ |d         j        dk    sJ |d         j        d	         ddik    sJ dS )zmEven if there are no mixin columns, if there is metadata that would be lost it still
    gets serialized
    r  r   r   hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellor  z{:8.4f}r?   rL   r>   Tr_   N)r   r  r"   r}   rb   rc   )re   rf   r   rh   s       r-   #test_info_attributes_with_no_mixinsr    s     +%HSzlA(AfI AfI*AfIN3GGHG%%%	H		Bf:!\1111f:	))))f:?3C:------r/   rL  )set_colsrA   classc                    | dz  }t          d          }g d|d<   |dk    r<|                                D ]}d|j        j        d<   |                    |           n@|d	k    r|                    |ddddd
           n|dk    r|                    |d           t          j        |          }|j        du sJ |j        |j        k    sJ |j        D ]}t          j
        ||         j        ||         j        k              sJ t          j
        ||         ||         k              sJ d||         _        d||         _        t          j
        ||         ||         k              sJ dS )z
    Same as previous test but set the serialize_method to 'data_mask' so mask is
    written out and the behavior is all correct.
    r  Tr   )rG   rH   rI   rM   r  	data_maskr   rA   rK   )serialize_methodr  FN)r   itercolsr  r	  rb   r   rc   r   r  r2   r=   r   )re   rL  rf   r   r,   rh   r+   s          r-   +test_round_trip_masked_table_serialize_maskr    s    +%HD!!!A YYAcF::<< 	< 	<C0;CH%f--		7			    	  	 	
 	
 	
 	
 
7			;777	H		B9;!*$$$$ + +vbhmqw|344444vbh!D')***** $4vbh!D')******+ +r/   c                 *   | dz  }t          t          ddgdd          g          }ddg|j        d	<   t          |j                  dk    sJ |                    |           t          |j                  dk    sJ |j        d	         ddgk    sJ d S )
Nr  rG   rH   r>   rq   )r  )rY   r?   rw   )r   r   r}   r   rb   )re   rf   r   s      r-   test_meta_not_modifiedr  #  s    +%HFAq63F;;;<===AsAF:qv;;!GGHqv;;!6*#s++++++r/   c                  6    t          j        ddd          rJ dS )zCRegression test for https://github.com/astropy/astropy/issues/14305rd  zfoo.barN)r   is_fitsr&   r/   r-   test_is_fits_gh_14305r  -  s"    r9d3333333r/   )T)Qr   rJ  numpyr2   r   numpy.testingr   r   astropyr   r6   
astropy.ior   astropy.io.fitsr   r   r	   r
   r   r   astropy.io.fits.columnr   r   r   astropy.io.tests.mixin_columnsr   r   r   astropy.tabler   r   r   astropy.table.table_helpersr   astropy.timer   astropy.unitsr   r  astropy.units.format.fitsr   astropy.units.quantityr   astropy.utils.compatr   astropy.utils.datar   astropy.utils.exceptionsr   r   astropy.utils.miscr   r(   r  r9   rB   rD   r5  r  r  r2  r3  r  r  r  r  r  r  r  r  r  r  r  rU   r  xfailr  r  r  r  r  r&   r/   r-   <module>r#     s   				       = = = = = = = =                                    
 W V V V V V V V V V / / / / / / / / / / 4 4 4 4 4 4       7 7 7 7 7 7 4 4 4 4 4 4 / / / / / / . . . . . . 4 4 4 4 4 4 R R R R R R R R 9 9 9 9 9 9 ?>>
 %Z%''  
 
%Z%''
 
 
  /z/11  

E E EWJ WJ WJ WJ WJ WJ WJ WJtJ) J) J) J) J) J) J) J)Z; ; ; 9 9 9    	 	; ;	 	; "  	 	E E	 	E 	 	 	 1 1 1@ @ @3 3 3$9 9 9.$ $ $$  0+$ +$ +$ +$\"> "> ">J ufo66= = 76=: TT*:**:*<*<%=%=>>ufo66: : 76 ?>:> %5%;%;%=%=>>344> > 54 ?>>. . ." #A#A#ABB(+ (+ CB(+V, , ,4 4 4 4 4r/   