B
    `V                 @   sR   d dl 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	 G dd dZ
dS )    N)datetime)	DataFrameSeriesc            	   @   s6  e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zejd)d*d+gejd,d*d-gejd.d/gd0gd/d0ggd1d2 Zejd3d4d5gd6d7 Zd8d9 Zd:d; Zd<d= Zd>d? Zd@dA Z d*S )BTestToLatexc          
   C   s   t d:}|| t|d}| | ks6tW d Q R X W d Q R X tdgg}t dD}|j|dd tj|ddd}| | kstW d Q R X W d Q R X t d@}|| tj|ddd}| | kstW d Q R X W d Q R X d S )Nztest.texru
   außgangenzutf-8)encoding)tmZensure_cleanto_latexopenreadAssertionErrorr   codecs)selffloat_framepathfdf r   T/home/dcms/DCMS/lib/python3.7/site-packages/pandas/tests/io/formats/test_to_latex.pytest_to_latex_filename   s    
((
z"TestToLatex.test_to_latex_filenamec             C   sV   |   tddgddgd}|  }d}||ks6t|j dd}d	}||ksRtd S )
N      b1b2)abzr\begin{tabular}{lrl}
\toprule
{} &  a &   b \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
F)indexzd\begin{tabular}{rl}
\toprule
 a &   b \\
\midrule
 1 &  b1 \\
 2 &  b2 \\
\bottomrule
\end{tabular}
)r	   r   r   )r   r   r   withindex_resultwithindex_expectedwithoutindex_resultwithoutindex_expectedr   r   r   test_to_latex    s    		zTestToLatex.test_to_latexc             C   sB   |j dd tddgddgd}|j dd}d}||ks>td S )	Nccc)Zcolumn_formatr   r   r   r   )r   r   zr\begin{tabular}{ccc}
\toprule
{} &  a &   b \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
)r	   r   r   )r   r   r   r   r   r   r   r   test_to_latex_format?   s
    	z TestToLatex.test_to_latex_formatc             C   s>   t  }| }d}||kst|jdd}d}||ks:td S )Nz\begin{tabular}{l}
\toprule
Empty DataFrame
Columns: Index([], dtype='object')
Index: Index([], dtype='object') \\
\bottomrule
\end{tabular}
T)	longtablez\begin{longtable}{l}
\toprule
Empty DataFrame
Columns: Index([], dtype='object')
Index: Index([], dtype='object') \\
\end{longtable}
)r   r	   r   )r   r   resultexpectedr   r   r   test_to_latex_emptyQ   s    zTestToLatex.test_to_latex_emptyc             C   s   t tdddtdddtdddgdddgdddgd	d
dgd}dd dd dd dd dd d}|jt|d}d}||kstd S )Ni  r   r         g      ?g       @g      @)r   r   TF)
datetime64floatintobjectc             S   s
   |  dS )Nz%Y-%m)strftime)xr   r   r   <lambda>w       z;TestToLatex.test_to_latex_with_formatters.<locals>.<lambda>c             S   s   d| ddS )N[z 4.1f]r   )r/   r   r   r   r0   x   r1   c             S   s   d| dS )N0xr/   r   )r/   r   r   r   r0   y   r1   c             S   s   d| dS )N-r   )r/   r   r   r   r0   z   r1   c             S   s
   d|  S )Nzindex: r   )r/   r   r   r   r0   {   r1   )r*   r+   r,   r-   	__index__)
formattersa  \begin{tabular}{llrrl}
\toprule
{} & datetime64 &  float & int &    object \\
\midrule
index: 0 &    2016-01 & [ 1.0] & 0x1 &  -(1, 2)- \\
index: 1 &    2016-02 & [ 2.0] & 0x2 &    -True- \\
index: 2 &    2016-03 & [ 3.0] & 0x3 &   -False- \\
\bottomrule
\end{tabular}
)r   r   r	   dictr   )r   r   r7   r%   r&   r   r   r   test_to_latex_with_formattersh   s    

z)TestToLatex.test_to_latex_with_formattersc             C   sp  t ddgi}| }d}||ks&t|j }d}||ks@tt tdd tdD tdd tdD td	d tdD td
d tdD tdd tdD dj}| }d}||kst|j}ddg|j_	| }d}||kstt ddddgt
dddddgd}|ddg }d}||ksHt|d  }d}||ksltd S )N)r/   yr   z`\begin{tabular}{ll}
\toprule
{} &  x \\
{} &  y \\
\midrule
0 &  a \\
\bottomrule
\end{tabular}
z]\begin{tabular}{lll}
\toprule
  &   &  0 \\
\midrule
x & y &  a \\
\bottomrule
\end{tabular}
c             S   s   i | ]
}||qS r   r   ).0r/   r   r   r   
<dictcomp>   s    z8TestToLatex.test_to_latex_multiindex.<locals>.<dictcomp>   c             S   s   i | ]}|d  |qS )r=   r   )r;   r/   r   r   r   r<      s    c             S   s   i | ]
}||qS r   r   )r;   r/   r   r   r   r<      s    c             S   s   i | ]}|d  |qS )r=   r   )r;   r/   r   r   r   r<      s    c             S   s   i | ]
}||qS r   r   )r;   r/   r   r   r   r<      s    ))c1r   )r>   r   )c2r   )r?   r   )c3r   z\begin{tabular}{llrrrr}
\toprule
   &   &  0 &  1 &  2 &  3 \\
\midrule
c1 & 0 &  0 &  1 &  2 &  3 \\
   & 1 &  4 &  5 &  6 &  7 \\
c2 & 0 &  0 &  1 &  2 &  3 \\
   & 1 &  4 &  5 &  6 &  7 \\
c3 & 0 &  0 &  1 &  2 &  3 \\
\bottomrule
\end{tabular}
r   a  \begin{tabular}{lrrrrr}
\toprule
a & \multicolumn{2}{l}{c1} & \multicolumn{2}{l}{c2} & c3 \\
b &  0 &  1 &  0 &  1 &  0 \\
\midrule
0 &  0 &  4 &  0 &  4 &  0 \\
1 &  1 &  5 &  1 &  5 &  1 \\
2 &  2 &  6 &  2 &  6 &  2 \\
3 &  3 &  7 &  3 &  7 &  3 \\
\bottomrule
\end{tabular}
r   r   Zababr   r)   )r   r   cz\begin{tabular}{llr}
\toprule
  &   &  c \\
a & b &    \\
\midrule
0 & a &  1 \\
  & b &  2 \\
1 & a &  3 \\
  & b &  4 \\
\bottomrule
\end{tabular}
a}  \begin{tabular}{lrrrrrrrr}
\toprule
{} & \multicolumn{8}{l}{c} \\
{} & count & mean &       std &  min &   25\% &  50\% &   75\% &  max \\
a &       &      &           &      &       &      &       &      \\
\midrule
0 &   2.0 &  1.5 &  0.707107 &  1.0 &  1.25 &  1.5 &  1.75 &  2.0 \\
1 &   2.0 &  3.5 &  0.707107 &  3.0 &  3.25 &  3.5 &  3.75 &  4.0 \\
\bottomrule
\end{tabular}
)r   r	   r   T	from_dictpdr   rangecolumnsnameslist	set_indexgroupbyZdescribe)r   r   r%   r&   r   r   r   test_to_latex_multiindex   s8    	
 &z$TestToLatex.test_to_latex_multiindexc             C   s8   t jt jddgdgd}| }d}||ks4td S )N)ArA   )BrA   col)r   rF   zq\begin{tabular}{lll}
\toprule
  &   &  col \\
\midrule
A & c &  NaN \\
B & c &  NaN \\
\bottomrule
\end{tabular}
)rD   r   
MultiIndexfrom_tuplesr	   r   )r   r   r%   r&   r   r   r   #test_to_latex_multiindex_dupe_level   s
    	z/TestToLatex.test_to_latex_multiindex_dupe_levelc          	   C   s   t dd tdD dd tdD dd tdD dd tdD dd tdD d}| }d	}||kstt|jd
d}d}||kst|jjdd}d}||kst|jj|_|jjdddd}d}||kstd S )Nc             S   s   i | ]
}||qS r   r   )r;   r/   r   r   r   r<     s    z<TestToLatex.test_to_latex_multicolumnrow.<locals>.<dictcomp>r(   c             S   s   i | ]}|d  |qS )r(   r   )r;   r/   r   r   r   r<     s    c             S   s   i | ]
}||qS r   r   )r;   r/   r   r   r   r<     s    c             S   s   i | ]}|d  |qS )r(   r   )r;   r/   r   r   r   r<     s    c             S   s   i | ]
}||qS r   r   )r;   r/   r   r   r   r<     s    ))r>   r   )r>   r   )r?   r   )r?   r   )r@   r   a6  \begin{tabular}{lrrrrr}
\toprule
{} & \multicolumn{2}{l}{c1} & \multicolumn{2}{l}{c2} & c3 \\
{} &  0 &  1 &  0 &  1 &  0 \\
\midrule
0 &  0 &  5 &  0 &  5 &  0 \\
1 &  1 &  6 &  1 &  6 &  1 \\
2 &  2 &  7 &  2 &  7 &  2 \\
3 &  3 &  8 &  3 &  8 &  3 \\
4 &  4 &  9 &  4 &  9 &  4 \\
\bottomrule
\end{tabular}
F)multicolumna  \begin{tabular}{lrrrrr}
\toprule
{} & c1 &    & c2 &    & c3 \\
{} &  0 &  1 &  0 &  1 &  0 \\
\midrule
0 &  0 &  5 &  0 &  5 &  0 \\
1 &  1 &  6 &  1 &  6 &  1 \\
2 &  2 &  7 &  2 &  7 &  2 \\
3 &  3 &  8 &  3 &  8 &  3 \\
4 &  4 &  9 &  4 &  9 &  4 \\
\bottomrule
\end{tabular}
T)multirowaQ  \begin{tabular}{llrrrrr}
\toprule
   &   &  0 &  1 &  2 &  3 &  4 \\
\midrule
\multirow{2}{*}{c1} & 0 &  0 &  1 &  2 &  3 &  4 \\
   & 1 &  5 &  6 &  7 &  8 &  9 \\
\cline{1-7}
\multirow{2}{*}{c2} & 0 &  0 &  1 &  2 &  3 &  4 \\
   & 1 &  5 &  6 &  7 &  8 &  9 \\
\cline{1-7}
c3 & 0 &  0 &  1 &  2 &  3 &  4 \\
\bottomrule
\end{tabular}
rA   )rS   rR   Zmulticolumn_formata  \begin{tabular}{llrrrrr}
\toprule
   &   & \multicolumn{2}{c}{c1} & \multicolumn{2}{c}{c2} & c3 \\
   &   &  0 &  1 &  0 &  1 &  0 \\
\midrule
\multirow{2}{*}{c1} & 0 &  0 &  1 &  2 &  3 &  4 \\
   & 1 &  5 &  6 &  7 &  8 &  9 \\
\cline{1-7}
\multirow{2}{*}{c2} & 0 &  0 &  1 &  2 &  3 &  4 \\
   & 1 &  5 &  6 &  7 &  8 &  9 \\
\cline{1-7}
c3 & 0 &  0 &  1 &  2 &  3 &  4 \\
\bottomrule
\end{tabular}
)rD   r   rE   r	   r   rB   r   )r   r   r%   r&   r   r   r   test_to_latex_multicolumnrow	  s&    
z(TestToLatex.test_to_latex_multicolumnrowc             C   sb   d}d}|d|di|d|did}t |jdd}t | }d}d}||ksRt||ks^td S )Nr   r   )zco$e^x$zco^l1F)escapez\begin{tabular}{lll}
\toprule
{} & co$e^x$ & co^l1 \\
\midrule
a &       a &     a \\
b &       b &     b \\
\bottomrule
\end{tabular}
z\begin{tabular}{lll}
\toprule
{} & co\$e\textasciicircum x\$ & co\textasciicircum l1 \\
\midrule
a &       a &     a \\
b &       b &     b \\
\bottomrule
\end{tabular}
)r   r	   r   )r   r   r   Z	test_dictZunescaped_resultescaped_resultZunescaped_expectedescaped_expectedr   r   r   test_to_latex_escapeW  s    

z TestToLatex.test_to_latex_escapec             C   s*   t dddg}| }d}||ks&td S )Nza\b\cz^a^b^cz~a~b~cz\begin{tabular}{ll}
\toprule
{} &       0 \\
\midrule
0 &   a\textbackslash b\textbackslash c \\
1 &  \textasciicircum a\textasciicircum b\textasciicircum c \\
2 &  \textasciitilde a\textasciitilde b\textasciitilde c \\
\bottomrule
\end{tabular}
)r   r	   r   )r   r   rV   rW   r   r   r   test_to_latex_special_escapew  s    
z(TestToLatex.test_to_latex_special_escapec             C   s   t ddgddgd}|jdd}d}||ks2t|jd	dd
}d}||ksPtt dddgi}|jd	dd
}d|ksztt ddgddgddgd}|jd	dd
}d|kstd S )Nr   r   r   r   )r   r   T)r$   z\begin{longtable}{lrl}
\toprule
{} &  a &   b \\
\midrule
\endhead
\midrule
\multicolumn{3}{r}{{Continued on next page}} \\
\midrule
\endfoot

\bottomrule
\endlastfoot
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\end{longtable}
F)r   r$   z\begin{longtable}{rl}
\toprule
 a &   b \\
\midrule
\endhead
\midrule
\multicolumn{2}{r}{{Continued on next page}} \\
\midrule
\endfoot

\bottomrule
\endlastfoot
 1 &  b1 \\
 2 &  b2 \\
\end{longtable}
r   z\multicolumn{1}r)   r=   r(      )r   r   rA   z\multicolumn{3})r   r	   r   )r   r   r   r   r   r    Zwith1column_resultZwith3columns_resultr   r   r   test_to_latex_longtable  s    z#TestToLatex.test_to_latex_longtablec       
      C   sx   d}d}t ddgddgd}|j|d}d	}||ks:t|j|d
}d}||ksVt|j||d}d}	||	ksttd S )Nz/a table in a \texttt{table/tabular} environmentztab:table_tabularr   r   r   r   )r   r   )captionz\begin{table}
\centering
\caption{a table in a \texttt{table/tabular} environment}
\begin{tabular}{lrl}
\toprule
{} &  a &   b \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
\end{table}
)labelz\begin{table}
\centering
\label{tab:table_tabular}
\begin{tabular}{lrl}
\toprule
{} &  a &   b \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
\end{table}
)r\   r]   z\begin{table}
\centering
\caption{a table in a \texttt{table/tabular} environment}
\label{tab:table_tabular}
\begin{tabular}{lrl}
\toprule
{} &  a &   b \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
\end{table}
)r   r	   r   )
r   the_caption	the_labelr   result_c
expected_cresult_l
expected_l	result_clexpected_clr   r   r   test_to_latex_caption_label  s    z'TestToLatex.test_to_latex_caption_labelc       
      C   s~   d}d}t ddgddgd}|jd|d	}d
}||ks<t|jd|d}d}||ksZt|jd||d}d}	||	ksztd S )Nz+a table in a \texttt{longtable} environmentztab:longtabler   r   r   r   )r   r   T)r$   r\   a  \begin{longtable}{lrl}
\caption{a table in a \texttt{longtable} environment}\\
\toprule
{} &  a &   b \\
\midrule
\endhead
\midrule
\multicolumn{3}{r}{{Continued on next page}} \\
\midrule
\endfoot

\bottomrule
\endlastfoot
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\end{longtable}
)r$   r]   z\begin{longtable}{lrl}
\label{tab:longtable}\\
\toprule
{} &  a &   b \\
\midrule
\endhead
\midrule
\multicolumn{3}{r}{{Continued on next page}} \\
\midrule
\endfoot

\bottomrule
\endlastfoot
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\end{longtable}
)r$   r\   r]   a%  \begin{longtable}{lrl}
\caption{a table in a \texttt{longtable} environment}\label{tab:longtable}\\
\toprule
{} &  a &   b \\
\midrule
\endhead
\midrule
\multicolumn{3}{r}{{Continued on next page}} \\
\midrule
\endfoot

\bottomrule
\endlastfoot
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\end{longtable}
)r   r	   r   )
r   r^   r_   r   r`   ra   rb   rc   rd   re   r   r   r   %test_to_latex_longtable_caption_label  s    z1TestToLatex.test_to_latex_longtable_caption_labelc          
   C   s>   ddddddddd	d
g
}t |d}| }d}||ks:td S )N&%$#_{}~^\)dataz\begin{tabular}{ll}
\toprule
{} &  0 \\
\midrule
0 &  \& \\
1 &  \% \\
2 &  \$ \\
3 &  \# \\
4 &  \_ \\
5 &  \{ \\
6 &  \} \\
7 &  \textasciitilde  \\
8 &  \textasciicircum  \\
9 &  \textbackslash  \\
\bottomrule
\end{tabular}
)r   r	   r   )r   Zspecial_charactersr   observedr&   r   r   r   "test_to_latex_escape_special_chars@  s
    
z.TestToLatex.test_to_latex_escape_special_charsc             C   sT   t ddgddgd}|jdd}d}||ks2t|jddd	}d
}||ksPtd S )Nr   r   r   r   )r   r   F)headerzX\begin{tabular}{lrl}
\toprule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
)r   ru   zO\begin{tabular}{rl}
\toprule
 1 &  b1 \\
 2 &  b2 \\
\bottomrule
\end{tabular}
)r   r	   r   )r   r   r   r   r   r    r   r   r   test_to_latex_no_headerX  s    z#TestToLatex.test_to_latex_no_headerc       	   	   C   s   t ddgddgd}|jddgd}d	}||ks6t|jddgd
d}d}||ksXt|jddgd
d}d}||ksztd}tjt|d |jdgd W d Q R X d S )Nr   r   r   r   )r   r   ZAABB)ru   zr\begin{tabular}{lrl}
\toprule
{} & AA &  BB \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
F)ru   r   zd\begin{tabular}{rl}
\toprule
AA &  BB \\
\midrule
 1 &  b1 \\
 2 &  b2 \\
\bottomrule
\end{tabular}
z$A$z$B$)ru   rU   zu\begin{tabular}{lrl}
\toprule
{} & $A$ & $B$ \\
\midrule
0 &   1 &  b1 \\
1 &   2 &  b2 \\
\bottomrule
\end{tabular}
z Writing 2 cols but got 1 aliases)matchrL   )r   r	   r   pytestZraises
ValueError)	r   r   r   r   r   r    Zwithoutescape_resultZwithoutescape_expectedmsgr   r   r   test_to_latex_specified_headerq  s    			z*TestToLatex.test_to_latex_specified_headerc             C   s>   |   tddgddgd}|j dd}d}||ks:td S )	Ng      ?g @r   r   )r   r   ,)decimalzx\begin{tabular}{lrl}
\toprule
{} &    a &   b \\
\midrule
0 &  1,0 &  b1 \\
1 &  2,1 &  b2 \\
\bottomrule
\end{tabular}
)r	   r   r   )r   r   r   r   r   r   r   r   test_to_latex_decimal  s
    
z!TestToLatex.test_to_latex_decimalc             C   s*   t dddg}| }d}||ks&td S )Nr   r   rA   zi\begin{tabular}{ll}
\toprule
{} &  0 \\
\midrule
0 &  a \\
1 &  b \\
2 &  c \\
\bottomrule
\end{tabular}
)r   r	   r   )r   sr   r   r   r   r   test_to_latex_series  s    
z TestToLatex.test_to_latex_seriesc             C   s8   t ddgddgd}|jdd}d}||ks4td S )	Nr   r   r   r   )r   r   T)	bold_rowsz\begin{tabular}{lrl}
\toprule
{} &  a &   b \\
\midrule
\textbf{0} &  1 &  b1 \\
\textbf{1} &  2 &  b2 \\
\bottomrule
\end{tabular}
)rD   r   r	   r   )r   r   rs   r&   r   r   r   test_to_latex_bold_rows  s    	z#TestToLatex.test_to_latex_bold_rowsc             C   s8   t ddgddgd}|jdd}d}||ks4td S )	Nr   r   r   r   )r   r   F)r   zr\begin{tabular}{lrl}
\toprule
{} &  a &   b \\
\midrule
0 &  1 &  b1 \\
1 &  2 &  b2 \\
\bottomrule
\end{tabular}
)rD   r   r	   r   )r   r   rs   r&   r   r   r   test_to_latex_no_bold_rows  s    	z&TestToLatex.test_to_latex_no_bold_rowsname0NZnamed0name1Znamed1axesr   r   c                s   ||g}t jddgddgg}t jd| | d}x D ]}||j| _q>W tdd |D }d	 krt|r|d	  d
|d  dnd}	t|rd krdnd fdd|D }
|	 }dtt
|
|	g  }||kstd S )Nr   r   r)   r=   )r   rF   c             s   s   | ]}|pd V  qdS )z{}Nr   )r;   nr   r   r   	<genexpr>  s    z=TestToLatex.test_to_latex_multiindex_names.<locals>.<genexpr>r   z & z &    &    &    &    \\
 z{} c                s$   g | ]}t |rd  kr|nqS )r   )bool)r;   r   )r   placeholderr   r   
<listcomp>  s    z>TestToLatex.test_to_latex_multiindex_names.<locals>.<listcomp>a  \begin{tabular}{llrrrr}
\toprule
  & %s & \multicolumn{2}{l}{1} & \multicolumn{2}{l}{2} \\
  & %s &  3 &  4 &  3 &  4 \\
%s\midrule
1 & 3 & -1 & -1 & -1 & -1 \\
  & 4 & -1 & -1 & -1 & -1 \\
2 & 3 & -1 & -1 & -1 & -1 \\
  & 4 & -1 & -1 & -1 & -1 \\
\bottomrule
\end{tabular}
)rD   rO   from_productr   copyr   rG   tupleanyr	   rH   r   )r   r   r   r   rG   mir   idxZ	idx_namesZidx_names_rowZ	col_namesrs   r&   r   )r   r   r   test_to_latex_multiindex_names  s    
(z*TestToLatex.test_to_latex_multiindex_namesone_rowTFc             C   sh   t d dgddgddgd}|r.|jdg }|dd	g }d
}|sP|d7 }|d7 }||ksdtd S )Nr   r   r)   r=   r(   )r   r   rA   r   r   r   zU\begin{tabular}{llr}
\toprule
    &   &  c \\
a & b &    \\
\midrule
NaN & 2 &  4 \\
z1.0 & 3 &  5 \\
z\bottomrule
\end{tabular}
)rD   r   ZilocrI   r	   r   )r   r   r   rs   r&   r   r   r   test_to_latex_multiindex_nans  s    z)TestToLatex.test_to_latex_multiindex_nansc             C   s8   t dddggd ddg }d}||ks4td S )Nr   r   r)   r   zy\begin{tabular}{llr}
\toprule
  &   &  2 \\
0 & 1 &    \\
\midrule
1 & 2 &  3 \\
  & 2 &  3 \\
\bottomrule
\end{tabular}
)rD   r   rI   r	   r   )r   rs   r&   r   r   r   test_to_latex_non_string_index  s    $
z*TestToLatex.test_to_latex_non_string_indexc             C   s:   t dddgi}d|j_|jdd}d}||ks6td S )Nr   r   r   ZfooF)Zindex_namesz_\begin{tabular}{lr}
\toprule
{} &  a \\
\midrule
0 &  1 \\
1 &  2 \\
\bottomrule
\end{tabular}
)rD   r   r   namer	   r   )r   r   rs   r&   r   r   r   test_to_latex_midrule_location(  s
    	z*TestToLatex.test_to_latex_midrule_locationc             C   sH   t jjddggdgd}t jd|tdd}| }d}||ksDtd S )	Nr   r   r   )rG   r   r=   )r   rF   z\begin{tabular}{lrrrr}
\toprule
  &  0 &  1 &  2 &  3 \\
{} &    &    &    &    \\
\midrule
1 & -1 & -1 & -1 & -1 \\
2 & -1 & -1 & -1 & -1 \\
\bottomrule
\end{tabular}
)rD   rO   r   r   rE   r	   r   )r   r   r   rs   r&   r   r   r   #test_to_latex_multiindex_empty_name9  s
    
z/TestToLatex.test_to_latex_multiindex_empty_namec             C   sP   t ddgi}d}|jdd|ks&tt ddgi}d}|jdd|ksLtd S )	Nr/   gvöE?z[\begin{tabular}{lr}
\toprule
{} &     x \\
\midrule
0 & 0.200 \\
\bottomrule
\end{tabular}
z%.3f)Zfloat_formatg      Y@zW\begin{tabular}{lr}
\toprule
{} &   x \\
\midrule
0 & 100 \\
\bottomrule
\end{tabular}
z%.0f)r   r	   r   )r   r   r&   r   r   r   )test_to_latex_float_format_no_fixed_widthJ  s    z5TestToLatex.test_to_latex_float_format_no_fixed_widthc             C   sJ   t dgdgdgdgdddg}|jdd	gd
}d}||ksFtd S )Nr   r   r   r)   )r   r   rA   dr   r   Zr1Zr2)ru   z{\begin{tabular}{llrr}
\toprule
  &   & r1 & r2 \\
a & b &    &    \\
\midrule
0 & 1 &  2 &  3 \\
\bottomrule
\end{tabular}
)rD   r   rI   r	   r   )r   r   rs   r&   r   r   r   test_to_latex_multindex_headerd  s
    
	z*TestToLatex.test_to_latex_multindex_header)!__name__
__module____qualname__r   r!   r#   r'   r9   rK   rQ   rT   rX   rY   r[   rf   rg   rt   rv   r|   r   r   r   r   ry   markZparametrizer   r   r   r   r   r   r   r   r   r   r   r      s:   #gN 2>I.("r   )r   r   ry   ZpandasrD   r   r   Zpandas._testingZ_testingr   r   r   r   r   r   <module>   s   