ó
]¹èZc           @   sF   d  d l  Z d d l m Z d d l m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿNi   (   t   fitsi   (   t   FitsTestCaset   TestNonstandardHdusc           B   s/   e  Z d  „  Z d „  Z d „  Z e d „ Z RS(   c         C   s   |  j  d t ƒ d S(   sÓ   
        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.
        t   compressionN(   t   _test_create_fitshdut   False(   t   self(    (    sE   lib/python2.7/site-packages/astropy/io/fits/tests/test_nonstandard.pyt   test_create_fitshdu
   s    c         C   s   |  j  d t ƒ d S(   s>   Same as test_create_fitshdu but with gzip compression enabled.R   N(   R   t   True(   R   (    (    sE   lib/python2.7/site-packages/astropy/io/fits/tests/test_nonstandard.pyt$   test_create_fitshdu_with_compression   s    c         C   sñ   t  j d ƒ } t j d | ƒ } d | j d <d | j d <t j d | d ƒ } d | j d	 <d
 | j d <t j | | g ƒ } | j |  j d ƒ ƒ t j	 j
 |  j d ƒ ƒ } | j } t | ƒ d k sÒ t ‚ t j | | ƒ j sí t ‚ d S(   s%   Regression test on `FitsHDU.fromfile`id   t   datat   At   TEST1t   Bt   TEST2i   t   Ct   TEST3t   Dt   TEST4s	   test.fitsi   N(   t   npt   arangeR    t
   PrimaryHDUt   headert   ImageHDUt   HDUListt   writetot   tempt   FitsHDUt   fromfilet   hdulistt   lent   AssertionErrort   FITSDifft	   identical(   R   t   at   phdut   imghdut   hdult   fitshdut   hdul2(    (    sE   lib/python2.7/site-packages/astropy/io/fits/tests/test_nonstandard.pyt!   test_create_fitshdu_from_filename   s    	c         C   s…  t  j |  j d ƒ d t ƒ} t  j j | d | ƒ} | j | ƒ | j |  j d ƒ d t ƒ| d =t  j |  j d ƒ ƒ } t	 | d t  j ƒ sš t
 ‚ | d j } t	 | t  j ƒ s¿ t
 ‚ | j d t ƒ | j d t ƒ k sé t
 ‚ | d j | d j k j ƒ  st
 ‚ | d	 j | d	 j k j ƒ  s5t
 ‚ | d
 j | d
 j k j ƒ  s[t
 ‚ | d j | d j k j ƒ  st
 ‚ d  S(   Ns
   test0.fitst   do_not_scale_image_datat   compresss   tmp.fitst	   overwriteiÿÿÿÿt   outputi   i   i   i   (   R    t   openR
   R   R   t   fromhdulistt   appendR   R   t
   isinstanceR   R   R   t   infoR   t   all(   R   R   t	   hdul_origR&   R%   t   wrapped(    (    sE   lib/python2.7/site-packages/astropy/io/fits/tests/test_nonstandard.pyR   -   s    	*&&&(   t   __name__t
   __module__R   R	   R(   R   R   (    (    (    sE   lib/python2.7/site-packages/astropy/io/fits/tests/test_nonstandard.pyR   	   s   				(   t   numpyR   t   ioR    t    R   R   (    (    (    sE   lib/python2.7/site-packages/astropy/io/fits/tests/test_nonstandard.pyt   <module>   s   