a
    ߙfb*	                     @   s4   d dl Zd dlmZ ddlmZ G dd deZdS )    N)fits   )FitsTestCasec                   @   s.   e Zd Zdd Zdd Zdd Zddd	Zd
S )TestNonstandardHdusc                 C   s   | j d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self r   Elib/python3.9/site-packages/astropy/io/fits/tests/test_nonstandard.pytest_create_fitshdu
   s    z'TestNonstandardHdus.test_create_fitshduc                 C   s   | j dd dS )z>Same as test_create_fitshdu but with gzip compression enabled.Tr   Nr   r
   r   r   r   $test_create_fitshdu_with_compression   s    z8TestNonstandardHdus.test_create_fitshdu_with_compressionc                 C   s   t d}tj|d}d|jd< d|jd< tj|d d}d|jd	< d
|jd< t||g}|| d tj	
| d}|j}t|dksJ t||jsJ dS )z%Regression test on `FitsHDU.fromfile`d   )dataAZTEST1BZTEST2r   CZTEST3DZTEST4z	test.fits   N)npZaranger   Z
PrimaryHDUheaderZImageHDUHDUListwritetotempFitsHDUZfromfilehdulistlenZFITSDiffZ	identical)r   aZphduZimghduhdulfitshduZhdul2r   r   r   !test_create_fitshdu_from_filename   s    




z5TestNonstandardHdus.test_create_fitshdu_from_filenameFc                 C   s(  t j| ddd}t jj||d}|| |j| ddd |d= t | d}t|d t jslJ |d j	}t|t j
sJ |jdd	|jdd	ksJ |d
 j|d
 jk sJ |d j|d jk sJ |d j|d jk sJ |d j|d jk sJ |  |  d S )Nz
test0.fitsT)Zdo_not_scale_image_data)compressztmp.fits)Z	overwriteF)outputr   r         )r   openr   r   Zfromhdulistappendr   r   
isinstancer   r   infoallclose)r   r   Z	hdul_origr!   r    wrappedr   r   r   r	   -   s$    

z(TestNonstandardHdus._test_create_fitshduN)F)__name__
__module____qualname__r   r   r"   r	   r   r   r   r   r   	   s   	r   )Znumpyr   Z
astropy.ior    r   r   r   r   r   r   <module>   s   