
    M/Phd                     z   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dS )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                 0    | j         t          j        u rdS d S )Nmissing)datanpnan)cells    i/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/statsmodels/iolib/tests/test_table_econpy.pycustom_labellerr-   2   s    yBFy     c                       e Zd Zd ZdS )TestCellc                     t           t          t          d         t          d         f}d t          |          D             }t	          ||          D ]\  }}t          |j        |           d S )Nr   r   c                 <    g | ]\  }}t          ||d z            S )r   )datatype)r   ).0idatums      r,   
<listcomp>z*TestCell.test_celldata.<locals>.<listcomp>:   s=     6 6 6Q ea!e,,, 6 6 6r.   )	cell0data	cell1datarow1data	enumeratezipr   r(   )selfcelldatacellsr+   r6   s        r,   test_celldatazTestCell.test_celldata8   sz    i!hqkA6 6!*8!4!46 6 6uh// 	+ 	+KD%E****	+ 	+r.   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dS )TestSimpleTablec                 b    d}dt                                           z  }t          ||           d S )Nz
*****************************
*       * header1 * header2 *
*****************************
* stub1 *    0.00 *       1 *
* stub2 *    2.00 *       3 *
*****************************

%s
)tblas_textr   r=   desiredactuals      r,   test_txt_fmt1zTestSimpleTable.test_txt_fmt1A   s5     CKKMM)
 	VW%%%%%r.   c                 b    d}dt                                           z  }t          ||           d S )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}
rH   )rI   as_latex_tabularr   rK   s      r,   test_ltx_fmt1zTestSimpleTable.test_ltx_fmt1Q   s9     C00222 	VW%%%%%r.   c                     d}dt                                           z  }d                    d |                    d          D                       }t	          ||           d S )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>
rH   
c              3   >   K   | ]}|                                 V  d S )N)rstrip)r4   lines     r,   	<genexpr>z1TestSimpleTable.test_html_fmt1.<locals>.<genexpr>v   s*      HHT4;;==HHHHHHr.   )rI   as_htmljoinsplitr   rK   s      r,   test_html_fmt1zTestSimpleTable.test_html_fmt1d   sa     CKKMM)HHV\\$5G5GHHHHH 	VW%%%%%r.   c                    t          t          t          t          t                    }t
          j        |d         d         _        |                    t                     d}d|
                    d          z  }t          ||           d S )N)r#   r   z
*****************************
*       * header1 * header2 *
*****************************
* stub1 *    --   *       1 *
* stub2 *    2.00 *       3 *
*****************************
rH   z--)r'   )r   
table1datatest1header
test1stubstxt_fmt1r)   r*   r(   label_cellsr-   rJ   r   )r=   rI   rL   rM   s       r,   test_customlabelz TestSimpleTable.test_customlabel|   sr    *k:xPPPAq	((( CKKK555VW%%%%%r.   N)rA   rB   rC   rN   rQ   r[   rb   rD   r.   r,   rF   rF   @   sP        & & & & & &&& & &0& & & & &r.   rF   rD   )__doc__numpyr)   numpy.testingr   __docformat__statsmodels.iolib.tabler   r   r   r   copyltx_fmt1	html_fmt1dictr`   r8   r9   row0datar:   r]   r_   r^   rI   r-   r0   rF   rD   r.   r,   <module>rm      s1        & & & & & &% 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4!!##!!##	4   $  5	
 d t C C S  t  3 # #  %!$ 		y!u:#

$k*k:h< < <  
+ + + + + + + +K& K& K& K& K& K& K& K& K& K&r.   