
[c           @   s*  d  d l  Z  d  d l m Z m Z d  d l m Z d  d l Z d  d l Z d  d l Z d  d l	 Z
 d d l m Z d d l m Z m Z d d l 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 d d l m  Z  m! Z! y d  d l" Z" Wn e# k
 r5e$ Z% n Xe& Z% y d  d l' Z' Wn e# k
 ree$ Z( n Xe& Z( e j) j* d e& e$ i e$ d 6i e& d 6d g  d    Z+ d   Z, d   Z- e j) j* d e& e$ d g  d    Z. e j) j* d e& e$ d g  d    Z/ e j) j* d e& e$ d g  d    Z0 d   Z1 d   Z2 d   Z3 d   Z4 d   Z5 d   Z6 e j) j* d e& e$ d g  d    Z7 e j) j* d e& e$ d g  d     Z8 e j) j* d e& e$ d g  d!    Z9 e j) j* d e& e$ d g  d"    Z: e e;  d#    Z< e j) j* d e& e$ d g  d$    Z= e j) j* d e& e$ d g  d%    Z> e j) j* d e& e$ d g  d&    Z? d'   Z@ d(   ZA d)   ZB d*   ZC d+   ZD d,   ZE d-   ZF e j) j* d e& e$ d g  d.    ZG e j) j* d e& e$ d g  d/    ZH e j) j* d e& e$ d g  d0    ZI d1   ZJ e j) j* d e& e$ d g  d2    ZK e j) j* d e& e$ d g  d3    ZL e j) j* d e& e$ d g  d4    ZM e j) j* d e& e$ d g  d5    ZN d6   ZO e j) j* d e& e$ d g  d7    ZP d8   ZQ d9   ZR d:   ZS d;   ZT e j) j* d e& e$ d g  d<    ZU e j) j* d e& e$ d g  d=    ZV eW d>  ZX d?   ZY d@   ZZ e j) j* d e& e$ d g  dA    Z[ dB   Z\ dC   Z] dD   Z^ dE   Z_ dF   Z` dG   Za e j) jb dH  dI    Zc dJ   Zd dK   Ze dL   Zf e j) j* dM e$ d g  dN    Zg dO   Zh e j) j* d e& e$ d g  dP    Zi dQ   Zj e j) jk dR  dS    Zl dT   Zm dU   Zn dV   Zo dW   Zp dX   Zq dY   Zr e j) jk dZ  e j) j* d[ d\ d] d^ g  d_     Zs d`   Zt d S(a   iN(   t   BytesIOt   open(   t   OrderedDicti   (   t   six(   t   zipt	   cStringIOi   (   t   ascii(   t   Table(   t   Uniti   (   t   raisest   assert_equalt   assert_almost_equalt   assert_truet   setup_functiont   teardown_functioni   (   t   core(   t   _probably_htmlt   get_read_tracet   fast_readert   use_fast_convertert   forcec         C   sQ   d } t  j d d d g d d d |  d	 t } | d j j | k sM t  d
 S(   s   
    Test reading an extremely large integer, which falls through to
    string due to an overflow error (#2234). The C parsers used to
    return inf (kind 'f') for this.
    Kind should be 'S' in Python2, 'U' in Python3.
    t   St   Ut   at   1i'  t   formatt   basicR   t   guessN(   R   R   (   R   t   readt   Falset   dtypet   kindt   AssertionError(   R   t   expected_kindt   dat(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_convert_overflow)   s    	c          C   s   t  j d d g d d }  t |   d k s3 t  |  j d d g k sN t  t  j d d g d d }  t |   d k s t  |  j d d g k s t  t  j d	 d
 g d d }  t |   d k s t  |  j d d g k s t  d S(   sr   
    Make sure reading a table with guess=True gives the expected result when
    the names arg is specified.
    s   1,2s   3,4t   namesR   t   bi   s   c,di   s   c ds   e fN(   R   R%   (   R   R%   (   R   R%   (   R   R   t   lenR    t   colnames(   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_guess_with_names_arg8   s    c          C   s  t  j d d g d d }  t |   d k s3 t  |  j d d g k sN t  t  j d d g d d d d }  t |   d k s t  |  j d	 d
 g k s t  t  j d d g d t  j }  t |   d k s t  |  j d d g k s t  t  j d d g d d d t  j }  t |   d k s/t  |  j d	 d
 g k sJt  t j d d g d d }  t |   d k s}t  |  j d d g k st  t j d d g d d d d }  t |   d k st  |  j d	 d
 g k st  d S(   su   
    When the format or Reader is explicitly given then disable the
    strict column name checking in guessing.
    s   1,2s   3,4R   R   i   R   t   2R$   R   R%   t   Readers   ascii.basicN(   R   R%   (   R   R%   (   R   R%   (   R   R   R&   R    R'   t   BasicR   (   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_guess_with_format_argQ   s$    !$!c         C   sA   t  j t  , t j d d g d d d t d |  } Wd QXd S(	   s?   
    Test that a bad value of `names` raises an exception.
    s   c ds   e fR$   R   R   R   N(   R   (   t   pytestR	   t
   ValueErrorR   R   R   (   R   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_read_with_names_argp   s    c         C   s7  x0t    D]%} | j d  r7 d j | d  GHq
 n  d j | d  GHx t t f D] } | d j   } d | k r | | d <n  d | k r d j | d j  t j k r d	 | k r |  | d
 <q n  t	 j
 | d |  } t | j j | d  x/ | j j D]! } t t | |  | d  qWqV Wq
 Wd  S(   Nt   skips   

******** SKIPPING {}t   names   

******** READING {}t   optsR   R*   s   fast_{0}t   InputterR   t   colst   nrows(   t   get_testfilest   getR   t   TrueR   t   copyt   _format_nameR   t   FAST_CLASSESR   R   R
   R   R$   R&   (   R   t   testfileR   t	   test_optst   tablet   colname(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_read_all_filesy   s"    c         C   sM  xFt    D];} | j d  r7 d j | d  GHq
 n  d j | d  GHx t t f D] } | d j   } d | k r | | d <n  d | k r d j | d j  } | d =n d	 } d
 j |  t j k r |  | d <n  t	 j
 | d d | | } t | j j | d  x/ | j j D]! } t t | |  | d  qWqV Wq
 Wd  S(   NR0   s   

******** SKIPPING {}R1   s   

******** READING {}R2   R   R*   s	   ascii.{0}R   s   fast_{0}R   R   R4   R5   (   R6   R7   R   R8   R   R9   R:   R   R;   R   R   R
   R   R$   R&   (   R   R<   R   R=   R   R>   R?   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_read_all_files_via_table   s&    
c             s  xt    D]}  |  j d  r7 d j |  d  GHq
 n  |  d j d t  sS q
 n  d j |  d  GHx d d d	 g g  f D]   t   f d
   |  d j   D  } t j |  d d t | } t | j	 j
 |  d  x/ | j	 j
 D]! } t t | |  |  d  q Wq{ Wq
 Wd  S(   NR0   s   

******** SKIPPING {}R1   R2   R   s   

******** READING {}R*   t	   delimitert	   quotecharc         3   s-   |  ]# \ } } |   k r | | f Vq d  S(   N(    (   t   .0t   kt   v(   t   filter_read_opts(    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pys	   <genexpr>   s    	R4   R5   (   R6   R7   R   R8   t   dictt   itemsR   R   R
   R   R$   R&   (   R<   t
   guess_optsR>   R?   (    (   RG   s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_guess_all_files   s    &c          C   s^   t  j d d t  j }  x? |  j D]4 } | d k } t j |  | j | k  s" t  q" Wd S(	   s;   Test that INDEF is correctly interpreted as a missing values   t/daophot2.datR*   t   OTIMEt   MAGt   MERRt   XAIRMASSN(   RL   RM   RN   RO   (   R   R   t   DaophotR'   t   npt   allt   maskR    (   R>   R?   t
   mask_value(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_daophot_indef   s    c          C   s   t  j d d t  j }  |  d j j d k s4 t  |  d j j d k sP t  |  d j j d k sl t  |  d j j d	 k s t  d
 S(   s   
    Test specific data types which are different from what would be
    inferred automatically based only data values.  DAOphot reader uses
    the header information to assign types.
    s   t/daophot2.datR*   t   LIDt   fdRM   t   PIERt   USt   IDt   ilN(   R   R   RP   R   t   charR    (   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_daophot_types   s
    c          C   s   t  j d d t  j }  d d d f } |  j d } xW | D]O \ } } } } | | } t | d |  t | d |  t | d |  q; Wd  S(   Ns   t/daophot.datR*   t	   NSTARFILEs
   test.nst.1t   filenames   %-23st   REJFILEs   "hello world"t   SCALEs   1.s	   units/pixs   %-23.7gt   keywordst   valuet   unitsR   (   R^   s
   test.nst.1R_   s   %-23s(   R`   s   "hello world"R_   s   %-23s(   Ra   s   1.s	   units/pixs   %-23.7g(   R   R   RP   t   metaR
   (   R>   t   expected_keywordsRb   R1   Rc   Rd   t   format_t   keyword(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_daophot_header_keywords   s    	
c          C   s   t  j d d t  j }  d |  j k s- t  |  d d d k sG t  |  d d d k sa t  t j |  d	 d
 k  s t  d  S(   Ns   t/daophot3.datR*   t   MAG5i   gzG!6@t   MERR2i    g#~j?t   RAPERT5gL7@(   R   R   RP   R'   R    RQ   RR   (   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_daophot_multiple_aperture   s
    c          C   s   t  j d d t  j }  d |  j k s- t  |  d d d k sG t  |  d d d k sa t  t j |  d	 d
 k  s t  d  S(   Ns   t/daophot4.datR*   t   MAG15i   gnJRk   i    gJ+?Rl   g      @(   R   R   RP   R'   R    RQ   RR   (   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_daophot_multiple_aperture2   s
    c         C   sA   t  j t j  ) t j d d t j d t d |  } Wd  QXd  S(   Ns   t/no_data_without_header.datR*   R   R   (   R-   R	   R   t   InconsistentTableErrorR   t   NoHeaderR   (   R   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_empty_table_no_header   s    c      
   C   s8   t  j t j    t j d d t d |  } Wd  QXd  S(   Ns   t/simple.txtR   R   (   R-   R	   R   Rp   R   R   (   R   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_wrong_quote   s    c         C   s2   t  j t j   t j d d |  } Wd  QXd  S(   Ns	   t/bad.txtR   (   R-   R	   R   Rp   R   (   R   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_extra_data_col   s    c      
   C   s8   t  j t j    t j d d d d |  } Wd  QXd  S(   Ns   t/simple5.txtRB   t   |R   (   R-   R	   R   Rp   R   (   R   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_extra_data_col2   s    c          C   s   t  j d  }  d  S(   Nt   does_not_exist(   R   R   (   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_missing_file  s    c         C   s>   d } t  j d d | d	 d
 d |  } t | j j |  d  S(   Nt   c1t   c2t   c3t   c4t   c5t   c6s   t/simple3.txtR$   RB   Ru   R   (   Ry   Rz   R{   R|   R}   R~   (   R   R   R
   R   R$   (   R   R$   t   data(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_set_names
  s    	c      
   C   sJ   d } d } t  j d d | d	 | d
 d d |  } t | j j |  d  S(   NRy   Rz   R{   R|   R}   R~   s   t/simple3.txtR$   t   include_namesRB   Ru   R   (   Ry   Rz   R{   R|   R}   R~   (   Ry   R{   (   R   R   R
   R   R$   (   R   R$   R   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_set_include_names  s
    c         C   s>   d } t  j d d | d d d |  } t | j j d  d  S(   Nt   Yt   objects   t/simple3.txtt   exclude_namesRB   Ru   R   t   obsidt   redshiftt   Xt   rad(   R   R   (   R   R   R   R   (   R   R   R
   R   R$   (   R   R   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_set_exclude_names  s    	c          C   s2   d }  t  j d d |  } t | j j |   d  S(   NRZ   RM   RX   s   t/daophot.datR   (   RZ   RM   RX   (   R   R   R
   R   R$   (   R   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_include_names_daophot#  s    c          C   s2   d }  t  j d d |  } t | j j d  d  S(   NRZ   t   YCENTERRN   t   NITERt   CHIt   PERRORs   t/daophot.datR   t   XCENTERRM   t   MSKYt	   SHARPNESSRX   (   RZ   R   RN   R   R   R   (   R   RM   R   R   RX   (   R   R   R
   R   R$   (   R   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_exclude_names_daophot)  s    c          C   s`   d   }  t  j d d  } |  | j _ | j d  } t | j j d  t t |  d  d  S(   Nc         S   sZ   t  j d t  j  } d   |  D } g  | D]* } t |  d k r, | j d |  ^ q, S(   Ns	   ^\| | \|$c         s   s   |  ] } | j    Vq d  S(   N(   t   strip(   RD   t   x(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pys	   <genexpr>2  s    i    t    (   t   ret   compilet   VERBOSER&   t   sub(   t   linest   bars_at_endst
   striplinesR   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   process_lines0  s    RB   Ru   s   t/bars_at_ends.txtR   R   R   R   R   R   i   (   R   R   R   R   R   R   (	   R   t
   get_readert   inputterR   R   R
   R   R$   R&   (   R   t   readerR   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_custom_process_lines/  s    	c          C   sy   d   }  t  j d d d d  } |  | j j _ |  | j j _ | j d  } t d  d } t | j	 j
 | d  d  S(	   Nc         S   s   t  j d d |  j    } | S(   Ns   ^\|\s*R   (   R   R   R   (   t   linet   line_out(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   process_line<  s    t
   data_starti   RB   Ru   s   t/nls1_stackinfo.dboutR4   i   (   R   R   t   headert   splitterR   R   R   R6   R
   R   R$   (   R   R   R   R4   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_custom_process_line;  s    	c          C   s  t  j   }  t  j   |  j _ t  j   |  j _ d } |  j |  } t |  } t | j	 j
 | d  t t |  | d  t | j d  d d  t | j d  d d  t | j d	  d d
  t | j d  d d  t | j d  d d  d  S(   Ns   t/test4.datR4   R5   s   zabs1.nhi   giT ?s   p1.gammagÝ(?s   p1.amplgZ*2F?t   statnamet
   chi2modvart   statvalg-@(   R   R   t   BaseSplitterR   R   R   R   R6   R
   R   R$   R&   R   t   field(   R   t   fR   R<   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_custom_splittersG  s    c          C   sl   t  j d d d d d d d }  t t |   d  t |  j d	  d
 d  t |  j d	  d d  d  S(   Ns   t/test5.datt   header_starti   R   i   t   data_endii   R   i    t   chi2xspecvarit   chi2gehrels(   R   R   R
   R&   R   (   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_start_endW  s    !c          C   s   i t  j d  t  j d  g d 6t  j d  g d 6}  t  j d d |  } t t | d j  d  t | d d d	  d  S(
   Nt   int32t   float32s   zabs1.nht   strs   p1.gammas   t/test4.datt
   convertersi    s   1.26764500000(   R   t   convert_numpyR   R
   R   R   (   R   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_set_converters^  s    c         C   s   d } t  |   } | j   } Wd  QXt |  } t j | d |  | d } t | j j | d  t t |  | d  d  S(   Ns   t/simple.txtR   R2   R4   R5   (   R   R   R6   R   R
   R   R$   R&   (   R   R   RW   R>   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_from_stringh  s    c      
   C   sx   d } t  |  } t | d  # } t j | d |  | d } Wd  QXt | j j | d  t t |  | d  d  S(   Ns   t/simple.txtt   rbR   R2   R4   R5   (   R6   R   R   R   R
   R   R$   R&   (   R   R   R<   RW   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_from_filelikes  s    "c         C   s   d } t  |   } | j   } Wd  QXt |  } t j | d |  | d } t | j j | d  t t |  | d  d  S(   Ns   t/simple.txtR   R2   R4   R5   (	   R   t	   readlinesR6   R   R   R
   R   R$   R&   (   R   R   RW   R>   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_from_lines}  s    c          C   sX   t  j d t  j  }  |  j d  } t |  j d d g  t | j d d d g  d  S(   NR*   s   t/apostrophe.rdbs   # first comments     # second commentt   commentss   first comments   second comment(   R   R   t   RdbR   R
   t   comment_linesRe   (   R>   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_comment_lines  s    c         C   s   d } t  |  } t j | d d
 d |  | d } t | d j t t g k j    t | d d d g k j    t | d j t t g k j    t | d d	 d g k j    d  S(   Ns   t/fill_values.txtt   fill_valuesR   R   R   R2   i   R%   i   (   R   R   (   R6   R   R   R   RS   R   R8   RR   (   R   R   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_fill_values  s    # #c         C   sB   d } t  |  } t j | d d d |  | d } t |  d  S(	   Ns   t/fill_values.txtR   R   R   R%   R   R2   (   R   R   R%   (   R6   R   R   t   check_fill_values(   R   R   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_fill_values_col  s
    c      
   C   sK   d } t  |  } t j | d d	 d |  d d g | d } t |  d  S(
   Ns   t/fill_values.txtR   R   R   R   t   fill_include_namesR%   R2   (   R   R   (   R6   R   R   R   (   R   R   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_fill_values_include_names  s
    c      
   C   sK   d } t  |  } t j | d d d |  d d g | d } t |  d  S(	   Ns   t/fill_values.txtR   R   R   R   t   fill_exclude_namesR2   (   R   R   (   R6   R   R   R   (   R   R   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_fill_values_exclude_names  s
    c         C   s   t  |  d j t t g k j    t  |  d d d g k j    t  |  d j t t g k j    t  |  d d d g k j    t |  d _ t  |  d d d g k j    d S(   s0   compare array column by column with expectation R   R   R%   i   ii   N(   R   RS   R   RR   R8   (   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyR     s    # # c         C   sk   d } t  |  } t j | d d	 d
 g d |  | d } t | d _ t | d d d g k j    d  S(   Ns   t/fill_values.txtR   R   t   42R   R   R2   i*   (   R   R   (   R   R   R   (   R6   R   R   R   RS   R   RR   (   R   R   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_fill_values_list  s    c          C   sW   d }  t  |   } t j |  | d  } t | d j d  t | d j d  d  S(   Ns	   t/cds.datR2   t   AKi    t   Fit(   R6   R   R   R   RS   (   R   R<   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_masking_Cds  s    	c       	   C   s   d }  t  |   } t j |  | d  } t j t t t t t f t t t t t f g d t d  d f t d  d f t d  d f t d  d f t d	  d f g } t j | j	 | k  s t
  d  S(
   Ns
   t/ipac.datR2   R   t   ras   |b1t   dect   sait   v2t   sptype(   R6   R   R   RQ   t   arrayR8   R   R   RR   RS   R    (   R   R<   R   RS   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_null_Ipac  s    c          C   s   t  d d d d f  }  d	 g } d
 } t |  } t j | | d  } | j d j   |  j   k sn t  xF t | j d j   |  j    D]" \ } } | d | k s t  q W| j d | k s t  d  S(   Nt   intvali   t   floatvalg     @t   dates   Wed Sp 20 09:48:36 1995t   key_continues'   IPAC keywords can continue across liness%   This is an example of a valid comments
   t/ipac.datR2   Rb   Rc   R   (   R   i   (   R   g     @(   R   s   Wed Sp 20 09:48:36 1995(   R   s'   IPAC keywords can continue across lines(	   R   R6   R   R   Re   t   keysR    R   t   values(   Rb   R   R   R<   R   t   data_kvt   kv(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_Ipac_meta  s    	%/c          C   sO   t  j d d d d t }  |  j j d k s3 t  t |   d k sK t  d S(	   sL   Read a file using guess with one of the typical guess_kwargs explicitly set.s   t/space_delim_no_header.datRB   t   ,R   s   1 3.4 helloi   N(   s   1 3.4 hello(   R   R   R8   R   R$   R    R&   (   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_set_guess_kwarg  s    c      
   C   s<   d } t  j t  ! t j | d t j d |  Wd QXd S(   s8   Read RDB data with inconstent data type (except failure)s   col1	col2
N	N
1	HelloR*   R   N(   R-   R	   R.   R   R   R   (   R   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_read_rdb_wrong_type  s    c         C   s  d j  d d d g  } t j | d |  } | j t k sB t  | j   d d d d	 g k sf t  d
 } t j | d |  } | j   d d d g k s t  | d j j d k s t  d j  d d d d g  } t j | d t j	 } | j t k st  | j   d d d d	 g k s*t  t j | d t j	 d d } | j t k s]t  | j   d d d d g k st  t j | d t j	 d g  } | j t k st  | j   d d d d g k st  d S(   sO   Read a table with empty values and ensure that corresponding entries are maskeds   
s   a,b,c,ds   1,3,,s   2, , 4.0 , ss R   s    a   b   c   d s   --- --- --- ---s     1   3  --  --s     2  -- 4.0  sss    a 
 "" s    a s   ---s    --R   t   is     1   3        s     2     4.0  ssR*   R   N(   t   joinR   R   t   maskedR8   R    t   pformatR   R   t   FixedWidthTwoLinet   NoneR   (   R   R>   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_default_missing  sJ    		c      *   C   s  i d d 6d d 6d d 6i t  j d	 6d
 6i d d 6d d 6d d 6i t  j d	 6d
 6i d d 6d d 6d d 6i t  j d	 6d
 6i d d 6d d 6d d 6i t  j d	 6d d 6d
 6i d d 6d  d 6d d 6i t  j d	 6d
 6i d d 6d! d 6d d 6i t  j d	 6d" d# 6d
 6i d d 6d) d 6d d 6i t  j d* 6t  j d	 6d
 6i d d 6d6 d 6d d 6i t  j d	 6d
 6i d d 6d= d 6d> d 6i t  j d	 6d
 6i d d 6dD d 6d d 6i t  j	 d	 6d
 6i d d 6dV d 6dW d 6i d d 6dX dY 6t
 d 6d
 6i d d 6dZ d 6d[ d 6i t  j d	 6d
 6i d d 6d\ d 6d[ d 6i t  j d	 6d
 6i d d 6d_ d 6d[ d 6i t  j d	 6d
 6i d d 6d` d 6d[ d 6i t  j	 d	 6d
 6i d d 6dD d 6d d 6i t  j	 d	 6d? dB g da 6d
 6i d d 6db d 6d[ d 6i  d
 6i d d 6dc d 6dd d 6i t  j d	 6d
 6i d d 6de d 6dd d 6i t  j d	 6d
 6i d d 6dj d 6d d 6i dk dl 6d
 6i d d 6dj d 6d d 6i dk dl 6d d# 6d d 6d
 6i d d 6dj d 6d d 6i dk dl 6d d# 6d
 6i d d 6dj d 6d d 6i dk dl 6d d# 6d d 6d
 6i d d 6dv d 6d> d 6i dX dY 6d
 6i d d 6dw d 6d d 6i dX dY 6d
 6i d d 6dy d 6d> d 6i t  j d	 6dX dY 6d
 6i d d 6dz d 6d d 6i t  j d	 6d
 6i d d 6dz d 6d d 6i t  j d	 6d d# 6d
 6i d d 6d d 6d> d 6i  d
 6i d d 6d d 6d d 6i  d
 6i d d 6d d 6d d 6i d dY 6d
 6i d d 6d d 6d d 6i d dY 6d
 6i d d 6d d 6d d 6i t  j d	 6d
 6i d d 6d d 6d d 6t d 6i t  j d	 6d
 6i d d 6d d 6d d 6i t  j d	 6d
 6i d d 6d d 6d> d 6i t  j d	 6d
 6i d d 6d d 6d d 6i t  j d	 6d
 6i d d 6d d 6d d 6i t  j d	 6d
 6g& } yC d" d l } | j i d d 6d d 6d> d 6i t  j d	 6d
 6 Wn t k
 rn X|  d k	 rg  | D] } | d |  k r| ^ qd[ S| Sd S(   s   Set up information about the columns, number of rows, and reader params to
    read a bunch of test files and verify columns and number of rows.t   agasc_idt   n_noidst   n_obsR4   s   t/apostrophe.rdbR1   i   R5   R*   R2   s   t/apostrophe.tabt   Indext   RAht   RAmt   RAss   DE-t   DEdt   DEmt   DEst   Matcht   ClassR   R   s	   t/cds.dati   s   t/cds_malformed.datR   R   R   R%   t   cs   t/commented_header.dats   t/commented_header2.datiR   t   col1t   col2t   col3t   col4t   col5s   t/continuation.datR3   RZ   R   R   RM   RN   R   R   R   R   RX   R   s   t/daophot.datt   NUMBERt   FLUX_ISOt   FLUXERR_ISOs   VALU-ESs	   VALU-ES_1t   FLAGs   t/sextractor.dati   R   R   R   R   R   s
   t/ipac.datt   col0t   objIDt   osrcidt   xsrcidt	   SpecObjIDR   t   ccdidt   zt
   modelMag_it   modelMagErr_it
   modelMag_rt   modelMagErr_rt   expot   thetat
   rad_ecf_39t   detlim90t   fBlim90s   t/nls1_stackinfo.dbouti:   Ru   RB   s   t/no_data_cds.dati    s   t/no_data_daophot.datt   VALUESt   VALUES_1s   t/no_data_sextractor.dats   t/no_data_ipac.datR   s   t/no_data_with_header.dats   t/short.rdbi   s   t/short.tabs   test 1at   test2t   test3t   test4s   t/simple.txtt   'RC   t   top1t   top2t   top3t   top4R   R   R   R   R   s   t/simple2.txts   t/simple3.txtt   col6s   t/simple4.txts   t/space_delim_no_header.datt   offsetR   t   yt   oaas   t/space_delim_blank_lines.txts   zabs1.nhs   p1.gammas   p1.amplR   R   s   t/test4.dati	   s   t/fill_values.txtR   s   t/whitespace.dats   quoted colname with tab	insides   \ss   t/simple_csv.csvs   t/simple_csv_missing.csvR0   t   colat   colbt   colcs   t/latex1.text   Facilityt   Idt   exposureR   s   t/latex2.texs   t/latex3.text   Col1t   Col2t   Col3t   Col4s   t/fixed_width_2_line.txtNs   Column 1s   Column 2s   Column 3s   t/html.html(   R   R   R   (   R   R   R   (   R   R   R   R   s   DE-R   R   R   R   R   R   R   (   R   R   R   R   s   DE-R   R   R   R   R   R   R   (   R   R%   R   (   R   R%   R   (   R   R   R   R   R   (   RZ   R   R   RM   RN   R   R   R   R   RX   R   (   R   R   R   s   VALU-ESs	   VALU-ES_1R  (   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   R   R   R   s   DE-R   R   R   R   R   R   R   (   RZ   R   R   RM   RN   R   R   R   R   RX   R   (   R   R   R   R  R  R  (   R   R   R   R   R   (   R   R   (   R   R%   R   (   R   R   R   (   R   R   R   (   s   test 1aR  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   R   (   R   R   R   R   R   R  (   R   R   R   (   R   R   R   (   R   R  R   R  R1   R  (   s   zabs1.nhs   p1.gammas   p1.amplR   R   (   R   R%   R   (   s   quoted colname with tab	insideR   R   (   R   R%   R   (   R   R%   R   (   R   R!  R"  (   R#  R$  R%  R   (   R   R!  R"  (   R&  R'  R(  R)  (   s   Column 1s   Column 2s   Column 3(   R   R   t   Tabt   Cdst   CommentedHeadert   ContinuationLinesInputterRq   RP   t
   SExtractort   IpacR   R   t   CsvR8   t   Latext   AASTexR   t   bs4t   appendt   HTMLt   ImportError(   R1   t	   testfilesR3  R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyR6   3  s   

                    


             
                                        























+c       	   C   sm   xf t  j t  j t  j t  j t  j t  j t  j g D]4 }  t j	 t
   t  j j |  d d } Wd QXq1 Wd S(   s   Check certain Readers throw an exception if ``header_start`` is set

    For certain Readers it does not make sense to set the ``header_start``, they
    throw an exception if you try.
    This was implemented in response to issue #885.
    R   i   N(   R   Rq   R.  R/  t
   BaseReadert   FixedWidthNoHeaderR+  RP   R-   R	   R.   R   t   _get_reader(   t   readerclassR   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_header_start_exception5  s    "c          C   s=   d d d g }  t  j |   } | j d d g k s9 t  d S(   sf   
    Check for a regression introduced by #1935.  Pseudo-CSV file with
    commented header line.
    s   # a, bs   1, 2s   3, 4R   R%   N(   R   R   R'   R    (   R   t   t(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_csv_table_readB  s
    	c         C   sF   t  j d d g d d d g d |  } | j d d g k sB t  d S(   s{   
    Check that the names argument list can overlap with the existing column names.
    This tests the issue in #1991.
    s   a bs   1 2R$   R%   R   R   N(   R   R   R'   R    (   R   R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_overlapping_namesN  s    'c       
   C   s   t  j d d t  j d t }  d t d  t d  t d  t d  d t d  t d  t d  g	 } d	 d
 d d d d d d d g	 } xW t |  j  D]F \ } } |  | j | | k s t	  |  | j
 | | k s t	  q Wd S(   sW   
    Make sure that the SExtractor reader correctly inputs descriptions and units.
    s   t/sextractor2.datR*   R   t   pixt   mags   pix**2s   m**(-6)s   mag * arcsec**(-2)s   Running object numbers"   Windowed position estimate along xs"   Windowed position estimate along ys'   Kron-like elliptical aperture magnitudes   RMS error for AUTO magnitudes   Extraction flagss%   Barycenter position along MAMA x axiss(   Peak surface brightness above backgroundN(   R   R   R.  R   R   R   t	   enumerateR'   t   unitR    t   description(   R>   t   expected_unitst   expected_descrsR   R?   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_sextractor_unitsX  s     	c          C   s  t  j d d t  j d t }  d d d d d d	 d
 d d d d d d d d d d d d d g } t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  t d  g } d d# d d d d g d  g d! d" g d! } xt t |  j  D]c \ } } |  | j | | k st	  |  | j
 | | k st	  |  | j | | k sXt	  qXWd# S($   sg   
    Make sure that the SExtractor reader handles the last column correctly when it is array-like.
    s   t/sextractor3.datR*   R   t   X_IMAGEt   Y_IMAGEt   ALPHA_J2000t   DELTA_J2000t   MAG_AUTOt   MAGERR_AUTOt   MAG_APERt
   MAG_APER_1t
   MAG_APER_2t
   MAG_APER_3t
   MAG_APER_4t
   MAG_APER_5t
   MAG_APER_6t   MAGERR_APERt   MAGERR_APER_1t   MAGERR_APER_2t   MAGERR_APER_3t   MAGERR_APER_4t   MAGERR_APER_5t   MAGERR_APER_6R@  t   degRA  s   Object position along xs%   Right ascension of barycenter (J2000)s!   Declination of barycenter (J2000)s'   Kron-like elliptical aperture magnitudes   RMS error for AUTO magnitudes   Fixed aperture magnitude vectori   s(   RMS error vector for fixed aperture mag.N(   R   R   R.  R   R   R   RB  R'   R1   R    RC  RD  (   R>   t   expected_columnsRE  RF  R   R?   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt!   test_sextractor_last_column_arrayn  s    $?E c          C   s   t  j d d d d d g  }  |  j d g k s6 t  t |   d k sN t  |  d d d k sh t  |  d d d	 k s t  d
 S(   sr   
    Check that lists of strings where some strings consist of just a newline
    ("
") are parsed correctly.
    t   abcs   123
s   456
s   
i   i    i{   i   i  N(   R   R   R'   R    R&   (   R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_list_with_newlines  s
    c          C   so   t  j d d d g d d }  |  j d d g k s9 t  t |   d k sQ t  |  d d	 d
 k sk t  d S(   s   
    Check that Csv reader does not have ignore lines with the # comment
    character which is defined for most Basic readers.
    s   #a,bs   1,2s   #3,4R   t   csvs   #aR%   i   i   s   #3N(   R   R   R'   R    R&   (   R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_commented_csv  s    c          C   s\   t  j d d d d g  }  |  j d d d g k s9 t  |  j d d	 d
 g k sX t  d S(   sf   
    Make sure that line comments are included in the ``meta`` attribute
    of the output Table.
    s	   #comment1s   #   comment2 	s   a,b,cs   1,2,3R   R%   R   R   t   comment1t   comment2N(   R   R   R'   R    Re   (   R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_meta_comments  s    c          C   s   t  j t j   }  t j d d d Wd QXd t |  j  k sI t  t  j t   }  t j d d d Wd QXd t |  j  k s t  t  j t  , }  t j d d d d d	 d
 d d t	 Wd QXd t |  j  k s t  d S(   s2   
    Check the error message when guess fails
    s   asfdasdf
1 2 3R   R   Ns@   ** To figure out why the table did not read, use guess=False andt   ipacsE   At least one header line beginning and ending with delimiter requiredRC   t   "RB   t    R   s?   Number of header columns (1) inconsistent with data columns (3)(
   R-   R	   R   Rp   R   R   Rc   R    R.   R   (   t   err(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_guess_fail  s    +s   not HAS_BZ2c          C   s@   t  j t d d   }  |  j d d d d d g k s< t  d S(	   sU   
    Test guessing a file object.  Fixes #3013 and similar issue noted in #3019.
    s   t/ipac.dat.bz2R   R   R   R   R   R   N(   R   R   R   R'   R    (   R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_guessing_file_object  s    c          C   s   d j  d d d g  }  t j |   } t j | j    } t |  t |  k sZ t  | j | j k sr t  x4 | j D]) } t j | | | | k  s| t  q| Wd S(   sE   Check that the screen output of ``print tab`` can be read. See #3025.s   
s   a,b,c,ds
   1,3,1.11,1s   2, 2, 4.0 , ss N(	   R   R   R   R   R&   R    R'   RQ   RR   (   R>   R"   t   outR   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_pformat_roundtrip  s    	c          C   s   d d d g }  t  j |  d d } x4 | j d d !D]" } | | j j d k s5 t  q5 Wx4 | j d d	 !D]" } | | j j d
 k sl t  ql Wx4 | j d	 d !D]" } | | j j d k s t  q Wd  S(   Ns=   | c1 | c2 | c3   |   c4 | c5| c6 | c7  | c8 | c9|c10|c11|c12|s=   | r  | rE | rea  | real | D | do | dou | f  | i | l | da| c |s=     1    2    3       4     5   6    7     8    9   10  11  12 R   Rf  i    i   R   i
   R   i   R   R   (   R   R   (   R   R   t   columnsR   R   R    (   R   R"   R1   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_ipac_abbrev  s    	  c          C   s@   d d d d d g }  t  j |   } t |  d k s< t  d S(   s   Regression test for #3319.
    This tables looks so close to a daophot table, that the daophot reader gets
    quite far before it fails with an AttributeError.

    Note that this table will actually be read as Commented Header table with
    the columns ['some', 'header', 'info'].
    s   # some header infos!   #F header info beginning with 'F's   1 2 3s   4 5 6s   7 8 9i   N(   R   R   R&   R    (   R   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt!   test_almost_but_not_quite_daophot  s    	t   fastc         C   s  d d d g } d d d d d d	 g } t  j | d
 d d |  } | j d | k s[ t  | j d d g k sv t  t   } t  j | | d
 d d |  | j   j   | k s t  | j	 d | j
 d   t  j | d
 d d d d |  } | j d | k st  | j d d g k s't  | j	 d | j
 d   t  j | d
 d d d d |  } | j d | k szt  | j d d g k st  t  j | d
 d d d d |  } | j d | k st  | j d d g k st  | j	 d | j
 d   t  j | d
 d d d d |  } | j d | k s=t  | j d d g k sXt  d d d	 g } t  j | d
 d d |  } d | j k st  | j d d g k st  d S(   s   
    Test that comments in commented_header are as expected with header_start
    at different positions, and that the table round-trips.
    s	   comment 1s	   comment 2s	   comment 3s   # a bs   # comment 1s   # comment 2s   # comment 3s   1 2s   3 4R   t   commented_headerR   R   R   R%   t   fast_writeri   i    R   i   ii   iN(   R   R   Re   R    R'   t   StringIOt   writet   getvaluet
   splitlinest   insertt   pop(   Rq  R   R   R"   Rl  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_commented_header_comments  sD    		!!!!	c          C   s   xS d d d d d d d d d	 d
 d d d g d f
 D] }  t  |   t k s4 t  q4 Wx\ d d d d d d d	 d d d d g d d d d g g f	 D] }  t  |   t k s t  q Wd S(   sW   
    Test the routine for guessing if a table input to ascii.read is probably HTML
    s   t/html.htmls   http://blah.com/table.htmls   https://blah.com/table.htmls   file://blah/table.htms   ftp://blah.com/table.htmls   file://blah.com/table.htms    <! doctype html > hello worlds>   junk < table baz> <tr foo > <td bar> </td> </tr> </table> junks   junk < table baz>s
    <tr foo >s
    <td bar> s   </td> </tr>s   </table> junks    <! doctype html > s    hello worlds   t/html.htmss   Xhttp://blah.com/table.htmls    https://blah.com/table.htms   fole://blah/table.htms    < doctype html > hello worlds=   junk < tble baz> <tr foo > <td bar> </td> </tr> </table> junks	    <t foo >s    <! doctype htm > i   i   i   N(   s    <! doctype html > s    hello world(   s    <! doctype htm > s    hello world(   R   R8   R    R   (   R>   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_probably_html   s*    c         C   s  d d d d d d g i d d 6i d d 6d	 d
 6g f d d d d d d d d d g	 i d d 6d d
 6g f d d d d d d d d g i d d 6d	 d
 6i d	 d
 6g f g } x | D] \ } } x | D] } t  j | d d d |  d t | } | j d d g k st  t |  d k s$t  t j | d d g k  sFt  t   d d d |  t	 k rmt  j
 n t  j k s t  q Wq Wd  S(   Ns	   # commentR   Rh  s   skip this lines   a bs   1 2i   R   i   R   s    	i   i    R   R   R   R   R   R%   it   kwargsR*   (   R   R   R8   R'   R    R&   RQ   RR   R   R   R+   t	   FastBasic(   R   t   testsR   t   kwargs_listR|  R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_data_header_start>  sJ    
"c          C   s  t    }  t j t j   t j |   Wd QXt    }  t j t  & } t j |  d t d t d d Wd QXd t | j	  k s t
  t    }  t j t  & } t j |  d t d t d d Wd QXd t | j	  k s t
  x t   t d t d t d d  t d t d t d d  g D]a } t    }  |  j d	  t j |  |  } | j d
 d g k skt
  t |  d k s"t
  q"Wd S(   s   
    Test that an input file which is completely empty fails in the expected way.
    Test that an input file with one line but no newline succeeds.
    NR   R   R   R   s   No header line foundt
   fast_basics    Inconsistent data column lengthss   a bR   R%   i    (   R    R-   R	   R   Rp   R   R.   R   R   Rc   R    R8   RH   Ru  R'   R&   (   R>   Ri  R|  R=  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_table_with_no_newlinen  s&    		%	%	"	s   not HAS_PATHLIBc          C   s   t  j d  }  t j |   } t |  d k s6 t  t t | j   d d d d g k sc t  | d d d k s} t  d  S(	   Ns   t/simple.txti   s   test 1aR  R  R  i   t   hat2(	   t   pathlibt   PathR   R   R&   R    t   sortedt   listRn  (   t   fpathR   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_path_object  s
    -c          C   s   d }  t  j t    } t j |  d t d d Wd QXd t | j  k sR t  t  j t  3 } t j d d g d t d d	 d
 i g  d 6Wd QXd t | j  k s t  d S(   sr   
    Test that context information (upstream exception message) from column
    conversion error is provided.
    s   | col0   |
| double |
 1  2
R   R   Rf  Ns   Column col0 failed to convert:s   a bs   1 2R   R   R   s   no converters(	   R-   R	   R.   R   R   R   R   Rc   R    (   Rf  Ri  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_column_conversion_error  s    	2c       	   C   s  t  j t  j  }  z y t j   d k rF t  j t  j t d   n t  j t  j t d   xk t t i t d 6i t d 6f D]I } t j	 d d g d d d	 t d
 | } | d j
 j d k s t  q WWn, t  j k
 r } t j d j |   n XWd t  j t  j |   Xd S(   sB   Test code that forces "C" locale while calling fast reader (#4364)t   Darwint   de_DEs
   de_DE.utf8R   s   a bs   1.5 2R   R   R   R   R   R   s   Locale error: {}N(   t   localet	   setlocalet   LC_ALLt   platformt   systemR   R8   R   R   R   R   R   R    t   ErrorR-   R0   R   (   t   currentR   R=  t   e(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt"   test_non_C_locale_with_fast_reader  s     '	$c          C   su   t  d g g d d }  t   } t j |  | d d t j | j   d d d t } | d j d k sq t	  d S(   sX   Test that a char column of a Table is assigned no unit and not
    a dimensionless unit.t   AR$   t   BR   Rf  R   N(
   R   Rt  R   Ru  R   Rv  R   RC  R   R    (   t   t1Rl  t   t2(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_no_units_for_char_columns  s
    	!c             sw   d t  j f d     Y  d t  j f   f d     Y}  t  j d |   } | j d  d d t j j k ss t  d	 S(
   s!   Regression test for #5336, #5338.t
   TestHeaderc           B   s   e  Z d    Z RS(   c         S   sS   g  |  j  D] } t j d |  ^ q
 |  _ x! |  j D] } i d d 6| _ q5 Wd  S(   NR1   t   0s   --(   R$   R   t   ColumnR4   R   (   t   selfR   t   col(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   _set_cols_from_names  s    +(   t   __name__t
   __module__R  (    (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyR    s   t   Testerc              s   e  Z   Z RS(    (   R  R  t   header_class(    (   R  (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyR    s   R*   s   # Column definition is the first uncommented line
# Default delimiter is the space character.
a b c
# Data starts after the header column definition, blank lines ignored
-- 2 3
4 5 6 R   i    N(	   R   t   BasicHeaderR+   R   R   RQ   t   maR   R    (   R  R   (    (   R  s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_initial_column_fill_values  s
    c          C   s   d }  t  j |  d d } | j d d d g k s9 t  t j | d d d g k  s^ t  t j | d d d	 g k  s t  d
 S(   sM   
    Test that latex/aastex file with no trailing backslash can be read.
    s}   
\begin{table}
\begin{tabular}{ccc}
a & b & c \\
1 & 1.0 & c \\ % comment
3\% & 3.0 & e  % comment
\end{tabular}
\end{table}
R   t   latexR   R%   R   R   s   3\%R  N(   R   R   R'   R    RQ   RR   (   R   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt    test_latex_no_trailing_backslash  s
    %c          C   s   d }  t  j |  d d } | j d d d g k s9 t  t j | d d d g k  s^ t  t j | d d d	 g k  s t  d  S(
   Ns   
\begin{deluxetable}{ccc}
\tablehead{\colhead{a} & \colhead{b} & \colhead{c}}
\startdata
1 & 1.0 & c \\
2 & 2.0 & d \\ % comment
3\% & 3.0 & e  % comment
\enddata
\end{deluxetable}
R   t   aastexR   R%   R   R   s   3\%R  (   R   R   R'   R    RQ   RR   (   R   R"   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt!   text_aastex_no_trailing_backslash  s
    
%s   six.PY2t   encodingt   utf8t   latin1t   cp1252c   	      C   s&  i d d 6d d 6} t  |  j d   } x | j   D] \ } } t | d d |  } | j |  Wd  QXt j | d | } | j   d d	 d
 g k s t  xx t	 t
 f D]j } t j | d | d t
 d | d | } | d j j d k s t  | j   d d	 d
 g k s t  q Wq6 Wd  S(   Nu   # à b è 
 1 2 hélloRr  u   à,b,è
1,2,hélloRa  s   test.txtt   wR  s    à   b    è  s   --- --- -----s     1   2 hélloR   R   R   s   èR   (   R   R   RI   R   Ru  R   R   R   R    R8   R   R   R   (	   t   tmpdirR  R   R<   t   fmtt   contentR   R>   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   test_read_with_encoding  s$    
c         C   s   t  j t j  * t j d d t d d d d d d Wd  QXt j r t  j t  * t j d d t d t d d d d	 Wd  QXn  d  S(
   Ns   t/simple3.txtR   R   R   R  R  R   t   fast_csvRa  (	   R-   R	   R   t   ParameterErrorR   R   R   t   PY2R.   (   R  (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt#   test_unsupported_read_with_encoding  s    	(u   R   t   ioR    R   t   collectionsR   R  R  R-   t   numpyRQ   t   externR   t   extern.six.movesR   R   Rt  R   R   R>   R   Rd   R   t   commonR	   R
   R   R   R   R   R   t   uiR   R   t   bz2R6  R   t   HAS_BZ2R8   R  t   HAS_PATHLIBt   markt   parametrizeR#   R(   R,   R/   R@   RA   RK   RU   R]   Ri   Rm   Ro   Rr   Rs   Rt   Rv   t   IOErrorRx   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   R   R   R6   R<  R>  R?  RG  R^  R`  Rb  Re  Rj  t   xfailRk  Rm  Ro  Rp  Rz  R{  R  R  t   skipifR  R  R  R  R  R  R  R  R  (    (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_read.pyt   <module>   s   .

		'	''							''''''	'							
''
'	''	'	'		'
					'
'0 		'
					
					$/	'0	 
			
			*