
    HR-e	                     B    d dl Zd dlmZ ddlmZ  G d de          ZdS )    N)fits   )FitsTestCasec                   (    e Zd Zd Zd Zd ZddZdS )TestNonstandardHdusc                 2    |                      d           dS )z
        A round trip test of creating a FitsHDU, adding a FITS file to it,
        writing the FitsHDU out as part of a new FITS file, and then reading
        it and recovering the original FITS file.
        FcompressionN_test_create_fitshduselfs    Flib/python3.11/site-packages/astropy/io/fits/tests/test_nonstandard.pytest_create_fitshduz'TestNonstandardHdus.test_create_fitshdu   s!     	!!e!44444    c                 2    |                      d           dS )z>Same as test_create_fitshdu but with gzip compression enabled.Tr	   Nr   r   s    r   $test_create_fitshdu_with_compressionz8TestNonstandardHdus.test_create_fitshdu_with_compression   s!     	!!d!33333r   c                 (   t          j        d          }t          j        |          }d|j        d<   d|j        d<   t          j        |dz             }d|j        d	<   d
|j        d<   t          j        ||g          }|                    |                     d                     t          j	        
                    |                     d                    }|j        }t          |          dk    sJ t          j        ||          j        sJ dS )z%Regression test on `FitsHDU.fromfile`d   )dataATEST1BTEST2r   CTEST3DTEST4z	test.fits   N)nparanger   
PrimaryHDUheaderImageHDUHDUListwritetotempFitsHDUfromfilehdulistlenFITSDiff	identical)r   aphduimghduhdulfitshduhdul2s          r   !test_create_fitshdu_from_filenamez5TestNonstandardHdus.test_create_fitshdu_from_filename   s     IcNNA&&&"G"GAE***"G"G|T6N++TYY{++,,,,''		+(>(>??5zzQ}T5))333333r   Fc                 2   t          j        |                     d          d          }t           j                            ||          }|                    |           |                    |                     d          d           |d= t          j        |                     d                    }t          |d         t           j                  sJ |d         j	        }t          |t           j
                  sJ |                    d	          |                    d	          k    sJ |d
         j        |d
         j        k                                    sJ |d         j        |d         j        k                                    sJ |d         j        |d         j        k                                    sJ |d         j        |d         j        k                                    sJ |                                 |                                 d S )Nz
test0.fitsT)do_not_scale_image_data)compressztmp.fits)	overwriteF)outputr   r         )r   openr   r(   fromhdulistappendr&   r'   
isinstancer*   r%   infoallclose)r   r
   	hdul_origr2   r1   wrappeds         r   r   z(TestNonstandardHdus._test_create_fitshdu.   s   Idii55tTTT	,**9{*KK 	!!!$))J//4@@@bMy:..//$r(DL11111r("'4<00000~~U~++w||5|/I/IIIIIQ
/4466666Q
/4466666Q
/4466666Q
/4466666

r   N)F)__name__
__module____qualname__r   r   r4   r    r   r   r   r   
   sU        5 5 54 4 4
4 4 4*     r   r   )numpyr    
astropy.ior   conftestr   r   rI   r   r   <module>rM      sk              " " " " " "; ; ; ; ;, ; ; ; ; ;r   