
    h                        d dl mZmZ d dlZd dlZd dlmZmZm	Z	  ej                  d      Zd dlmZ ej                  d        Zej                  d        Zej                  d        Zej                  d	        Zej                  d
        Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!ejD                  jG                  dddg      ejD                  jG                  dddg      ejD                  jG                  dddg      d                      Z$ejD                  jG                  dddg      ejD                  jG                  dddg      d               Z%ejD                  jG                  dddg      ejD                  jG                  dddg      ejD                  jG                  d d!gd"gd"g      d#                      Z&d$ Z'ejD                  jG                  d%g d&      d'        Z(ejD                  jG                  dddg      ejD                  jG                  dddg      d(               Z)ejD                  jG                  d)ddg      ejD                  jG                  d*ddg      d+               Z*d, Z+d- Z,d. Z-d/ Z.d0 Z/d1 Z0ejD                  jG                  d2d3dg      ejD                  jG                  d4g d5      d6               Z1d7 Z2d8 Z3d9 Z4d: Z5d; Z6d< Z7y)=    )dedentindentN)	DataFrame
MultiIndexoption_contextjinja2)Stylerc                  `    t         j                  dd      } t         j                  | d      }|S )Npandaszio/formats/templatesT)loadertrim_blocks)r   PackageLoaderEnvironment)r   envs     LD:\jyotish\venv\Lib\site-packages\pandas/tests/io/formats/style/test_html.pyr   r      s/    !!(,BCF


F

=CJ    c                  >    t        t        dgdggddgdg            S )NzG@Q@abAindexcolumns)r	   r    r   r   stylerr      s%    )dVdV,S#JNOOr   c                      t        j                  ddgddgg      } t        t        t	        j
                  d      j                  dd      | |             S )Nr   r   cd      r   )r   from_productr	   r   nparangereshape)midxs    r   	styler_mir(      sH    ""S#Jc
#;<D)BIIbM11!Q7tTRSSr   c                 $    | j                  d      S )Nzhtml_style.tplget_templater   s    r   	tpl_styler-   %       ,--r   c                 $    | j                  d      S )Nzhtml_table.tplr*   r,   s    r   	tpl_tabler0   *   r.   r   c                      t        dd      5 } | j                         }d d d        dv sJ d|v sJ y # 1 sw Y   xY w)Nz$pandas/io/formats/templates/html.tplzutf-8)encodingz{% include html_style_tpl %}z{% include html_table_tpl %})openread)fileresults     r   "test_html_template_extends_optionsr7   /   sH     
4w	G4 
H)V333)V333 
H	Gs   4=c                 N    | j                  dd      }t        d      }||k(  sJ y )NT)exclude_stylesdoctype_htmla          <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        </head>
        <body>
        <table>
          <thead>
            <tr>
              <th >&nbsp;</th>
              <th >A</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <th >a</th>
              <td >2.610000</td>
            </tr>
            <tr>
              <th >b</th>
              <td >2.690000</td>
            </tr>
          </tbody>
        </table>
        </body>
        </html>
        )to_htmlr   r   r6   expecteds      r   test_exclude_stylesr>   8   s3    ^^4d^CF	H< Xr   c                 B   | j                  d      j                  dddg      j                  d       j                  d      j	                  t        dgdgd	g
            j                  d      j                  d       t        d      }|| j                         k(  sJ y )N thzatt2:v2;selectorpropsc                      y)Nzatt1:v1;r   )xs    r   <lambda>z%test_w3_html_format.<locals>.<lambda>]   s    *r   z!class="my-cls1" style="attr3:v3;"zmy-cls2r   r   r   z{:.1f}zA comprehensive testa          <style type="text/css">
        #T_ th {
          att2: v2;
        }
        #T__row0_col0, #T__row1_col0 {
          att1: v1;
        }
        </style>
        <table id="T_" class="my-cls1" style="attr3:v3;">
          <caption>A comprehensive test</caption>
          <thead>
            <tr>
              <th class="blank level0" >&nbsp;</th>
              <th id="T__level0_col0" class="col_heading level0 col0" >A</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <th id="T__level0_row0" class="row_heading level0 row0" >a</th>
              <td id="T__row0_col0" class="data row0 col0 my-cls2" >2.6</td>
            </tr>
            <tr>
              <th id="T__level0_row1" class="row_heading level0 row1" >b</th>
              <td id="T__row1_col0" class="data row1 col0" >2.7</td>
            </tr>
          </tbody>
        </table>
        )
set_uuidset_table_stylesmapset_table_attributesset_td_classesr   formatset_captionr   r;   )r   r=   s     r   test_w3_html_formatrO   [   s    
OOB((tj*Q)RSWW>?9+cUSE:Afk 	H> v~~''''r   c                  t    t        ddggddgddgg      } t        | dd	      }d
|j                         v sJ y )N      l0l1al1b)datar   _Fuuidcell_idsz7<th class="col_heading level0 col0" colspan="2">l0</th>r   r	   r;   dfr   s     r   test_colspan_w3r^      sD    	!QD$<%*H	IBBS51FDHXXXXr   c                  t    t        ddggddgddgg      } t        | dd	      }d
|j                         v sJ y )NrQ   rR   rS   rT   rU   )rV   r   rW   FrX   z7<th class="row_heading level0 row0" rowspan="2">l0</th>r[   r\   s     r   test_rowspan_w3r`      sD    	!Q$u~(F	GBBS51FDHXXXXr   c                     | j                  d       | j                  dddg       | j                  d      }t        d      }||k(  sJ y )Nabctdcolor: red;rB   Tr:   a          <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        <style type="text/css">
        #T_abc td {
          color: red;
        }
        </style>
        </head>
        <body>
        <table id="T_abc">
          <thead>
            <tr>
              <th class="blank level0" >&nbsp;</th>
              <th id="T_abc_level0_col0" class="col_heading level0 col0" >A</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <th id="T_abc_level0_row0" class="row_heading level0 row0" >a</th>
              <td id="T_abc_row0_col0" class="data row0 col0" >2.610000</td>
            </tr>
            <tr>
              <th id="T_abc_level0_row1" class="row_heading level0 row1" >b</th>
              <td id="T_abc_row1_col0" class="data row1 col0" >2.690000</td>
            </tr>
          </tbody>
        </table>
        </body>
        </html>
        )rH   rI   r;   r   r<   s      r   test_stylesrf      sT    
OOE
$GHI^^^.F 	"HF Xr   c                 X    | j                  d      }d|vsJ d|vsJ d|vsJ d|vsJ y )NFre   z<html>z<body>z<!DOCTYPE html>z<head>r;   r   r6   s     r   test_doctyperj      sJ    ^^^/F6!!!6!!!F***6!!!r   c                     t        dd      5  | j                  d      }d|v sJ | j                  dd      }d|v sJ 	 d d d        y # 1 sw Y   y xY w)	Nzstyler.render.encodingASCIITre   z<meta charset="ASCII">ANSI)r:   r2   z<meta charset="ANSI">)r   r;   ri   s     r   test_doctype_encodingrn      sW    	0'	:T2'6111TFC&&000	 
;	:	:s   2A		Ac                 `    | j                  d      }d|v sJ | j                         }d|vsJ y )NT)bold_headerszth {
  font-weight: bold;
}rh   ri   s     r   test_bold_headers_argrq      s:    ^^^.F*f444^^F*&888r   c                 `    | j                  d      }d|v sJ | j                         }d|vsJ y )Nzfoo bar)captionz<caption>foo bar</caption>rh   ri   s     r   test_caption_argrt      s:    ^^I^.F'6111^^F'v555r   c                     h d}h d}t        | j                        }||k(  sJ t        |j                        }||k(  sJ y )N>   style	cellstylebefore_styletable_stylesbefore_cellstyle>   trtabletbodytheadrs   head_tr
after_rowsafter_tablebefore_rowsbefore_tableafter_head_rowsbefore_head_rows)setblocks)r-   r0   expected_styleexpected_tableresult1result2s         r   test_block_namesr      sN    NN )""#Gn$$$)""#Gn$$$r   c                    | j                  d      j                  d      }|j                  t        d             t	        j
                  t        | j                  d            d      }t        |t              sJ |j                  t        j                  usJ |j                  t        j                  usJ  |t        dddgi            }d|j                  d	      v sJ y )
Ntplzmyhtml_table.tplz            {% extends "html_table.tpl" %}
            {% block table %}
            <h1>{{custom_title}}</h1>
            {{ super() }}
            {% endblock table %}r   rQ   rR   z<h1>My Title</h1>


<tablezMy Title)custom_title)mkdirjoinwriter   r	   from_custom_templatestr
issubclassr   template_html_tabler   r;   tmpdirpr6   r   s       r   test_from_custom_template_tabler      s    U  !34AGG$	
	 ((V[[-?)@BTUFff%%%::VZZ'''%%V-G-GGGGIsQFm,-F*fnn*n.UUUUr   c                    | j                  d      j                  d      }|j                  t        d             t	        j
                  t        | j                  d            d      }t        |t              sJ |j                  t        j                  usJ |j                  t        j                  usJ  |t        dddgi            }d|j                         v sJ y )	Nr   zmyhtml_style.tplz            {% extends "html_style.tpl" %}
            {% block style %}
            <link rel="stylesheet" href="mystyle.css">
            {{ super() }}
            {% endblock style %})
html_styler   rQ   rR   z2<link rel="stylesheet" href="mystyle.css">

<style)r   r   r   r   r	   r   r   r   r   template_html_styler   r;   r   s       r   test_from_custom_template_styler     s    U  !34AGG$	
	 ((FKK,>F ff%%%::VZZ'''%%V-G-GGGGIsQFm,-FAV^^EUUUUr   c                 N    | j                  d       d| j                         v sJ y )N)zfull capz	short capz<caption>full cap</caption>)rN   r;   r   s    r   test_caption_as_sequencer   %  s&    
01(FNN,<<<<r   r   FTr   
index_namec                    |rd| j                   _        |r| j                  d       |r| j                  d       d}d}| j                  d      j	                         }|j                  dd	      |v |u sJ |j                  d
d      |v |u sJ |j                  dddd      |v |xr |u sJ |j                  dddd      |v |xr |u sJ |j                  dddd      |v |xr | u sJ y )Nz	some textr   axisrQ   z[#T_ {0} {{
  position: sticky;
  background-color: inherit;
  left: 0px;
  z-index: {1};
}}z_#T_ {0} {{
  position: sticky;
  background-color: inherit;
  top: {1}px;
  z-index: {2};
{3}}}r@   thead tr th:nth-child(1)3 !importantztbody tr th:nth-child(1)1thead tr:nth-child(1) th02z  height: 25px;
thead tr:nth-child(2) th25)r   name
set_stickyrH   r;   rM   )r   r   r   r   left_csstop_cssress          r   test_sticky_basicr   *  sD    'q!q!	, 
	0 
 //"

%
%
'C OO6G3NSXXXXOO6<CMMM 	13=PQUXX

 j" " " 	14>QR	

 j" " " NN5sCDK"
N  r   c                    |r| j                  d       |r| j                  d       d}d}| j                  d      j                         }|j                  ddd	      |v |u sJ |j                  d
dd      |v |u sJ |j                  ddd	      |v |u sJ |j                  ddd      |v |u sJ |j                  ddd      |v |u sJ |j                  ddd      |v |u sJ y )Nr   r   rQ   #T_ {0} {{
  position: sticky;
  background-color: inherit;
  left: {1}px;
  min-width: 75px;
  max-width: 75px;
  z-index: {2};
}}l#T_ {0} {{
  position: sticky;
  background-color: inherit;
  top: {1}px;
  height: 25px;
  z-index: {2};
}}r@   r   r   r   ztbody tr th.level0r   thead tr th:nth-child(2)75tbody tr th.level1r   r   r   r   )r   rH   r;   rM   )r(   r   r   r   r   r   s         r   test_sticky_mir   Q  s8    !$!$	V 
	> 
 

R
 
(
(
*C 	2CHCO	   OO0#s;sBuLLL2D.ISP	   OO0$<CMMM NN5sC@CGGSSSNN5tSASHWTTTr   levelsrQ   onec                    ddgddgc| j                   _        | j                  _        |r| j                  d|       |r| j                  d|       d}d}| j	                  d      j                         }d	|vsJ d
|vsJ d|vsJ |j                  ddd      |v |u sJ |j                  ddd      |v |u sJ |j                  ddd      |v |u sJ y )Nzeror   r   )r   r   rQ   r   r   r@   z#T_ thead tr th:nth-child(1)z#T_ tbody tr th.level0z#T_ thead tr:nth-child(1) thr   r   r   r   r   r   r   )r   namesr   r   rH   r;   rM   )r(   r   r   r   r   r   r   s          r   test_sticky_levelsr   s  s    7=e_vuo2IOO9,,2!F3!F3	V 
	> 
 

R
 
(
(
*C *444#3...)444 	2CHCO	   OO0#s;sBuLLLNN5sC@CGGSSSr   c                     t        j                  t        d      5  | j                  d       d d d        y # 1 sw Y   y xY w)Nz+No axis named bad for object type DataFrame)matchbadr   )pytestraises
ValueErrorr   r   s    r   test_sticky_raisesr     s/    	z)V	Wu% 
X	W	Ws	   8Azsparse_index, sparse_columns))TT)TF)FT)FFc                 |   t        j                  g d      }t        j                  g d      }t        g dg dg dg||      }|j                  }|j	                         }t        d| d|      5  |j	                         }||k(  | xr |u sJ 	 d d d        |j	                  | |	      }|k(  sJ y # 1 sw Y   $xY w)
N))Zr   )r   r   )Yr   ))r   r   )r   r   )Br   rQ   rR      )r"         )      	   r   zstyler.sparse.indexzstyler.sparse.columns)sparse_indexsparse_columns)r   from_tuplesr   rv   r;   r   )	r   r   cidxridxr]   r   default_htmlhtml1html2s	            r   test_sparse_optionsr     s    
 !!"FGD!!"FGD	Iy)4D$	OBXXF>>#L	|-Dn
  %<+JNKKK	

 NN^NTEE>>
 
s   0B22B;c                    d }d\  | _         | _        |r| j                  |d       |r| j                  |d       | j                         }d|v sJ d|v sJ d|v |u sJ d	|v |u sJ d
|v |u sJ d|v |u sJ d|v |u sJ y )Nc                      y)Nz
attr: val;r   vs    r   rG   z*test_map_header_cell_ids.<locals>.<lambda>  s    \r   )r@   Fr   r   r   z)<td class="data row0 col0" >2.610000</td>z)<td class="data row1 col0" >2.690000</td>z?<th id="T__level0_row0" class="row_heading level0 row0" >a</th>z?<th id="T__level0_row1" class="row_heading level0 row1" >b</th>z1#T__level0_row0, #T__level0_row1 {
  attr: val;
}z?<th id="T__level0_col0" class="col_heading level0 col0" >A</th>z #T__level0_col0 {
  attr: val;
})rY   rZ   	map_indexr;   )r   r   r   funcr6   s        r   test_map_header_cell_idsr     s     "D#, FKG,I.^^F 7&@@@6&@@@ 	JVS	   	JVS	   BVKPUUUU 	JVS	   1F:wFFFr   rowscolsc                 f    | j                  |rdnd |rdnd       }d|v sJ d|v |usJ d|v |usJ y )NrR   )max_rowsmax_columnsz>5</td>z>8</td>z>2</td>rh   )r(   r   r   r6   s       r   test_maximumsr     s]     A4  F
 ,,,,,,r   c                  D   dddddddd} t        j                  d	d
gddgg      }t        t        t	        j
                  d      j                  dd      ||      d      j                  |       }ddg|j                  _	        |j                  |j                  dd  d       |j                  |j                  dd  d       |j                  d d       |j                  d d       |j                  d        t        d      }|j                         }||k(  sJ y )NROWHEADIDXNAMEROWROWTRIMLEVELDATABLANK)row_headingr   rowrow_trimlevelrV   blankr   r   r   r    r!   r"   r   r   uuid_len)css_class_namesn1n2rQ   r   c                      y)Nrd   r   r   s    r   rG   z/test_replaced_css_class_names.<locals>.<lambda>  s    -r   c                      y)Nzcolor: green;r   r   s    r   rG   z/test_replaced_css_class_names.<locals>.<lambda>  s    /r   c                      yNzcolor: blue;r   r   s    r   rG   z/test_replaced_css_class_names.<locals>.<lambda>  s    Nr   a8      <style type="text/css">
    #T__ROW0_col0 {
      color: blue;
    }
    #T__LEVEL0_ROW0, #T__LEVEL1_ROW0 {
      color: red;
    }
    #T__LEVEL0_col0, #T__LEVEL1_col0 {
      color: green;
    }
    </style>
    <table id="T_">
      <thead>
        <tr>
          <th class="BLANK" >&nbsp;</th>
          <th class="IDXNAME LEVEL0" >n1</th>
          <th id="T__LEVEL0_col0" class="col_heading LEVEL0 col0" >a</th>
        </tr>
        <tr>
          <th class="BLANK" >&nbsp;</th>
          <th class="IDXNAME LEVEL1" >n2</th>
          <th id="T__LEVEL1_col0" class="col_heading LEVEL1 col0" >c</th>
        </tr>
        <tr>
          <th class="IDXNAME LEVEL0" >n1</th>
          <th class="IDXNAME LEVEL1" >n2</th>
          <th class="BLANK col0" >&nbsp;</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th id="T__LEVEL0_ROW0" class="ROWHEAD LEVEL0 ROW0" >a</th>
          <th id="T__LEVEL1_ROW0" class="ROWHEAD LEVEL1 ROW0" >c</th>
          <td id="T__ROW0_col0" class="DATA ROW0 col0" >0</td>
        </tr>
      </tbody>
    </table>
    )r   r#   r	   r   r$   r%   r&   rI   r   r   hider   r   rJ   r   r;   )cssr'   r(   r=   r6   s        r   test_replaced_css_class_namesr    s+    C ""S#Jc
#;<D"))B-''1-T4H s+  "4LIOONN9??12&QN/NN9$$QR(qN1/a81:MM*+&	(HR  FXr   c                 $   | j                  d      j                  d       j                  | j                  j                  dd  d      j                  | j                  j
                  dd  d      j                         }t        d      }||v sJ y )Nr@   c                      yr   r   r   s    r   rG   zEtest_include_css_style_rules_only_for_visible_cells.<locals>.<lambda>&  s    ~r   rQ   r   r   r   zr        <style type="text/css">
        #T__row0_col0 {
          color: blue;
        }
        </style>
        )rH   rJ   r   rV   r   r   r;   r   r(   r6   expected_styless      r   3test_include_css_style_rules_only_for_visible_cellsr  "  s     	2	%	&	inn$$QR(y	9	inn""12&W	5	  	O f$$$r   c                 "   | j                  d      j                  d d      j                  | j                  j                  d      j                  | j                  j
                  dd  d      j                         }t        d      }||v sJ y )Nr@   c                      yr   r   r   s    r   rG   zLtest_include_css_style_rules_only_for_visible_index_labels.<locals>.<lambda>;      ^r   r   r   r   rQ   z        <style type="text/css">
        #T__level0_row0, #T__level1_row0 {
          color: blue;
        }
        </style>
        rH   r   r   rV   r   r   r;   r   r  s      r   :test_include_css_style_rules_only_for_visible_index_labelsr  7  s     	2	+'	:	inn$$9	5	inn""12&W	5	  	O f$$$r   c                 "   | j                  d      j                  d d      j                  | j                  j                  dd  d      j                  | j                  j
                  d      j                         }t        d      }||v sJ y )Nr@   c                      yr   r   r   s    r   rG   zMtest_include_css_style_rules_only_for_visible_column_labels.<locals>.<lambda>P  r	  r   r   r   rQ   r   z        <style type="text/css">
        #T__level0_col0, #T__level1_col0 {
          color: blue;
        }
        </style>
        r
  r  s      r   ;test_include_css_style_rules_only_for_visible_column_labelsr  L  s     	2	+)	<	inn$$QR(y	9	inn""	1	  	O f$$$r   c                     t        j                  ddgdgddggg d      } t        j                  dgd	d
gddggg d      }t        t        j                  d      j                  dd      | |      }t        |d      }|j                  dd      j                  dd       |j                  dgd       |j                  dgd       |j                         }t        d      }||k(  sJ y )Ni0j0i1i2j2)zi-0zi-1zi-2)r   c0c1d1c2d2)zc-0zc-1zc-2r!   r"   r   r   r   rQ   )r   r   )r  r  r  r   )r  r  r  a
      <style type="text/css">
    </style>
    <table id="T_">
      <thead>
        <tr>
          <th class="blank" >&nbsp;</th>
          <th class="index_name level1" >c-1</th>
          <th id="T__level1_col0" class="col_heading level1 col0" colspan="2">c1</th>
          <th id="T__level1_col2" class="col_heading level1 col2" >d1</th>
        </tr>
        <tr>
          <th class="blank" >&nbsp;</th>
          <th class="index_name level2" >c-2</th>
          <th id="T__level2_col0" class="col_heading level2 col0" >c2</th>
          <th id="T__level2_col1" class="col_heading level2 col1" >d2</th>
          <th id="T__level2_col2" class="col_heading level2 col2" >c2</th>
        </tr>
        <tr>
          <th class="index_name level0" >i-0</th>
          <th class="index_name level2" >i-2</th>
          <th class="blank col0" >&nbsp;</th>
          <th class="blank col1" >&nbsp;</th>
          <th class="blank col2" >&nbsp;</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th id="T__level0_row0" class="row_heading level0 row0" rowspan="2">i0</th>
          <th id="T__level2_row0" class="row_heading level2 row0" >i2</th>
          <td id="T__row0_col0" class="data row0 col0" >0</td>
          <td id="T__row0_col1" class="data row0 col1" >1</td>
          <td id="T__row0_col2" class="data row0 col2" >2</td>
        </tr>
        <tr>
          <th id="T__level2_row1" class="row_heading level2 row1" >j2</th>
          <td id="T__row1_col0" class="data row1 col0" >4</td>
          <td id="T__row1_col1" class="data row1 col1" >5</td>
          <td id="T__row1_col2" class="data row1 col2" >6</td>
        </tr>
        <tr>
          <th id="T__level0_row2" class="row_heading level0 row2" >j0</th>
          <th id="T__level2_row2" class="row_heading level2 row2" >i2</th>
          <td id="T__row2_col0" class="data row2 col0" >8</td>
          <td id="T__row2_col1" class="data row2 col1" >9</td>
          <td id="T__row2_col2" class="data row2 col2" >10</td>
        </tr>
      </tbody>
    </table>
    )
r   r#   r   r$   r%   r&   r	   r   r;   r   )r'   r   r]   r   r6   r=   s         r   .test_hiding_index_columns_multiindex_alignmentr  a  s    ""
vd|,4ID ""
$d|,4ID 
299R=((A.dD	IBB#F
KKaaK %%AA%6
KK#$1K-
KK#$1K-^^F1	3Hh Xr   c                  $   t        t        j                  d      j                  dd            } t	        j
                  g dddgg      | _        t	        j
                  g dddgg      | _        ddgdd	gc| j                  _        | j                  _        t        | d
d      }|j                  g dd      j                  g dd       t        dddd      5  |j                         }d d d        t        d      }|k(  sJ y # 1 sw Y   xY w)N@   r   )r   rQ   rR   r   r   rQ   r   r   r   r    F)rZ   r   ))r   r   )r   rQ   )rQ   r   r   zstyler.render.max_rowsr"   zstyler.render.max_columnsa      <style type="text/css">
    </style>
    <table id="T_">
      <thead>
        <tr>
          <th class="blank" >&nbsp;</th>
          <th class="index_name level0" >c</th>
          <th class="col_heading level0 col3" >1</th>
          <th class="col_heading level0 col4" colspan="2">2</th>
          <th class="col_heading level0 col6" >3</th>
        </tr>
        <tr>
          <th class="blank" >&nbsp;</th>
          <th class="index_name level1" >d</th>
          <th class="col_heading level1 col3" >1</th>
          <th class="col_heading level1 col4" >0</th>
          <th class="col_heading level1 col5" >1</th>
          <th class="col_heading level1 col6" >0</th>
          <th class="col_heading level1 col_trim" >...</th>
        </tr>
        <tr>
          <th class="index_name level0" >a</th>
          <th class="index_name level1" >b</th>
          <th class="blank col3" >&nbsp;</th>
          <th class="blank col4" >&nbsp;</th>
          <th class="blank col5" >&nbsp;</th>
          <th class="blank col6" >&nbsp;</th>
          <th class="blank col7 col_trim" >&nbsp;</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th class="row_heading level0 row3" >1</th>
          <th class="row_heading level1 row3" >1</th>
          <td class="data row3 col3" >27</td>
          <td class="data row3 col4" >28</td>
          <td class="data row3 col5" >29</td>
          <td class="data row3 col6" >30</td>
          <td class="data row3 col_trim" >...</td>
        </tr>
        <tr>
          <th class="row_heading level0 row4" rowspan="2">2</th>
          <th class="row_heading level1 row4" >0</th>
          <td class="data row4 col3" >35</td>
          <td class="data row4 col4" >36</td>
          <td class="data row4 col5" >37</td>
          <td class="data row4 col6" >38</td>
          <td class="data row4 col_trim" >...</td>
        </tr>
        <tr>
          <th class="row_heading level1 row5" >1</th>
          <td class="data row5 col3" >43</td>
          <td class="data row5 col4" >44</td>
          <td class="data row5 col5" >45</td>
          <td class="data row5 col6" >46</td>
          <td class="data row5 col_trim" >...</td>
        </tr>
        <tr>
          <th class="row_heading level0 row6" >3</th>
          <th class="row_heading level1 row6" >0</th>
          <td class="data row6 col3" >51</td>
          <td class="data row6 col4" >52</td>
          <td class="data row6 col5" >53</td>
          <td class="data row6 col6" >54</td>
          <td class="data row6 col_trim" >...</td>
        </tr>
        <tr>
          <th class="row_heading level0 row_trim" >...</th>
          <th class="row_heading level1 row_trim" >...</th>
          <td class="data col3 row_trim" >...</td>
          <td class="data col4 row_trim" >...</td>
          <td class="data col5 row_trim" >...</td>
          <td class="data col6 row_trim" >...</td>
          <td class="data row_trim col_trim" >...</td>
        </tr>
      </tbody>
    </table>
    )r   r$   r%   r&   r   r#   r   r   r   r	   r   r   r;   r   )r]   r   r6   r=   s       r   -test_hiding_index_columns_multiindex_trimmingr    s    	299R=((A.	/B((,A)?@BJ&&q!f'=>BH(+SzC:$BHHNBJJ$B3F
KK(qK1667OVW6X	0!5PRS	T! 
U N	PHd Xk 
U	Ts   DDtyperV   ztext, exp, found))zno link, just textFr@   )zsubdomain not www: sub.web.comFr@   )z www subdomain: www.web.com otherTzwww.web.com)z)scheme full structure: http://www.web.comTzhttp://www.web.com)z#scheme no top-level: http://www.webTzhttp://www.web)z no scheme, no top-level: www.webFzwww.web)z!https scheme: https://www.web.comTzhttps://www.web.com)zftp scheme: ftp://www.webTzftp://www.web)zftps scheme: ftps://www.webTzftps://www.web)z%subdirectories: www.web.com/directoryTzwww.web.com/directory)zMultiple domains: www.1.2.3.4Tzwww.1.2.3.4)zwith port: http://web.com:80Tzhttp://web.com:80)z-full net_loc scheme: http://user:pass@web.comTzhttp://user:pass@web.com)z8with valid special chars: http://web.com/,.':;~!@#$*()[]Tzhttp://web.com/,.':;~!@#$*()[]c                    | dk(  r)t        |g      }|j                  j                  d      }n+t        dg|g      }|j                  j                  d      }d| d| d}|j	                         }||v |u sJ ||v |usJ y )	NrV   html
hyperlinksr   )r   z	<a href="z" target="_blank">z</a>)r   rv   rM   format_indexr;   )r  textexpfoundr]   r   renderedr6   s           r   test_rendered_linksr(    s    : v~vF3s4&)&&&&95'!3E7$?H^^F3&&&FN3&&&r   c                      d} t         dj                  |  g      }|j                  j                  d      j                         }d}| D ]  }|j                  |      |v rJ  |j                  d      |vsJ y )N)zwww.a.bz
http://a.czhttps://a.dz	ftp://a.eztext {} {} text {} {}r   r!  z%<a href="{0}" target="_blank">{0}</a>r$  )r   rM   rv   r;   )linksr]   r6   hreflinks        r   test_multiple_rendered_linksr-  0  s}    AE	2+22E:;	<BXX___/779F2D{{4 F*** ;;vf,,,r   c                     | j                   j                  dg      j                  }| j                  |      j	                  d       | j                         }d}t        d| d| d| d| d| d	| d
      }||v sJ y )NmeanXfoot0_    <tr>
      <th id="T_X_level0_row1" class="row_heading level0 row1" >b</th>
      <td id="T_X_row1_col0" class="data row1 col0" >2.690000</td>
    </tr>
    <tr>
      <th id="T_X_level0_row0" class="row_heading level0 #row0" >mean</th>
      <td id="T_X_row0_col0" class="data z<row0 col0" >2.650000</td>
    </tr>
  </tbody>
</table>
    )rV   aggrv   concatrH   r;   r   )r   otherr6   fpr=   s        r   test_concatr<  ;  s    KKOOVH%++E
MM%!!#&^^F	B ]2$.A" F$(E" 6	H vr   c                    | j                   }| }t        |j                  dg      d      }t        |j                  dg      d      }|j                  |j                  |            j	                  d       | j                         }d}d}t        d| d	| d
| d| d| d| d| d	| d
| d| d| d| d      }||v sJ y )Nr/  r   	precisionr"   r0  r1  foot0_foot0_r2  r3  r4  r5  r6  r7  Crow0 col0" >2.650</td>
    </tr>
    <tr>
      <th id="T_X_level0_:row0 col0" >2.6500</td>
    </tr>
  </tbody>
</table>
    rV   r	   r8  r9  rH   r;   r   	r   r]   styler1styler2styler3r6   fp1fp2r=   s	            r   test_concat_recursionrJ  Q  s    	BGRVVVH%3GRVVVH%3GNN7>>'*+44S9^^F C
C mC50CC5 I%)#eC5 9 mC50CC5 I%)#eC5 9	H$ vr   c                    | j                   }| }t        |j                  dg      d      }t        |j                  dg      d      }|j                  |      j                  |      j	                  d       | j                         }d}d}t        d| d	| d
| d| d| d| d| d	| d
| d| d| d| d      }||v sJ y )Nr/  r   r>  r"   r0  r1  foot1_r2  r3  r4  r5  r6  r7  rA  rB  rC  rD  s	            r   test_concat_chainrM  q  s    	BGRVVVH%3GRVVVH%3GNN7""7+44S9^^F
C
C mC50CC5 I%)#eC5 9 mC50CC5 I%)#eC5 9	H$ vr   c                  Z   dt         fd} t        dgdggddgdg      }|j                  j                  d	
      }|j                  j                  d
      }|j                  j                  d
      }|j                  j                  d
      }|j	                  |      j	                  |j	                  |            j                  d      j                         }t        d      }t        d       | d      z    | d      z    | d      z    | d      z   t        d      z   }||z   |k(  sJ y )Nfoot_prefixc                     | j                  d      s| dk(  sJ | }t        t        d| d| d| d| d| d| d	| d
| d| d| d| d| d      d      S )NrW   r@   z*        <tr>
          <th id="T_X_level0_r3  r4  z$row0" >a</th>
          <td id="T_X_r6  r7  zRrow0 col0" >2.610000</td>
        </tr>
        <tr>
          <th id="T_X_level0_zrow1" class="z$row1" >b</th>
          <td id="T_X_zrow1_col0" class="z0row1 col0" >2.690000</td>
        </tr>
        z    )prefix)endswithr   r   )rO  r;  s     r   
html_linesz(test_concat_combined.<locals>.html_lines  s    ##C(K2,=== Trd2EbT Jd,RDbT : !Trd2EbT Jd,RDbT :		 
 	
r   r   r   r   r   r   r   red)colorgreenblueyellowr0  ag          <style type="text/css">
        #T_X_row1_col0 {
          background-color: red;
        }
        #T_X_foot0_row1_col0 {
          background-color: green;
        }
        #T_X_foot1_row1_col0 {
          background-color: blue;
        }
        #T_X_foot1_foot0_row1_col0 {
          background-color: yellow;
        }
        </style>
        a"              <table id="T_X">
              <thead>
                <tr>
                  <th class="blank level0" >&nbsp;</th>
                  <th id="T_X_level0_col0" class="col_heading level0 col0" >A</th>
                </tr>
              </thead>
              <tbody>
            r@   r1  rL  foot1_foot0_z8              </tbody>
            </table>
            )r   r   rv   highlight_maxr9  rH   r;   r   )	rS  r]   s1s2s3s4r6   expected_cssr   s	            r   test_concat_combinedr`    sD   
 
& 
TFTF#C:u	EB			e		,B			g		.B			f		-B			h		/BYYr]!!"))B-099#>FFHF	L& 			
 R.	 X
	 X
	 ^
$	%  
!	
 0 .(F222r   c                     t        dg dt        j                  dg      }|j                  j	                  d      j                  d      }d}||k(  sJ y )	NrQ   r   )r   r   r   -)na_reptest)
table_uuida  <style type="text/css">
</style>
<table id="T_test">
  <thead>
    <tr>
      <th class="blank level0" >&nbsp;</th>
      <th id="T_test_level0_col0" class="col_heading level0 col0" >a</th>
      <th id="T_test_level0_col1" class="col_heading level0 col1" >b</th>
      <th id="T_test_level0_col2" class="col_heading level0 col2" >c</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th id="T_test_level0_row0" class="row_heading level0 row0" >0</th>
      <td id="T_test_row0_col0" class="data row0 col0" >1</td>
      <td id="T_test_row0_col1" class="data row0 col1" >[1, 2, 3]</td>
      <td id="T_test_row0_col2" class="data row0 col2" >-</td>
    </tr>
  </tbody>
</table>
)r   r$   nanrv   rM   r;   )datapathr]   r6   r=   s       r   #test_to_html_na_rep_non_scalar_datarh    sS    	!)"&&9:	;BXX__C_(00F0CFH, Xr   )8textwrapr   r   numpyr$   r   r   r   r   r   importorskipr   pandas.io.formats.styler	   fixturer   r   r(   r-   r0   r7   r>   rO   r^   r`   rf   rj   rn   rq   rt   r   r   r   r   markparametrizer   r   r   r   r   r   r   r  r  r  r  r  r  r(  r-  r<  rJ  rM  r`  rh  r   r   r   <module>rp     s_  
    
		X	& *   P P T T
 . . . .4 F)(XYY'T"196%<V(V,=
 5$-0UDM2e}5! 6 3 1!H 5$-0UDM2U 3 1U@ 5$-0UDM2QC%%#89T : 3 1T>&
 "@	" 4-0T5M2G 3 1G> $/$/- 0 0-BJ%*%*%*BJ]@ &'!236'7 48'-,@<E3Pr   