
    'YHhd                     n   d Z ddlZddlmZ dZddlmZmZ ddlm	Z	 ddlm
Z
  e	j                         Z e
j                         Z ed/i dd	d
gddddddddddddddddddddddddddd d!d"d#Zd$ZdZeegZd%d&gZeegZd'Zd(Z eeeeeee)      Zd* Z G d+ d,      Z G d- d.      Zy)0a  
Unit tests table.py.

:see: http://docs.python.org/lib/minimal-example.html for an intro to unittest
:see: http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html
:see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292
    N)assert_equalzrestructuredtext en)CellSimpleTable)default_latex_fmt)default_html_fmt	data_fmtsz%0.2fz%d
empty_cell 	colwidths   colsepz * row_prez* row_postz *table_dec_above*table_dec_belowheader_dec_below
header_fmtz%sstub_fmttitle_alignrheader_aligndata_alignsstubs_alignlfmttxtg           gDl
@)stub1stub2)header1header2)txt_fmtltx_fmthtml_fmtc                 >    | j                   t        j                  u ryy )Nmissing)datanpnan)cells    b/var/www/html/planif/env/lib/python3.12/site-packages/statsmodels/iolib/tests/test_table_econpy.pycustom_labellerr-   2   s    yyBFF     c                       e Zd Zd Zy)TestCellc           	          t         t        t        d   t        d   f}t        |      D cg c]  \  }}t	        ||dz         }}}t        ||      D ]  \  }}t        |j                  |        y c c}}w )Nr   r   r   )datatype)	cell0data	cell1datarow1data	enumerater   zipr   r(   )selfcelldataidatumcellsr+   s         r,   test_celldatazTestCell.test_celldata8   sv    i!hqkA!*8!46Q ea!e, 6 6uh/ 	+KD%E*	+6s   A3N)__name__
__module____qualname__r=    r.   r,   r0   r0   7   s    +r.   r0   c                   $    e Zd Zd Zd Zd Zd Zy)TestSimpleTablec                 N    d}dt         j                         z  }t        ||       y )Nz
*****************************
*       * header1 * header2 *
*****************************
* stub1 *    0.00 *       1 *
* stub2 *    2.00 *       3 *
*****************************

%s
)tblas_textr   r8   desiredactuals      r,   test_txt_fmt1zTestSimpleTable.test_txt_fmt1A   s'     CKKM)
 	VW%r.   c                 N    d}dt         j                         z  }t        ||       y )Na	  
\begin{center}
\begin{tabular}{lcc}
\toprule
               & \textbf{header1} & \textbf{header2}  \\
\midrule
\textbf{stub1} &       0.0        &        1          \\
\textbf{stub2} &        2         &      3.333        \\
\bottomrule
\end{tabular}
\end{center}
rE   )rF   as_latex_tabularr   rH   s      r,   test_ltx_fmt1zTestSimpleTable.test_ltx_fmt1Q   s*     C0022 	VW%r.   c                     d}dt         j                         z  }dj                  d |j                  d      D              }t	        ||       y )Nz
<table class="simpletable">
<tr>
    <td></td>    <th>header1</th> <th>header2</th>
</tr>
<tr>
  <th>stub1</th>   <td>0.0</td>      <td>1</td>
</tr>
<tr>
  <th>stub2</th>    <td>2</td>     <td>3.333</td>
</tr>
</table>
rE   
c              3   <   K   | ]  }|j                           y w)N)rstrip).0lines     r,   	<genexpr>z1TestSimpleTable.test_html_fmt1.<locals>.<genexpr>v   s     HT4;;=Hs   )rF   as_htmljoinsplitr   rH   s      r,   test_html_fmt1zTestSimpleTable.test_html_fmt1d   sD     CKKM)HV\\$5GHH 	VW%r.   c                     t        t        t        t        t              }t
        j                  |d   d   _        |j                  t               d}d|j                  d      z  }t        ||       y )N)r#   r   z
*****************************
*       * header1 * header2 *
*****************************
* stub1 *    --   *       1 *
* stub2 *    2.00 *       3 *
*****************************
rE   z--)r'   )r   
table1datatest1header
test1stubstxt_fmt1r)   r*   r(   label_cellsr-   rG   r   )r8   rF   rI   rJ   s       r,   test_customlabelz TestSimpleTable.test_customlabel|   sY    *k:xPAq	( CKKK55VW%r.   N)r>   r?   r@   rK   rN   rY   r`   rA   r.   r,   rC   rC   @   s    & &&&0&r.   rC   rA   )__doc__numpyr)   numpy.testingr   __docformat__statsmodels.iolib.tabler   r   r   r   copyltx_fmt1	html_fmt1dictr^   r3   r4   row0datar5   r[   r]   r\   rF   r-   r0   rC   rA   r.   r,   <module>rk      sQ    &% 5 5 4!!!#!!!#	 $  	
             !$ 		y!u:#

$*k:h<
+ +K& K&r.   