ó
šßÈ[c           @   së  d  Z  d d l m Z d d l m Z d d l m 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 m Z d d l m Z y  d d l m Z m Z e Z Wn e k
 rÓ e Z n Xe j j d ƒ d „  ƒ Z d „  Z e j j d ƒ d „  ƒ Z e j j d ƒ d „  ƒ Z e j j d ƒ d „  ƒ Z  e j j d ƒ d „  ƒ Z! e j j d ƒ d „  ƒ Z" e j j d ƒ d „  ƒ Z# e j j d ƒ d „  ƒ Z$ e j j d ƒ d „  ƒ Z% e j j d ƒ d „  ƒ Z& e j j d ƒ d „  ƒ Z' e j j d ƒ d „  ƒ Z( d „  Z) e j j d ƒ d  „  ƒ Z* d! „  Z+ e j j d ƒ d" „  ƒ Z, e j j d ƒ d# „  ƒ Z- e j j d ƒ d$ „  ƒ Z. d% „  Z/ d& „  Z0 d' „  Z1 d( „  Z2 d) „  Z3 e j j d ƒ d* „  ƒ Z4 d S(+   sÑ   
This module tests some of the methods related to the ``HTML``
reader/writer and aims to document its functionality.

Requires `BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_
to be installed.
i   (   t   html(   t   corei   (   t   TableiÿÿÿÿNi   (   t   setup_functiont   teardown_functioni   (   t   ascii(   t   ranget	   cStringIO(   t
   HAS_BLEACH(   t   BeautifulSoupt   FeatureNotFounds   not HAS_BEAUTIFUL_SOUPc          C   ss   t  d ƒ }  t j |  ƒ } t | t ƒ s0 t ‚ t | t j ƒ sH t ‚ | d k sZ t ‚ | j |  k so t ‚ d S(   sB   
    Test to make sure the class SoupString behaves properly.
    s1   <html><head></head><body><p>foo</p></body></html>N(   R	   R    t
   SoupStringt
   isinstancet   strt   AssertionErrort   soup(   R   t   soup_str(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_soupstring"   s    c          C   s‹   g  }  t  j |  ƒ } x! t d ƒ D] } | j | ƒ q" Wx d D] } | j | ƒ q@ W|  d d d d d d d	 d
 d d g
 k s‡ t ‚ d S(   sB   
    Test to make sure the class ListWriter behaves properly.
    i   t   abcdei    i   i   i   i   t   at   bt   ct   dt   eN(   R    t
   ListWriterR   t   writeR   (   t   lstt   writert   it   ch(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_listwriter0   s    c          C   sC  t  d ƒ }  t j |  i  d ƒ t k s- t ‚ t j d	 i  d ƒ t k sN t ‚ t  d ƒ j }  t j |  i  d ƒ t k s~ t ‚ t j |  i  d ƒ t k sŸ t ‚ t j |  i d d 6d ƒ t k sÇ t ‚ t j |  i d d 6d ƒ t k sï t ‚ t j |  i d d 6d ƒ t k st ‚ t j |  i d d 6d ƒ t k s?t ‚ d	 S(
   s‚   
    Test to make sure that identify_table() returns whether the
    given BeautifulSoup tag is the correct table to process.
    s   <html><body></body></html>i    s>   <table id="foo"><tr><th>A</th></tr><tr><td>B</td></tr></table>i   i   t   table_idt   bart   fooN(   R	   R    t   identify_tablet   FalseR   t   Nonet   tablet   True(   R   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_identify_table@   s    !!!!(((c          C   s  d d d d d g }  t  j |  d d ƒ} | j t k s? t ‚ t j | d j t t g k ƒ sg t ‚ | d j	 j
 d	 k sƒ t ‚ d d d
 d d g }  t  j |  d d d d g ƒ} | j t k sË t ‚ t j | d j t t g k ƒ só t ‚ | d j	 j
 d	 k st ‚ d S(   s0   
    Test reading a table with missing data
    s   <table>s   <tr><th>A</th></tr>s   <tr><td></td></tr>s   <tr><td>1</td></tr>s   </table>t   formats
   ascii.htmlt   AR   s   <tr><td>...</td></tr>t   fill_valuess   ...t   0N(   s   ...R+   (   R   t   readt   maskedR&   R   t   npt   allt   maskR#   t   dtypet   kind(   t   table_int   dat(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_missing_dataZ   s$    	(	(c          C   sã   d d d d g }  t  j |  d d d d d	 g ƒ} | j d d	 g k sN t ‚ t | ƒ d
 k sf t ‚ t  j |  d d d d d	 g d d	 g ƒ} | j d	 g k s¨ t ‚ t | ƒ d
 k sÀ t ‚ t j | d	 d k ƒ sß t ‚ d S(   s0   
    Test reading a table and renaming cols
    s   <table>s   <tr><th>A</th> <th>B</th></tr>s   <tr><td>1</td><td>2</td></tr>s   </table>R(   s
   ascii.htmlt   namest   BR)   i   t   include_namesi   N(   R   R,   t   colnamesR   t   lenR.   R/   (   R3   R4   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_rename_colsv   s    	!*c          C   s©   d d d d g }  t  j |  d d ƒ} | j d g k s? t ‚ t | ƒ d k sW t ‚ t  j |  d d d	 d
 g ƒ} | j d
 g k s t ‚ t | ƒ d k s¥ t ‚ d S(   s4   
    Test reading a table witn no column header
    s   <table>s   <tr><td>1</td></tr>s   <tr><td>2</td></tr>s   </table>R(   s
   ascii.htmlt   col1i   R6   R   N(   R   R,   R9   R   R:   (   R3   R4   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_no_namesŒ   s    	c          C   sÈ   d d g }  t  j t j ƒ - } t j |  d d d i d d 6d t ƒWd	 QXt | ƒ j d
 ƒ sh t	 ‚ t  j t j ƒ - } t j |  d d d i d d 6d t ƒWd	 QXt | ƒ j d ƒ sÄ t	 ‚ d	 S(   s\   
    Raise an exception with an informative error message if table_id
    is not found.
    s#   <table id="foo"><tr><th>A</th></tr>s   <tr><td>B</td></tr></table>R(   s
   ascii.htmlt   htmldictt   bad_idR   t   guessNs'   ERROR: HTML table id 'bad_id' not foundi   s$   ERROR: HTML table number 3 not found(
   t   pytestt   raisesR   t   InconsistentTableErrorR   R,   R#   R   t   endswithR   (   R3   t   err(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_identify_table_failž   s    	c          C   s£   x` d D]X }  y, t  j d d d d i |  d	 6d
 t ƒ} Wq t k
 r^ |  d k r_ ‚  q_ q Xq Wt j t ƒ + t  j d d d d i d d	 6d
 t ƒWd QXd S(   s   
    Make sure the user can specify which back-end parser to use
    and that an error is raised if the parser is invalid.
    t   lxmlt   xmls   html.parsert   html5libs   t/html2.htmlR(   s
   ascii.htmlR>   t   parserR@   R!   N(   RG   RH   s   html.parserRI   (   R   R,   R#   R
   RA   RB   (   RJ   R%   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_backend_parsers²   s    t   HAS_BEAUTIFUL_SOUPc          C   s6   t  j ƒ  }  t j t j ƒ  |  j g  ƒ Wd QXd S(   s_   
    This should return an OptionalTableImportError if BeautifulSoup
    is not installed.
    N(   R    t   HTMLInputterRA   RB   R   t   OptionalTableImportErrort   process_lines(   t   inputter(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_htmlinputter_no_bs4Ç   s    c          C   sb  d }  t  |  ƒ  } | j ƒ  } Wd QXt j ƒ  } i  | _ d d d d g } g  | j | ƒ D] } t | ƒ ^ q^ | k s‚ t ‚ i d d 6| _ t j t	 j
 ƒ  | j | ƒ Wd QXd	 | j d <d
 d d d g } g  | j | ƒ D] } t | ƒ ^ qç | k st ‚ d | j d <d d d d g } g  | j | ƒ D] } t | ƒ ^ q:| k s^t ‚ d S(   s   
    Test to ensure that HTMLInputter correctly converts input
    into a list of SoupStrings representing table elements.
    s   t/html.htmlNs<   <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>s*   <tr><td>1</td><td>a</td><td>1.05</td></tr>s*   <tr><td>2</td><td>b</td><td>2.75</td></tr>s+   <tr><td>3</td><td>c</td><td>-1.25</td></tr>i   R   t   seconds<   <tr><th>Column A</th><th>Column B</th><th>Column C</th></tr>s*   <tr><td>4</td><td>d</td><td>10.5</td></tr>s*   <tr><td>5</td><td>e</td><td>27.5</td></tr>s+   <tr><td>6</td><td>f</td><td>-12.5</td></tr>i   s*   <tr><th>C1</th><th>C2</th><th>C3</th></tr>s+   <tr><td>7</td><td>g</td><td>105.0</td></tr>s+   <tr><td>8</td><td>h</td><td>275.0</td></tr>s,   <tr><td>9</td><td>i</td><td>-125.0</td></tr>(   t   openR,   R    RM   t	   get_linesR   R   RA   RB   R   RC   (   t   ft   fdR%   RP   t   expectedt   x(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_htmlinputterÓ   s2    		4	4	c          C   sÒ   t  j ƒ  }  t  j t d ƒ j ƒ t  j t d ƒ j ƒ g } d d g d d g g } t |  | ƒ ƒ | k sr t ‚ | j d ƒ t j	 t
 ƒ  t |  | ƒ ƒ Wd QXt j	 t j ƒ  t |  g  ƒ ƒ Wd QXd S(	   sž   
    Test to make sure that HTMLSplitter correctly inputs lines
    of type SoupString to return a generator that gives all
    header and data elements.
    s4   <table><tr><th>Col 1</th><th>Col 2</th></tr></table>s6   <table><tr><td>Data 1</td><td>Data 2</td></tr></table>s   Col 1s   Col 2s   Data 1s   Data 2s'   <tr><td>Data 3</td><td>Data 4</td></tr>N(   R    t   HTMLSplitterR   R	   t   trt   listR   t   appendRA   RB   t	   TypeErrorR   RC   (   t   splittert   linest   expected_data(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_htmlsplitterþ   s    c          C   s}  d }  t  |  ƒ  } | j ƒ  } Wd QXt j ƒ  } i  | _ t j ƒ  } | j | ƒ } t | | j | ƒ ƒ d k s| t ‚ d | j d <| j | ƒ } t | | j | ƒ ƒ d k s½ t ‚ d | j d <| j | ƒ } t | | j | ƒ ƒ d k sþ t ‚ t j	 t
 d	 ƒ j ƒ t j	 t
 d
 ƒ j ƒ g } | j | ƒ d k sIt ‚ | j d ƒ t j t ƒ  | j | ƒ Wd QXd S(   s“   
    Test to ensure that the start_line method of HTMLHeader
    returns the first line of header data. Uses t/html.html
    for sample input.
    s   t/html.htmlNs<   <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>RR   R   s<   <tr><th>Column A</th><th>Column B</th><th>Column C</th></tr>i   s*   <tr><th>C1</th><th>C2</th><th>C3</th></tr>s%   <table><tr><td>Data</td></tr></table>s   <p>Text</p>s   <tr><th>Header</th></tr>(   RS   R,   R    RM   t
   HTMLHeaderRT   R   t
   start_lineR   R   R	   R[   t   pR$   R]   RA   RB   R^   (   RU   RV   R%   RP   t   headerR`   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_htmlheader_start  s.    	c       	   C   sA  d }  t  |  ƒ  } | j ƒ  } Wd QXt j ƒ  } i  | _ t j ƒ  } | j | ƒ } t | | j | ƒ ƒ d k s| t ‚ t | | j	 | ƒ d ƒ d k s¥ t ‚ d | j d <| j | ƒ } t | | j | ƒ ƒ d k sæ t ‚ t | | j	 | ƒ d ƒ d	 k st ‚ d
 | j d <| j | ƒ } t | | j | ƒ ƒ d k sPt ‚ t | | j	 | ƒ d ƒ d k syt ‚ t j
 t d ƒ j ƒ t j
 t d ƒ j ƒ g } t j t j ƒ  | j | ƒ Wd QX| j	 | ƒ d k sêt ‚ | j d ƒ t j t ƒ  | j | ƒ Wd QXt j t ƒ  | j	 | ƒ Wd QXd S(   sŸ   
    Test to ensure that the start_line and end_lines methods
    of HTMLData returns the first line of table data. Uses
    t/html.html for sample input.
    s   t/html.htmlNs*   <tr><td>1</td><td>a</td><td>1.05</td></tr>i   s+   <tr><td>3</td><td>c</td><td>-1.25</td></tr>RR   R   s*   <tr><td>4</td><td>d</td><td>10.5</td></tr>s+   <tr><td>6</td><td>f</td><td>-12.5</td></tr>i   s+   <tr><td>7</td><td>g</td><td>105.0</td></tr>s,   <tr><td>9</td><td>i</td><td>-125.0</td></tr>s   <div></div>s   <p>Text</p>s   <tr><td>Data</td></tr>(   RS   R,   R    RM   t   HTMLDataRT   R   Rd   R   t   end_lineR   R	   t   divRe   RA   RB   R   RC   R$   R]   R^   (   RU   RV   R%   RP   t   dataR`   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_htmldata>  sB    	c          C   s‰   d d d g }  d d d g } d d d g } t  |  | | g d
 d ƒ} d } t j ƒ  j | ƒ d j ƒ  } | | j ƒ  k s… t ‚ d S(   sœ   
    Test to make sure that the HTML writer writes multidimensional
    columns (those with iterable elements) using the colspan
    attribute of <th>.
    i   i   i   g      ð?g       @g      @R   R   R   R6   t   C1t   C2t   C3sl  <html>
 <head>
  <meta charset="utf-8"/>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-type"/>
 </head>
 <body>
  <table>
   <thead>
    <tr>
     <th>C1</th>
     <th colspan="2">C2</th>
     <th colspan="3">C3</th>
    </tr>
   </thead>
   <tr>
    <td>1</td>
    <td>1.0</td>
    <td>1.0</td>
    <td>a</td>
    <td>a</td>
    <td>a</td>
   </tr>
   <tr>
    <td>2</td>
    <td>2.0</td>
    <td>2.0</td>
    <td>b</td>
    <td>b</td>
    <td>b</td>
   </tr>
   <tr>
    <td>3</td>
    <td>3.0</td>
    <td>3.0</td>
    <td>c</td>
    <td>c</td>
    <td>c</td>
   </tr>
  </table>
 </body>
</html>
    i    N(   g      ð?g      ð?(   g       @g       @(   g      @g      @(   R   R   R   (   R   R   R   (   R   R   R   (   Rm   Rn   Ro   (   R   R    t   HTMLR   t   stripR   (   R<   t   col2t   col3R%   RW   t   out(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_multicolumn_writet  s    +s   not HAS_BLEACHc          C   s–   d d d g }  d d d g } d d d g } t  |  | | g d d ƒ} d } t j d i d d 6ƒ j | ƒ d j ƒ  } | | j ƒ  k s’ t ‚ d S(   sœ   
    Test to make sure that the HTML writer writes multidimensional
    columns (those with iterable elements) using the colspan
    attribute of <th>.
    i   i   i   g      ð?g       @g      @s   <a></a>R   s   <b></b>R   R   R6   Rm   Rn   Ro   s~  <html>
 <head>
  <meta charset="utf-8"/>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-type"/>
 </head>
 <body>
  <table>
   <thead>
    <tr>
     <th>C1</th>
     <th colspan="2">C2</th>
     <th colspan="3">C3</th>
    </tr>
   </thead>
   <tr>
    <td>1</td>
    <td>1.0</td>
    <td>1.0</td>
    <td><a></a></td>
    <td><a></a></td>
    <td>a</td>
   </tr>
   <tr>
    <td>2</td>
    <td>2.0</td>
    <td>2.0</td>
    <td><b></b></td>
    <td>b</td>
    <td>b</td>
   </tr>
   <tr>
    <td>3</td>
    <td>3.0</td>
    <td>3.0</td>
    <td>c</td>
    <td>c</td>
    <td>c</td>
   </tr>
  </table>
 </body>
</html>
    R>   t   raw_html_colsi    N(   g      ð?g      ð?(   g       @g       @(   g      @g      @(   s   <a></a>s   <a></a>R   (   s   <b></b>R   R   (   R   R   R   (   Rm   Rn   Ro   (   R   R    Rp   R   Rq   R   (   R<   Rr   Rs   R%   RW   Rt   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_multicolumn_write_escape®  s    +,c          C   s   d d d g }  d d d g } d d d g } t  |  | | g d
 d ƒ} d } t j i t d 6ƒ j | ƒ d j ƒ  | j ƒ  k s‰ t ‚ d S(   sƒ   
    Test to make sure that the HTML writer will not use
    multi-dimensional columns if the multicol parameter
    is False.
    i   i   i   g      ð?g       @g      @R   R   R   R6   Rm   Rn   Ro   së  <html>
 <head>
  <meta charset="utf-8"/>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-type"/>
 </head>
 <body>
  <table>
   <thead>
    <tr>
     <th>C1</th>
     <th>C2</th>
     <th>C3</th>
    </tr>
   </thead>
   <tr>
    <td>1</td>
    <td>1.0 .. 1.0</td>
    <td>a .. a</td>
   </tr>
   <tr>
    <td>2</td>
    <td>2.0 .. 2.0</td>
    <td>b .. b</td>
   </tr>
   <tr>
    <td>3</td>
    <td>3.0 .. 3.0</td>
    <td>c .. c</td>
   </tr>
  </table>
 </body>
</html>
    t   multicoli    N(   g      ð?g      ð?(   g       @g       @(   g      @g      @(   R   R   R   (   R   R   R   (   R   R   R   (   Rm   Rn   Ro   (   R   R    Rp   R#   R   Rq   R   (   R<   Rr   Rs   R%   RW   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_write_no_multicolsé  s    "&c          C   s”   t  j d d d ƒ}  t j t j d f ƒ } t  t j d d g d f d d g d	 f g d
 d | d f d g ƒƒ } t j |  | k ƒ s t ‚ d S(   s'  
    Test to make sure that the HTML reader inputs multidimensional
    columns (those with iterable elements) using the colspan
    attribute of <th>.

    Ensure that any string element within a multidimensional column
    casts all elements to string prior to type conversion operations.
    s   t/html2.htmlR(   s
   ascii.htmli   t   1s   2.5000000000000000001i   t   1ag      @R1   R)   i   R7   s   <f8N(   i   (   R7   s   <f8(   R   R,   R.   R1   R   t   arrayR/   R   (   R%   t   str_typeRW   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_multicolumn_read  s    c          C   s   t  d g d g g d d d g ƒ}  t ƒ  } |  j | d d d i d d	 6ƒd
 } | | j ƒ  k sk t ‚ t ƒ  } |  j | d d d i d g d	 6ƒ| | j ƒ  k s¯ t ‚ t ƒ  } |  j | d d d i d d g d	 6ƒd } | | j ƒ  k sü t ‚ d S(   sF   
    Test that columns can contain raw HTML which is not escaped.
    s
   <em>x</em>s
   <em>y</em>R6   R   R   R(   s
   ascii.htmlR>   Rv   sL      <tr>
    <td><em>x</em></td>
    <td>&lt;em&gt;y&lt;/em&gt;</td>
   </tr>s@      <tr>
    <td><em>x</em></td>
    <td><em>y</em></td>
   </tr>N(   R   t   StringIOR   t   getvalueR   (   t   tRt   RW   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_raw_html_write-  s    $	 	#	&c       	   C   sé   d d l  }  t d g d g d g g d d d d	 g ƒ} t ƒ  } | j | d
 d d i | j d 6ƒd } | | j ƒ  k sƒ t ‚ t ƒ  } | j | d
 d d i | j d 6i |  j d g d 6d 6ƒd } | | j ƒ  k så t ‚ d S(   sF   
    Test that columns can contain raw HTML which is not escaped.
    iÿÿÿÿNs   <script>x</script>s   <p>y</p>s
   <em>y</em>R6   R   R   R   R(   s
   ascii.htmlR>   Rv   sv      <tr>
    <td>&lt;script&gt;x&lt;/script&gt;</td>
    <td>&lt;p&gt;y&lt;/p&gt;</td>
    <td><em>y</em></td>
   </tr>Re   t   tagst   raw_html_clean_kwargssj      <tr>
    <td>&lt;script&gt;x&lt;/script&gt;</td>
    <td><p>y</p></td>
    <td><em>y</em></td>
   </tr>(   t   bleachR   R   R   R9   R€   R   t   ALLOWED_TAGS(   R…   R   Rt   RW   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_raw_html_write_cleanN  s    -	#	c          C   s¢   t  ƒ  }  t d g d g g d d ƒ} t j | |  d d d	 d
 ƒt d g d g g d d ƒ} t  ƒ  } t j | | d	 d
 ƒ|  j ƒ  | j ƒ  k sž t ‚ d S(   sG   
    Test that passing fill_values should replace any matching row
    i   i   R6   R   R   R*   Rz   s   Hello worldR(   R    N(   R   R   (   Rz   s   Hello world(   R   R   (   R   R   R   R   R€   R   (   t   buffer_outputR   t
   t_expectedt   buffer_expected(    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt!   test_write_table_html_fill_valuesp  s    		c          C   s¢   t  ƒ  }  t d g d g g d d ƒ} t j | |  d d d d	 ƒt d g d g g d d ƒ} t  ƒ  } t j | | d d	 ƒ|  j ƒ  | j ƒ  k sž t ‚ d
 S(   sc   
    Test that passing optional column in fill_values should only replace
    matching columns
    i   R6   R   R   R*   Rz   s   Hello worldR(   R    N(   R   R   (   Rz   s   Hello worldR   (   R   R   (   R   R   R   R   R€   R   (   Rˆ   R   R‰   RŠ   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt2   test_write_table_html_fill_values_optional_columns€  s    		c       	   C   sÇ   t  ƒ  }  t d g d g g d d d t d d ƒ} t j j | d <t j | |  d	 t j d
 f d d ƒt d
 g d g g d d ƒ} t  ƒ  } t j | | d d ƒ|  j ƒ  | j ƒ  k sÃ t	 ‚ d S(   si   
    Test that passing masked values in fill_values should only replace
    masked columns or values
    i   R6   R   R   R-   R1   t   i4t   i8R*   t   TESTR(   R    N(   R   R   (   R   RŽ   (   R   R   (
   R   R   R&   R.   t   maR-   R   R   R€   R   (   Rˆ   R   R‰   RŠ   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt(   test_write_table_html_fill_values_masked‘  s    	*	c          C   sö   d d d g }  d d d g } d d d g } t  ƒ  } t |  | | g d
 d ƒ} t j | | d d d d ƒd d d g }  d d d g } d d d  g } t  ƒ  } t |  | | g d
 d! ƒ} t j | | d d ƒ| j ƒ  | j ƒ  k sò t ‚ d S("   sy   
    Test to make sure that the HTML writer writes multidimensional
    columns with correctly replaced fill_values.
    i   i   i   g      ð?g       @g      @R   R   R   R6   Rm   Rn   Ro   R*   t   zR(   R    N(   g      ð?g      ð?(   g       @g       @(   g      @g      @(   R   R   R   (   R   R   R   (   R   R   R   (   Rm   Rn   Ro   (   R   R’   (   g      ð?g      ð?(   g       @g       @(   g      @g      @(   R’   R’   R’   (   R   R   R   (   R   R   R   (   Rm   Rn   Ro   (   R   R   R   R   R€   R   (   R<   Rr   Rs   Rˆ   R   RŠ   R‰   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt'   test_multicolumn_table_html_fill_values£  s    		c          C   s  t  ƒ  }  t d d d d g d d d d g g d d d	 t ƒ} t j j | d d
 d +t j j | d d
 d +t j | |  d t j d f g d d ƒt d d d d g d d d d g g d d ƒ} t  ƒ  } t j | | d d ƒ| j ƒ  GH|  j ƒ  | j ƒ  k st	 ‚ d S(   s…   
    Test that passing masked values in fill_values should only replace
    masked columns or values for multidimensional tables
    i   i   i   i   s   --R   R   R6   R-   i    R*   t   MASKEDR(   R    N(   R   R   (   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_html.pyt5   test_multi_column_write_table_html_fill_values_masked¼  s    	6!0	c          C   sP   d d d d g }  t  j |  d d ƒ} t j | d d d g k ƒ sL t ‚ d	 S(
   s8   
    Test reading an HTML table with unicode values
    u   <table>u   <tr><td>&#x0394;</td></tr>u   <tr><td>Î”</td></tr>u   </table>R(   s
   ascii.htmlR<   u   Î”N(   R   R,   R.   R/   R   (   R3   R4   (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   test_read_html_unicodeÐ  s    	(5   t   __doc__t    R    R   R%   R   RA   t   numpyR.   t   commonR   R   R   t   extern.six.movesR   R   R   t   utils.xml.writerR   t   bs4R	   R
   R&   RL   t   ImportErrorR#   t   markt   skipifR   R   R'   R5   R;   R=   RF   RK   RQ   RY   Rb   Rg   Rl   Ru   Rw   Ry   R~   R‚   R‡   R‹   RŒ   R‘   R“   R•   R–   (    (    (    s?   lib/python2.7/site-packages/astropy/io/ascii/tests/test_html.pyt   <module>   sN   

	+'6	:;	1!"					