
    d"                     t   d Z ddlZddlmZ ddlZddlmZ  G d dej	                  Z
d Zd Z G d	 d
ej        ej                  Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d dej        ej                  Z G d de          Z G d de          Z G d de          Z G d de          Z G d d ej                  Z G d! d"ej                  Z G d# d$ej        ej                  Z G d% d&ej        ej                  Z G d' d(e          Z G d) d*e          Z G d+ d,e          Z  G d- d.e          Z! G d/ d0e          Z" G d1 d2e          Z# G d3 d4ej        ej                  Z$ G d5 d6e$          Z% G d7 d8e$          Z& G d9 d:e$          Z' G d; d<e$          Z( G d= d>e$          Z) G d? d@ej        ej                  Z* G dA dBej        ej                  Z+ G dC dDej        ej                  Z, G dE dFe,          Z- G dG dHe,          Z. G dI dJe,          Z/ G dK dLe,          Z0 G dM dNej        ej                  Z1 G dO dPe1          Z2 G dQ dRe1          Z3 G dS dTej        ej                  Z4 G dU dVe4          Z5 G dW dXe4          Z6 G dY dZe4          Z7 G d[ d\e4          Z8 G d] d^e4          Z9 G d_ d`e4          Z: G da dbej        ej                  Z; G dc dde;          Z< G de dfe;          Z= G dg dhe;          Z> G di dje;          Z? G dk dle;          Z@ G dm dne;          ZA G do dpe;          ZB G dq dre;          ZC G ds dte;          ZD G du dve;          ZE G dw dxej        ej                  ZF G dy dzeF          ZG G d{ d|eF          ZHd} ZIeJd~k    rEddlKZK ejL        eKjM                    ejN                     ejO        P                    d           dS dS )z6Test module for evaluating expressions under PyTables.    N)testing)commonc                       e Zd Z ej                    Z ej                    Z ej                    Z	 ej
                    Z ej        d          ZdS )Record   )itemsizeN)__name__
__module____qualname__tbInt32ColcolInt32Int64ColcolInt64
Float32Col
colFloat32
Float64Col
colFloat64
ComplexCol
colComplex     <lib/python3.11/site-packages/tables/tests/test_expression.pyr   r      sV        r{}}Hr{}}HJJ+++JJJr   r   c                     i }|                                  D ])\  }}t          |d          r||||         ||<   $|||<   *|S )N__len__)itemshasattr)npvarsstartstopstepnpvars_namevars          r   get_sliced_varsr%      sZ    G\\^^    	c3	"" 	 d40GDMMGDMMNr   c                     i }d |D             }t          |||          ||<   |                                 D ]*\  }}	|	                    t          |                    ||<   +|S )Nc                 ,    g | ]}t          d           S )N)slice).0dims     r   
<listcomp>z$get_sliced_vars2.<locals>.<listcomp>"   s    +++ceDkk+++r   )r(   r   __getitem__tuple)
r   r   r    r!   shapemaindimr"   slicesr#   r$   s
             r   get_sliced_vars2r1       sl    G++U+++FE4..F7O\\^^ 7 7	cf66Nr   c                   4     e Zd ZdZ fdZd Zd Zd Z xZS )ExprTestCase)
      c                    t                                                       d| _        t          j        | j                  }t          j        d|d                              | j                  x| _        }t          j        |d|z  d                              | j                  x| _	        }t          j        d|z  d|z  d                              | j                  x| _
        }t          j        |d                              | j                  x| _        }|||d| _        | j        j        }| j        d	k    r| j                            |d
|          | _        | j                            |d|          | _	        | j                            |d|          | _
        | j                            |d|          | _        n| j        dk    rN| j                            |d
t&          j                            |j                  | j                  | _        | j                            |dt&          j                            |j                  | j                  | _	        | j                            |dt&          j                            |j                  | j                  | _
        | j                            |dt&          j                            |j                  | j                  | _        || j        d d <   || j	        d d <   || j
        d d <   nF| j        dk    rt/          | j                  }d|d<   | j                            |d
t&          j                            |j                  |          | _        | j                            |dt&          j                            |j                  |          | _	        | j                            |dt&          j                            |j                  |          | _
        | j                            |dt&          j                            |j                  |          | _        | j                            |           | j	                            |           | j
                            |           | j                            |           n| j        dk    rt          j                            ||||gd| j        dd          fdz  z            }| j                            |d|          }	|	j        j        | _        |	j        j        | _	        |	j        j         | _
        |	j        j!        | _"        | j        | j	        | j
        d| _#        d S )Nz2 * a*b + cr   int32dtype   int64   abcArrayr>   r?   r@   r1CArrayatomr.   EArrayColumnz%si4,%si8,%si4,%si8      t)$supersetUpexprnpprodr.   arangereshaper>   r?   r@   emptyrB   r   h5filerootkindcreate_arraycreate_carrayr   Atom
from_dtyper9   listcreate_earrayappendrec
fromarrayscreate_tablecolsf0f1f2f3dvars)selfNr>   r?   r@   rB   rT   r.   rarJ   	__class__s             r   rL   zExprTestCase.setUp/   s    "	GDJYq!7333;;DJGGGYq!a%w777??
KKKYq1uac999AA$*MMMx11199$*EEE"AA00{9[--dC;;DF[--dC;;DF[--dC;;DFk..tT2>>DGGY(""[..c 2 217 ; ;j / " "DF [..c 2 217 ; ;j / " "DF [..c 2 217 ; ;j / " "DF k//d!3!3BH!=!=j 0 " "DG DF111IDF111IDF111IIY(""$$EE!H[..c 2 217 ; ;5 / J JDF[..c 2 217 ; ;5 / J JDF[..c 2 217 ; ;5 / J JDFk//d!3!3BH!=!=U 0 L LDGFMM!FMM!FMM!GNN2Y(""""Aq"+
122/@/BC # E EB ((sB77AVYDFVYDFVYDFVYDF&tvDF==			r   c                 ~   t          j        | j        | j                  }|                                }t	          | j        | j                  }t          j        r:t          dt          |                     t          dt          |                     | 
                    t          j        ||          d           dS )z0Checking that expression is correctly evaluated.Computed expression:Should look like:$Evaluate is returning a wrong value.N)r   ExprrM   rf   evalr   r   verboseprintrepr
assertTrueareArraysEqualrg   rM   rB   r2s       r   test00_simplezExprTestCase.test00_simplel   s     wty$),,YY[[$)T[))> 	1($r((333%tBxx000-b"55>	@ 	@ 	@ 	@ 	@r   c                    t          j        | j        | j                  }|                    | j                   |                                }| j        dk    r
|dd         }t          | j        | j                  }t          j
        r:t          dt          |                     t          dt          |                     |                     t          j        ||          d           dS )z=Checking that expression is correctly evaluated (`out` param)NumPyNrl   rm   rn   )r   ro   rM   rf   
set_outputrB   rp   rU   r   r   rq   rr   rs   rt   ru   rv   s       r   
test01_outzExprTestCase.test01_outx   s     wty$),,   YY[[9AAAB$)T[))> 	1($r((333%tBxx000-b"55>	@ 	@ 	@ 	@ 	@r   c                    t          j        | j        | j                  }t	          | j                  }|dz   |dz   d}}}|                    |||           |                                }t          j	        | j        |j
                  }||||         }|                     |                                |                                           t          j        r:t          dt!          |                     t          dt!          |                     |                     t          j        ||          d           dS )zkChecking that expression is correctly evaluated when slice is
        outside of data samples (`out` param)rH   r:   N)r.   r9   rl   rm   rn   )r   ro   rM   rf   maxr.   set_inputs_rangerp   rN   zerosr9   assertListEqualtolistr   rq   rr   rs   rt   ru   )	rg   rM   maxshaper   r    r!   rB   r   rw   s	            r   
test02_outzExprTestCase.test02_out   s    wty$),,tz??%\8a<TteT4000YY[[tz:::5d?#RYY[["))++666> 	1($r((333%tBxx000-b"55>	@ 	@ 	@ 	@ 	@r   )	r	   r
   r   r.   rL   rx   r|   r   __classcell__rj   s   @r   r3   r3   *   sz         E;> ;> ;> ;> ;>z
@ 
@ 
@@ @ @@ @ @ @ @ @ @r   r3   c                       e Zd ZdZdS )	ExprNumPyrz   Nr	   r
   r   rU   r   r   r   r   r              DDDr   r   c                       e Zd ZdZdS )	ExprArrayrA   Nr   r   r   r   r   r      r   r   r   c                       e Zd ZdZdS )
ExprCArrayrC   Nr   r   r   r   r   r              DDDr   r   c                       e Zd ZdZdS )
ExprEArrayrF   Nr   r   r   r   r   r      r   r   r   c                       e Zd ZdZdS )
ExprColumnrG   Nr   r   r   r   r   r      r   r   r   c                   N     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Z xZS )
MixedContainersTestCasec           	         t                                                       d| _        | j        j        }| j                            |d          }t          j        | j                  }t          j	        d|d          
                    | j                  }t          j	        |d|z  d          
                    | j                  }t          j	        d|z  d|z  d          
                    | j                  }t          j	        d|z  d	|z  d          
                    | j                  }t          j	        d	|z  d
|z  d          
                    | j                  }t          d          x| _        }	t          j        d          x| _        }
||||||	|
d| _        |                                }|| _        || _        | j                            |d|          | _        | j                            |          | _        | j                            |dt.          j                            |j                  | j                  | _        || j        d d <   | j                            |          | _        t;          | j                  }d|d<   | j                            |dt.          j                            |j                  |          | _        | j                             |           | j                            |          | _!        i }| j        dd          }tE          ||||||f          D ]5\  }}t.          j#        $                    |j        j%        |          |d|z  <   6| j        &                    |d|          }| j        d         }|j'        }tQ          |          D ]?}tE          ||||||f          D ]\  }}||         |d|z  <   |                                  @|)                                 |j*        j+        | _,        |j*        j-        | _.        | j        | j        | j        | j        | j,        | j        | j        d| _/        d S )Nz2 * a*b + c**2+d**2+e-f+goutsr   r7   r8   r:   r;   r<   rI      )r>   r?   r@   re   efgr?   r@   rD   re   rH   zf%drJ   )0rK   rL   rM   rS   rT   create_grouprN   rO   r.   rP   rQ   intr   int16r   r   copyr>   rndarV   r?   rarrrW   r   rX   rY   r9   r@   rcarrrZ   r[   re   r\   rearr	enumerateColfrom_sctypetyper_   rowrangeflushr`   f4r   f5rcolrf   )rg   rT   r   rh   r>   r?   r@   re   r   r   r   r   eshapertypecolshapeicolrJ   nrowsr   nrowrj   s                        r   rL   zMixedContainersTestCase.setUp   s    0	 {{''f55 GDJ Ia'***224:>>IaQg...66tzBBIa!eQqS00088DDIa!eQqS00088DDIa!eQqS00088DDVVXa[[  AAAAAANNvvxx 	 ))$Q77FKK%%	 **#BG..qw77tz + K Kqqq	V[[&&
 dj!!q	**#BG..qw77v + G GaV[[&&
 :abb>Aq!Q 566 	L 	LFAs!v11#).(KKE%!)K$$T366
1e%LL 	 	D#Q1aD$9:: + +3!$TEAIJJLLLL				FI	&tvDF&tvDF> >			r   c                    t          j        | j        | j                  }|                                }t	          | j        | j                  }t          j        rFt          dt          |          |j
                   t          dt          |          |j
                   |                     t          j        ||          d           dS )z(Checking expressions with mixed objects.rl   rm   rn   N)r   ro   rM   rf   rp   r   r   rq   rr   rs   r9   rt   ru   rv   s       r   test00a_simplez&MixedContainersTestCase.test00a_simple   s     wty$),,YY[[$)T[))> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                    d}t          j        || j                  }|                                }t          || j                  }t
          j        rFt          dt          |          |j	                   t          dt          |          |j	                   | 
                    |j        |j        k    o|j	        |j	        k    o||k    d           dS )z7Checking that scalars in expression evaluate correctly.	2 * f + grl   rm   rn   N)r   ro   rf   rp   r   r   rq   rr   rs   r9   rt   r.   rg   expr_strrM   rB   rw   s        r   test00b_simple_scalarsz.MixedContainersTestCase.test00b_simple_scalars  s     wx++YY[[(DK((> 	;($r((BH===%tBxx:::H FRX%9FbBh2	4 	4 	4 	4 	4r   c                    t          j        | j        | j                  }| j        | j        | j        | j        | j        fD ]}t          j
        rt          dt          |                     |                    |           |                                }t          |t          | j                            s
|dd         }t          | j        | j                  }t          j
        rFt          dt#          |          |j                   t          dt#          |          |j                   |                     t          j        ||          d           dS )z5Checking expressions with mixed objects (`out` param)Checking output container:Nrl   rm   rn   )r   ro   rM   rf   r   r   r   r   r   r   rq   rr   r   r{   rp   
isinstancer   rs   r9   rt   ru   rv   s       r   test01a_outz#MixedContainersTestCase.test01a_out  s6    wty$),,)TY
DJ	I 	D 	DB~ >2DHH===OOBBb$ty//22 Udi--B~ ?,d2hhAAA)488RX>>>OOF1"b99BD D D D	D 	Dr   c                    t          | j                  dk    rdS d}t          j        || j                  }| j        | j        | j        | j        | j	        fD ]}t          j        rt          dt          |                     |                    |           |                                }|d         }t          || j                  }t          j        rFt          dt#          |          |j                   t          dt#          |          |j                   |                     t          j        ||          d           dS )	z>Checking expressions with mixed objects (`out` param, scalars)rH   Nr   r   r   rl   rm   rn   )lenr.   r   ro   rf   r   r   r   r   r   r   rq   rr   r   r{   rp   r   rs   r9   rt   ru   r   s        r   test01b_out_scalarsz+MixedContainersTestCase.test01b_out_scalars"  s1    tz??QFwx++)TY
DJ	I 	D 	DB~ >2DHH===OOBBBBh,,B~ ?,d2hhAAA)488RX>>>OOF1"b99BD D D D	D 	Dr   c                    | j         | j        d}}}t          j        | j        | j                  }|                    |||           |                                }t          | j	        |||          }t          | j        |          }t          j        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           dS )z0Checking mixed objects and start, stop, step (I)rH   rl   rm   rn   N)r   r    r   ro   rM   rf   r   rp   r%   r   r   rq   rr   rs   r9   rt   ru   rg   r   r    r!   rM   rB   r   rw   s           r   test02a_sssz#MixedContainersTestCase.test02a_sss7  s     "ZATtwty$),,eT4000YY[[ eT4@@$)V$$> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                    d| j         d         | j        }}}t          j        | j        | j                  }|                    |||           |                                }t          | j	        |||          }t          | j        |          }t          j        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           dS )z1Checking mixed objects and start, stop, step (II)r   rl   rm   rn   N)r.   r!   r   ro   rM   rf   r   rp   r%   r   r   rq   rr   rs   r9   rt   ru   r   s           r   test02b_sssz#MixedContainersTestCase.test02b_sssF  s     
1tyTtwty$),,eT4000YY[[ eT4@@$)V$$> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                    | j         | j        | j        }}}t          j        | j        | j                  }|                    |||           |                                }t          | j
        |||          }t          | j        |          }t          j        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           dS )z2Checking mixed objects and start, stop, step (III)rl   rm   rn   Nr   r    r!   r   ro   rM   rf   r   rp   r%   r   r   rq   rr   rs   r9   rt   ru   r   s           r   test02c_sssz#MixedContainersTestCase.test02c_sssU  s     "ZDITtwty$),,eT4000YY[[ eT4@@$)V$$> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                 ,   d | j         | j        | j        fD             \  }}}t          j        | j        | j                  }|                    |||           |                                }t          | j
        |||          }t          | j        |          }t          j        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           dS )z*Checking start, stop, step as numpy.int64.c                 6    g | ]}t          j        |          S r   )rN   r;   )r)   r   s     r   r+   z6MixedContainersTestCase.test03_sss.<locals>.<listcomp>g  s2     I I IQRXa[[ I I Ir   rl   rm   rn   Nr   r   s           r   
test03_sssz"MixedContainersTestCase.test03_sssd  s   I I&*j$)TY%GI I ItTwty$),,eT4000YY[[ eT4@@$)V$$> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   )r	   r
   r   rL   r   r   r   r   r   r   r   r   r   r   s   @r   r   r      s        A> A> A> A> A>F@ @ @4 4 4D D D$D D D*@ @ @@ @ @@ @ @@ @ @ @ @ @ @r   r   c                       e Zd ZdZd\  ZZZdS )MixedContainers0rH   )r   rH   rH   Nr	   r
   r   r.   r   r    r!   r   r   r   r   r   u  s        E!E4r   r   c                       e Zd ZdZd\  ZZZdS )MixedContainers1r4   )r<      r:   Nr   r   r   r   r   r   z  s        E!E4r   r   c                       e Zd ZdZd\  ZZZdS )MixedContainers2)r4   r   )r:   	   r<   Nr   r   r   r   r   r     s        E!E4r   r   c                       e Zd ZdZd\  ZZZdS )MixedContainers3)r4   r<   r:   )r:   rH   Nr   r   r   r   r   r     s        E"E4r   r   c                       e Zd Zd Zd ZdS )UnalignedObjectc                    t          j        dd          }t          j        dd          }|                                }|                                }t           j                            ||||g          }|d         }|d         }|                     |j        j        d           |                     |j        j        d           d}t          j
        |          }	|	                                }
t          |          }t          j        rFt          d	t          |
          |
j                   t          d
t          |          |j                   |                     t          j        |
|          d           dS )z,Checking expressions with unaligned objects.r4   int8r8   r7   rb   rc   F	2 * a + brl   rm   rn   N)rN   rR   rP   r   r]   r^   assertEqualflagsalignedr   ro   rp   r   rq   rr   rs   r9   rt   ru   rg   a0a1a2a3ri   r>   r?   sexprrM   rB   rw   s               r   rx   zUnalignedObject.test00_simple  sK    Xb'''Yr)))WWYYWWYYVBB/00tHtH%000%000wu~~YY[[%[[> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                 $   t          j        dd          }t          j        dd                              dd          }|                                }|                                }t           j                            ||||g          }|d         }|d	         }|                     |j        j	        d
           |                     |j        j	        d
           d}t          j        |          }	|	                                }
t          |          }t          j        rFt          dt!          |
          |
j                   t          dt!          |          |j                   |                     t          j        |
|          d           dS )z8Checking expressions with unaligned objects (MD version))r4   rI   r   r8   (   r7   r4   rI   rb   rc   Fr   rl   rm   rn   N)rN   rR   rP   rQ   r   r]   r^   r   r   r   r   ro   rp   r   rq   rr   rs   r9   rt   ru   r   s               r   	test01_mdzUnalignedObject.test01_md  s[    XgV,,,YvW---55b!<<WWYYWWYYVBB/00tHtH%000%000wu~~YY[[%[[> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   N)r	   r
   r   rx   r   r   r   r   r   r     s:        @ @ @2@ @ @ @ @r   r   c                        e Zd Zd Zd Zd ZdS )NonContiguousObjectc                 :   t          j        dd          }|ddd         }|dz  }|                     |j        j        d           |                     |j        j        d           d}t          j        |          }|                                }t          |          }t          j
        rFt          d	t          |          |j                   t          d
t          |          |j                   |                     t          j        ||          d           dS )z0Checking expressions with non-contiguous objectsr4   r7   r8   Nr:   FTr   rl   rm   rn   )rN   rP   r   r   
contiguousr   r   ro   rp   r   rq   rr   rs   r9   rt   ru   rg   r>   r?   r   rM   rB   rw   s          r   rx   z!NonContiguousObject.test00_simple  s    Ib(((cccFE+U333$///wu~~YY[[%[[> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                 b   t          j        dd                              dd          }|ddd         }|dz  }|                     |j        j        d           |                     |j        j        d	           d
}t          j        |          }|	                                }t          |          }t          j        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           dS )z@Checking expressions with non-contiguous objects (MD version, I)r   r7   r8   r4   rI   Nr:   FTr   rl   rm   rn   rN   rP   rQ   r   r   r   r   r   ro   rp   r   rq   rr   rs   r9   rt   ru   r   s          r   
test01a_mdzNonContiguousObject.test01a_md  s    IfG,,,44R;;cccFE+U333$///wu~~YY[[%[[> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                 j   t          j        dd                              dd          }|dddddf         }|dz  }|                     |j        j        d           |                     |j        j        d	           d
}t          j        |          }|	                                }t          |          }t          j        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           dS )zAChecking expressions with non-contiguous objects (MD version, II)r   r7   r8   r4   rI   Nr:   FTr   rl   rm   rn   r   r   s          r   
test01b_mdzNonContiguousObject.test01b_md  s    IfG,,,44R;;aaa1fIE+U333$///wu~~YY[[%[[> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   N)r	   r
   r   rx   r   r   r   r   r   r   r     sL        @ @ @(@ @ @(@ @ @ @ @r   r   c                   @     e Zd ZdZ fdZd Zd Zd Zd Zd Z	 xZ
S )	ExprErrorr   c                    t                                                       t          j        | j                  }t          j        |d                              | j                  | _        t          j        |d                              | j                  | _        t          j        |d                              | j                  | _	        t          j
        |d                              | j                  | _        d S )Nr7   r8   r;   )rK   rL   rN   rO   r.   rP   rQ   r>   r?   r@   rR   rB   )rg   rh   rj   s     r   rL   zExprError.setUp  s     GDJ1G,,,44TZ@@1G,,,44TZ@@1G,,,44TZ@@(1G,,,44TZ@@r   c                     | j                             | j        dz             | _         d}| j        | j         | j        d}t          j        ||          }|                     t          |j	                   dS )z/Checking that inconsistent shapes are detected.r   	a * b + cr=   N)
r?   rQ   r.   r>   r@   r   ro   assertRaises
ValueErrorrp   rg   rM   vars_s      r   _test00_shapezExprError._test00_shape  sh     
400f4699wtU##*di00000r   c                     | j                             d          | _         d}| j        | j         | j        d}|                     t
          t          j        ||           dS )z7Checking that uint64 arrays in expression are detected.uint64r   r=   N)r?   viewr>   r@   r   NotImplementedErrorr   ro   r   s      r   test02_uint64zExprError.test02_uint64  sV     X&&f4699-rweDDDDDr   c                      G d dt           j                  }| j                            dd|          }d}|| j        | j        d}|                     t          t           j        ||           dS )z0Checking that tables in expression are detected.c                   J    e Zd Z ej                    Z ej                    ZdS )#ExprError.test03_table.<locals>.RecN)r	   r
   r   r   r   col1r   col2r   r   r   Recr  #  s(        2;==D2;==DDDr   r  /r>   r   r=   N)	r   IsDescriptionrS   r_   r?   r@   r   	TypeErrorro   )rg   r  rJ   rM   r   s        r   test03_tablezExprError.test03_table   s    	! 	! 	! 	! 	!"" 	! 	! 	! K$$S#s33df4644)RWdE:::::r   c                     G d dt           j                  }| j                            dd|          }d}|j        j        j        }|| j        | j        d}t          j	        ||          }|
                                }|                     |           |j        j        }|| j        | j        d}|                     t          t           j	        ||           dS )z5Checking that nested cols in expression are detected.c                   R    e Zd Z ej                    Z G d dej                  ZdS )+ExprError.test04_nestedcols.<locals>.Nestedc                   ,    e Zd Z ej                    ZdS )0ExprError.test04_nestedcols.<locals>.Nested.col2N)r	   r
   r   r   r   col3r   r   r   r
  r  2  s        "r{}}r   r
  N)r	   r
   r   r   r   r	  r  r
  r   r   r   Nestedr  /  sN        2;==D% % % % %r' % % % % %r   r  r  r>   r   r=   N)r   r  rS   r_   r`   r
  r  r?   r@   ro   rp   assertIsNotNoner   r  )rg   r  rJ   rM   r>   r   rB   s          r   test04_nestedcolszExprError.test04_nestedcols,  s    	% 	% 	% 	% 	%R% 	% 	% 	% K$$S#v66FKdf4644wtU##YY[[R   FKdf4644)RWdE:::::r   c                     | j                             ddt          j                              }d}|| j        | j        d}|                     t          t          j        ||           dS )z2Checking that VLArrays in expression are detected.r  r>   r   r=   N)	rS   create_vlarrayr   r   r?   r@   r   r  ro   )rg   vlarM   r   s       r   test05_vlarrayzExprError.test05_vlarrayB  s]     k((c2;==AATV66)RWdE:::::r   )r	   r
   r   r.   rL   r   r  r  r  r  r   r   s   @r   r   r      s         EA A A A A1 1 1E E E
; 
; 
;; ; ;,; ; ; ; ; ; ;r   r   c                       e Zd Zd ZdS )BroadcastTestCasec                 H   | j         | j        | j        f}t          j        t          j        |d                   d                              |d                   }t          j        t          j        |d                   d                              |d                   }t          j        t          j        |d                   d                              |d                   }| j        j        }|j	        d         dk    r| j        
                    |d|          }n4| j                            |dt          j                    |j	                  }|                     |           | j        
                    |d|          }|                     |           | j        
                    |d	|          }|                     |           t          j        d
          }	|	                                }
t!          d          }t"          j        rgt'          d| j         | j        | j                   t'          dt)          |
          |
j                   t'          dt)          |          |j                   |                     t#          j        |
|          d           dS )z!Checking broadcast in expression.r   i4r8   rH   r:   r   rD   b1c12 * a1 + b1-c12 * a + b-cTested shapes:rl   rm   rn   N)shape1shape2shape3rN   rP   rO   rQ   rS   rT   r.   rV   r[   r   r   r  ro   rp   r   rq   rr   rs   r9   rt   ru   )rg   shapesr>   r?   r@   rT   r   r!  r"  rM   rB   rw   s               r   rx   zBroadcastTestCase.test00_simpleN  s=    +t{DK8IbgfQi((555==fQiHHIbgfQi((555==fQiHHIbgfQi((555==fQiHH{71:>>))$a88BB**dag + ? ?BR   [%%dD!44R   [%%dD!44R   w'((YY[[-  > 	;"DKdkJJJ($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   Nr	   r
   r   rx   r   r   r   r  r  L  s(        @ @ @ @ @r   r  c                       e Zd ZdZdZdZdS )
Broadcast0r   r<   rI   r<   rI   rI   Nr	   r
   r   r&  r'  r(  r   r   r   r,  r,  m          FFFFFr   r,  c                       e Zd ZdZdZdZdS )
Broadcast1r:   r<   rI   r.  r/  Nr0  r   r   r   r3  r3  s  r1  r   r3  c                       e Zd ZdZdZdZdS )
Broadcast2r.  r/  Nr0  r   r   r   r6  r6  y  s        FFFFFr   r6  c                       e Zd ZdZdZdZdS )
Broadcast3r/  r.  Nr0  r   r   r   r8  r8            FFFFFr   r8  c                       e Zd ZdZdZdZdS )
Broadcast4r   r.  r/  Nr0  r   r   r   r;  r;    r9  r   r;  c                       e Zd ZdZdZdZdS )
Broadcast5r   )r<   rH   r/  Nr0  r   r   r   r=  r=    r9  r   r=  c                       e Zd Zd ZdS )DiffLengthTestCasec                    t          | j                  t          | j                  t          | j                  f}t	          j        t	          j        |d                   d                              |d                   }t	          j        t	          j        |d                   d                              |d                   }t	          j        t	          j        |d                   d                              |d                   }t          j	        d          }|
                                }t          d |D                       t          fdt          |          D                       }t          |          D ]\  }}	t          |	          k    r||	d<   t	          j        t	          j        |d                   d                              |d                   }|                     |           t	          j        t	          j        |d                   d                              |d                   }|                     |           t	          j        t	          j        |d                   d                              |d                   }|                     |           t          d          }
t           j        rgt%          d	| j        | j        | j                   t%          d
t'          |          |j                   t%          dt'          |
          |
j                   |                     t!          j        ||
          d           dS )z/Checking different length inputs in expression.r   r   r8   rH   r:   r$  c                 ,    g | ]}t          |          S r   r   )r)   r.   s     r   r+   z4DiffLengthTestCase.test00_simple.<locals>.<listcomp>  s    555Uc%jj555r   c                 L    g | ] \  }}t          |          k    |d          !S r   rB  )r)   r   r.   maxdims      r   r+   z4DiffLengthTestCase.test00_simple.<locals>.<listcomp>  s;     / / /81eUv-- Ah---r   r%  rl   rm   rn   N)rZ   r&  r'  r(  rN   rP   rO   rQ   r   ro   rp   r~   minr   r   r  r   rq   rr   rs   r9   rt   ru   )rg   r)  r>   r?   r@   rM   rB   minlenr   r.   rw   rE  s              @r   rx   z DiffLengthTestCase.test00_simple  s    t{##T$+%6%6T[8I8IJIbgfQi((555==fQiHHIbgfQi((555==fQiHHIbgfQi((555==fQiHHw}%%YY[[55f55566 / / / /y/@/@ / / / 0 0!&)) 	" 	"HAu5zzV##!aIbgfQi((555==fQiHHQIbgfQi((555==fQiHHQIbgfQi((555==fQiHHQ-  > 	;"DKdkJJJ($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   Nr*  r   r   r   r?  r?    s(        @ @ @ @ @r   r?  c                       e Zd ZdZdZdZdS )DiffLength0rD  r   r5   Nr0  r   r   r   rI  rI            FFFFFr   rI  c                       e Zd ZdZdZdZdS )DiffLength1r<   r   rJ  Nr0  r   r   r   rM  rM    rK  r   rM  c                       e Zd ZdZdZdZdS )DiffLength2r.  r4  rI   r<   rI   Nr0  r   r   r   rP  rP    s        FFFFFr   rP  c                       e Zd ZdZdZdZdS )DiffLength3)rH   r<   rI   r4  rQ  Nr0  r   r   r   rS  rS            FFFFFr   rS  c                       e Zd ZdZdZdZdS )DiffLength4r-  r4  rQ  Nr0  r   r   r   rV  rV    rT  r   rV  c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TypesTestCasec                    t          j        g d          }t          j        g d          }| j        j        }| j                            |d|          }|                     |           | j                            |d|          }|                     |           t          j        d          }|                                }t          d          }t          j
        rFt          dt          |          |j                   t          dt          |          |j                   |                     t          j        ||          d           d	S )
z Checking booleans in expression.)TFT)FTFr   r!  za | brl   rm   rn   NrN   arrayrS   rT   rV   r  r   ro   rp   r   rq   rr   rs   r9   rt   ru   	rg   r>   r?   rT   r   r!  rM   rB   rw   s	            r   test00_boolzTypesTestCase.test00_bool  s2    H((())H)))**{[%%dD!44R   [%%dD!44R   wwYY[[']]> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                    dD ]}t           j        rt          d|           t          j        g d|          }t          j        g d|          }| j        j        }| j                            |d|          }| j                            |d|          }t          j        d          }| 	                    |t          j
                   t          j        d          }|                                }	t          j        g dd	          }t          j        g dd	          }t          d
          }
t           j        rFt          dt          |	          |	j                   t          dt          |
          |
j                   |                     |	j        |
j                   |                     t          j        |	|
          d           |                                 |                                 dS )z9Checking int8,uint8,int16,uint16 and int32 in expression.)r   uint8r   uint16r7   Checking type:rH   r:   r<   r<   rI   r   r   r!  r:   ztwo * a1-b1r7   z	two * a-brl   rm   rn   N)r   rq   rr   rN   r[  rS   rT   rV   r7   assertIsInstanceintegerr   ro   rp   rs   r9   r   rt   ru   remove)rg   r9   r>   r?   rT   r   r!  tworM   rB   rw   s              r   test01_shortintzTypesTestCase.test01_shortint  s    A 	 	E~ /&...E**AE**A;#D))$a88B))$a88B(1++C!!#rz2227=))DBG,,AG,,Ak""B~ ?,d2hhAAA)488RX>>>RXrx000OOF1"b99BD D D IIKKKIIKKKK1	 	r   c                    dD ]}t           j        rt          d|           t          j        g d|          }t          j        g d|          }| j        j        }| j                            |d|          }| j                            |d|          }t          j	        d          }|
                                }t          j        g dd          }t          j        g dd          }t          d	          }	t           j        rFt          d
t          |          |j                   t          dt          |	          |	j                   |                     |j        |	j                   |                     t          j        ||	          d           |                                 |                                 dS )z(Checking uint32 and int64 in expression.)uint32r;   ra  rb  rc  r   r!  	2 * a1-b1r;   2 * a-brl   rm   rn   Nr   rq   rr   rN   r[  rS   rT   rV   r   ro   rp   rs   r9   r   rt   ru   rf  
rg   r9   r>   r?   rT   r   r!  rM   rB   rw   s
             r   test02_longintzTypesTestCase.test02_longint  s    ' 	 	E~ /&...E**AE**A;#D))$a88B))$a88B7;''DBG,,AG,,AiB~ ?,d2hhAAA)488RX>>>RXrx000OOF1"b99BD D D IIKKKIIKKKK-	 	r   c                    dD ]}t           j        rt          d|           t          j        g d|          }t          j        g d|          }| j        j        }| j                            |d|          }| j                            |d|          }t          j	        d          }|
                                }t          j        g d|          }t          j        g d|          }t          d          }	t           j        rFt          d	t          |          |j                   t          d
t          |	          |	j                   |                     |j        |	j                   |                     t          j        ||	          d           |                                 |                                 dS )z+Checking float32 and float64 in expression.)float32float64ra  rb  rc  r   r!  rk  rl  rl   rm   rn   Nrm  rn  s
             r   test03_floatzTypesTestCase.test03_float#  s    * 	 	E~ /&...E**AE**A;#D))$a88B))$a88B7;''DBE**AE**AiB~ ?,d2hhAAA)488RX>>>RXrx000OOF1"b99BD D D IIKKKIIKKKK-	 	r   c                    dD ]}t           j        rt          d|           t          j        g d|          }t          j        g d|          }| j        j        }| j                            |d|          }| j                            |d|          }t          j	        d          }|
                                }t          j        g dd          }t          j        g dd          }t          d	          }	t           j        rFt          d
t          |          |j                   t          dt          |	          |	j                   |                     |j        |	j                   |                     t          j        ||	          d           |                                 |                                 dS )z0Checking complex64 and complex128 in expression.)	complex64
complex128ra  )rH   y               @y      @       @)r<   y              @y      @      ?r   r!  rk  rv  rl  rl   rm   rn   Nrm  rn  s
             r   test04_complexzTypesTestCase.test04_complex>  s    / 	 	E~ /&...%00A%00A;#D))$a88B))$a88B7;''DB,77A,77AiB~ ?,d2hhAAA)488RX>>>RXrx000OOF1"b99BD D D IIKKKIIKKKK-	 	r   c                    t          j        g dd          }t          j        g dd          }| j        j        }| j                            |d|          }|                     |           | j                            |d|          }|                     |           t          j        d          }|                                }t          d          }t          j
        rFt          dt          |          |j                   t          d	t          |          |j                   |                     t          j        ||          d
           dS )zChecking strings in expression.)r>   bdcdS)r>   bdcdccdcr   r!  z(a1 > b'a') | ( b1 > b'b')z(a > b'a') | ( b > b'b')rl   rm   rn   NrZ  r\  s	            r   test05_stringzTypesTestCase.test05_stringY  s:    H&&&,,H***C00{[%%dD!44R   [%%dD!44R   w344YY[[,--> 	;($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   N)	r	   r
   r   r]  rh  ro  rs  rw  r~  r   r   r   rX  rX    sv        @ @ @(  :  6  6  6@ @ @ @ @r   rX  c                       e Zd Zd ZdS )FunctionsTestCasec                    t          j        g d          }t          j        g d          }| j        j        }| j                            |d|          }|                     |           | j                            |d|          }|                     |           t          j        d          }|                                }t          j	        |          t          j
        |          z  }t          j        rFt          dt          |          |j                   t          dt          |          |j                   t!          j        ||           dS )	z+Checking some math functions in expression.)g?g?333333?)r  g?g      ?r   r!  zsin(a1) * sqrt(b1)rl   rm   N)rN   r[  rS   rT   rV   r  r   ro   rp   sinsqrtr   rq   rr   rs   r9   nptassert_array_almost_equal_nulpr\  s	            r   rx   zFunctionsTestCase.test00_simpleq  s    H\\\""H\\\""{[%%dD!44R   [%%dD!44R   w+,,YY[[VAYY#> 	;($r((BH===%tBxx:::*2r22222r   Nr*  r   r   r   r  r  o  s#        3 3 3 3 3r   r  c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )MaindimTestCasec                 <   t          | j                  }t          j        t          j        |          d                              |          }|                                }|                                }| j        j        }d|| j	        <   | j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }|                    |           |                    |           |                    |           t          j        d          }	|	                                }
t          d	          }t           j        rVt%          d
|           t%          dt'          |
          |
j                   t%          dt'          |          |j                   |                     t!          j        |
|          d           dS )z3Checking other dimensions than 0 as main dimension.r   r8   r   r   rD   r!  r"  r#  r$  Tested shape:rl   rm   rn   N)rZ   r.   rN   rP   rO   rQ   r   rS   rT   r/   r[   r   r   r\   ro   rp   r   rq   rr   rs   r9   rt   ru   )rg   r.   r>   r?   r@   rT   r   r!  r"  rM   rB   rw   s               r   rx   zMaindimTestCase.test00_simple  s    TZ  IbgennD11199%@@FFHHFFHH{dl[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9
		!
		!
		!w'((YY[[-  > 	;/5)))($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                    t          | j                  }t          j        t          j        |          d                              |          }|                                }|                                }| j        j        }d|| j	        <   | j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }	|                    |           |                    |           |                    |           |	                    |           t          j        d	          }
|
                    |	           |
                                 t!          d
          }t"          j        r^t'          d|           t'          dt)          |	dd                   |	j                   t'          dt)          |          |j                   |                     t#          j        |	dd         |          d           dS )z8Checking other dimensions than 0 as main dimension (out)r   r8   r   r   rD   r!  r"  rB   r#  r$  r  rl   Nrm   rn   )rZ   r.   rN   rP   rO   rQ   r   rS   rT   r/   r[   r   r   r\   ro   r{   rp   r   rq   rr   rs   r9   rt   ru   rg   r.   r>   r?   r@   rT   r   r!  r"  rB   rM   rw   s               r   r|   zMaindimTestCase.test01_out  s(    TZ  IbgennD11199%@@FFHHFFHH{dl[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9
		!
		!
		!
		!w'((		-  > 	;/5)))($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   c                 X   t          | j                  }t          j        t          j        |          d                              |          }|                                }|                                }| j        j        }|dd         }d|| j	        <   d|d<   | j        
                    |dt          j                    |          }|                     |j	        | j	                   | j        
                    |dt          j                    |          }|                     |j	        d           | j        
                    |dt          j                    |          }	| j        
                    |d	t          j                    |          }
|                    |           |                    |           |	                    |           |
                    |           t          j        d
          }|                                }
t!          d          }t"          j        rVt'          d|           t'          dt)          |
          |
j                   t'          dt)          |          |j                   |                     t#          j        |
|          d           dS )z-Checking different main dimensions in inputs.r   r8   Nr   r   rD   r!  r"  rB   r#  r$  r  rl   rm   rn   )rZ   r.   rN   rP   rO   rQ   r   rS   rT   r/   r[   r   r   r   r\   ro   rp   r   rq   rr   rs   r9   rt   ru   rg   r.   r>   r?   r@   rT   r'  r   r!  r"  rB   rM   rw   s                r   test02_diff_in_maindimsz'MaindimTestCase.test02_diff_in_maindims  sN    TZ  IbgennD11199%@@FFHHFFHH{qqqdlq	[&&$R[]]% ' 9 9T\222[&&$R[]]& ' : :Q'''[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9
		!
		!
		!
		!w'((YY[[-  > 	;/5)))($r((BH===%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                    t          | j                  }t          j        t          j        |          d                              |          }|                                }|                                }| j        j        }|dd         }d|| j	        <   d|d<   | j        
                    |dt          j                    |          }|                     |j	        | j	                   | j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }	| j        
                    |d	t          j                    |          }
|                     |
j	        d           |                    |           |                    |           |	                    |           |
                    |           t          j        d
          }|                    |
           |                                 t#          d          }t$          j        r^t)          d|           t)          dt+          |
dd                   |
j                   t)          dt+          |          |j                   |                     t%          j        |
dd         |          d           dS )z1Checking different maindims in inputs and output.r   r8   Nr   r   rD   r!  r"  rB   r#  r$  r  rl   rm   rn   )rZ   r.   rN   rP   rO   rQ   r   rS   rT   r/   r[   r   r   r   r\   ro   r{   rp   r   rq   rr   rs   r9   rt   ru   r  s                r   test03_diff_in_out_maindimsz+MaindimTestCase.test03_diff_in_out_maindims  sp    TZ  IbgennD11199%@@FFHHFFHH{qqqdlq	[&&$R[]]% ' 9 9T\222[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]& ' : :Q'''
		!
		!
		!
		!w'((		-  > 	;/5)))($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   c                    t          | j                  }t          j        t          j        |          d                              |          }|                                }|                                }| j        j        }|dd         }d|| j	        <   d|d<   | j        
                    |dt          j                    |          }|                     |j	        | j	                   | j        
                    |dt          j                    |          }| j        
                    |dt          j                    |          }	| j        
                    |d	t          j                    |          }
|                     |
j	        d           |                    |           |                    |           |                    |           |                    |           |	                    |           |	                    |           |
                    |           t          j        d
          }|                    |
           |                     t$          |j                   dS )z=Checking different maindims and lengths in inputs and output.r   r8   Nr   r   rD   r!  r"  rB   r#  )rZ   r.   rN   rP   rO   rQ   r   rS   rT   r/   r[   r   r   r   r\   ro   r{   r   r   rp   )rg   r.   r>   r?   r@   rT   r'  r   r!  r"  rB   rM   s               r   #test04_diff_in_out_maindims_lengthsz3MaindimTestCase.test04_diff_in_out_maindims_lengths  s
    TZ  IbgennD11199%@@FFHHFFHH{qqqdlq	[&&$R[]]% ' 9 9T\222[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]& ' : :Q'''
		!
		!
		!
		!
		!
		!
		!w'((*di00000r   N)r	   r
   r   rx   r|   r  r  r  r   r   r   r  r    sn        @ @ @< @  @  @D#@ #@ #@J$@ $@ $@L!1 !1 !1 !1 !1r   r  c                       e Zd ZdZdZdS )Maindim0rH   )rH   r:   Nr	   r
   r   r/   r.   r   r   r   r  r  8          GEEEr   r  c                       e Zd ZdZdZdS )Maindim1rH   )r:   r<   Nr  r   r   r   r  r  =  r  r   r  c                       e Zd ZdZdZdS )Maindim2rH   r4  Nr  r   r   r   r  r  B          GEEEr   r  c                       e Zd ZdZdZdS )Maindim3r:   r4  Nr  r   r   r   r  r  G  r  r   r  c                       e Zd Zd ZdS )AppendModeTestCasec                     ddg}t          j        t          j        |          d                              |          }|                                }|                                }d|d<   | j        j        }| j                            |dt          j	                    |          }| j                            |d	t          j	                    |          }| j                            |d
t          j	                    |          }| j                            |dt          j	                    |          }	|
                    |           |
                    |           |
                    |           | j
        s|	
                    |           t          j        d          }
|
                    |	| j
                   |
                                 t          d          }t          j        r^t!          d|           t!          dt#          |	dd                   |	j                   t!          dt#          |          |j                   |                     t          j        |	dd         |          d           dS )z&Checking append mode in `set_output()`r<   r:   r   r8   r   rH   r   rD   r!  r"  rB   r#  )append_moder$  r  rl   Nrm   rn   )rN   rP   rO   rQ   r   rS   rT   r[   r   r   r\   ro   r{   rp   r   rq   rr   rs   r9   rt   ru   r  s               r   test01_appendz AppendModeTestCase.test01_appendO  s/    AIbgennD11199%@@FFHHFFHHa{[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9
		!
		!
		!{ 	IIaLLLw'((444		-  > 	;/5)))($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   N)r	   r
   r   r  r   r   r   r  r  M  s(        !@ !@ !@ !@ !@r   r  c                       e Zd ZdZdS )AppendModeTrueTNr	   r
   r   r\   r   r   r   r  r  s  s        FFFr   r  c                       e Zd ZdZdS )AppendModeFalseFNr  r   r   r   r  r  w  s        FFFr   r  c                   6     e Zd Z fdZd Zd Zd Zd Z xZS )iterTestCasec                 4   t                                                       t          | j                  }t	          j        t	          j        |          d                              |          }|                                }|                                }|||d| _	        d|| j
        <   | j        j        }| j                            |dt          j                    |          }| j                            |dt          j                    |          }| j                            |dt          j                    |          }|                    |           |                    |           |                    |           |||d| _        d	| _        d S )
Nr   r8   r=   r   r   rD   r!  r"  r$  )rK   rL   rZ   r.   rN   rP   rO   rQ   r   r   r/   rS   rT   r[   r   r   r\   rf   r   )
rg   r.   r>   r?   r@   rT   r   r!  r"  rj   s
            r   rL   ziterTestCase.setUp~  sX   TZ  IbgennD11199%@@FFHHFFHHAA..dl{[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9
		!
		!
		!2B//	"


r   c                     t          j        | j        | j                  }t	          j        d |D                       }t          | j        | j                  }t          j	        rit          d| j        | j                   t          dt          |dd                   |j                   t          dt          |          |j                   |                     t          j        |dd         |          d           dS )zChecking the __iter__ iterator.c                     g | ]}|S r   r   r)   r   s     r   r+   z,iterTestCase.test00_iter.<locals>.<listcomp>      +++ss+++r   Tested shape, maindim:rl   Nrm   rn   )r   ro   r   rf   rN   r[  rp   r   r   rq   rr   r.   r/   rs   r9   rt   ru   rv   s       r   test00_iterziterTestCase.test00_iter  s     wtz49--X++d+++,,$*dk**> 	;*DJEEE($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   c                    | j         d         dd}}}t          j        | j        | j                  }|                    |||           t          j        d |D                       }t          | j	        |||| j
        | j                  }t          | j        |          }t          j        rit          d| j
        | j                   t          dt!          |dd                   |j                   t          dt!          |          |j                   |                     t          j        |dd         |          d           dS )z/Checking the __iter__ iterator (with ranges, I)r   Nc                     g | ]}|S r   r   r  s     r   r+   z,iterTestCase.test01a_sss.<locals>.<listcomp>  r  r   r  rl   rm   rn   range_r   ro   r   rf   r   rN   r[  r1   r   r.   r/   rp   r   rq   rr   rs   r9   rt   ru   r   s           r   test01a_sssziterTestCase.test01a_sss  s5    !KND$Ttwtz49--eT4000X++d+++,,!KdDJF F$*f%%> 	;*DJEEE($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   c                    | j         d         | j         d         d}}}t          j        | j        | j                  }|                    |||           t          j        d |D                       }t          | j	        |||| j
        | j                  }t          | j        |          }t          j        rit          d| j
        | j                   t          dt!          |dd                   |j                   t          dt!          |          |j                   |                     t          j        |dd         |          d           dS )	z0Checking the __iter__ iterator (with ranges, II)r   r:   Nc                     g | ]}|S r   r   r  s     r   r+   z,iterTestCase.test01b_sss.<locals>.<listcomp>  r  r   r  rl   rm   rn   r  r   s           r   test01b_sssziterTestCase.test01b_sss  s;    !KNDKNDTtwtz49--eT4000X++d+++,,!KdDJF F$*f%%> 	;*DJEEE($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   c                    | j         \  }}}t          j        | j        | j                  }|                    |||           t          j        d |D                       }t          | j	        |||| j
        | j                  }t          | j        |          }t          j        rit          d| j
        | j                   t          dt!          |dd                   |j                   t          dt!          |          |j                   |                     t          j        |dd         |          d           dS )z1Checking the __iter__ iterator (with ranges, III)c                     g | ]}|S r   r   r  s     r   r+   z,iterTestCase.test01c_sss.<locals>.<listcomp>  r  r   r  rl   Nrm   rn   r  r   s           r   test01c_sssziterTestCase.test01c_sss  s0    !KtTwtz49--eT4000X++d+++,,!KdDJF F$*f%%> 	;*DJEEE($r!!!u++rx@@@%tBxx:::-beR88>	@ 	@ 	@ 	@ 	@r   )	r	   r
   r   rL   r  r  r  r  r   r   s   @r   r  r  |  s        # # # # #.@ @ @@ @ @"@ @ @"@ @ @ @ @ @ @r   r  c                       e Zd ZdZdZdZdS )iter0r   rD  rH   r:   rH   Nr	   r
   r   r/   r.   r  r   r   r   r  r            GEFFFr   r  c                       e Zd ZdZdZdZdS )iter1r   rN  r  Nr  r   r   r   r  r    r  r   r  c                       e Zd ZdZdZdZdS )iter2r   r<   r:   r   r<   r:   Nr  r   r   r   r  r            GEFFFr   r  c                       e Zd ZdZdZdZdS )iter3rH   r  r  Nr  r   r   r   r  r    r  r   r  c                       e Zd ZdZdZdZdS )iter4r:   )r<   r:   rH   rH   r<   r:   Nr  r   r   r   r  r            GEFFFr   r  c                       e Zd ZdZdZdZdS )iter5r:   )rH   r:   r   )r   rI   r:   Nr  r   r   r   r  r    r  r   r  c                       e Zd Zd Zd ZdS )setOutputRangeTestCasec           	      r   t          | j                  }| j        \  }}}t          j        t          j        |          d                              |          }|                                }|                                }| j        j	        }| j        
                    |d|          }	|                     |	           | j        
                    |d|          }
|                     |
           | j        
                    |d|          }t          j        d          }|                    |           |                    |||           |                                 t!          d          }|dt#          t%          |||                             ||||<   t&          j        r^t+          d	|           t+          d
t-          |dd                   |j                   t+          dt-          |          |j                   |                     t'          j        |dd         |          d           dS )z(Checking the range selection for output.r   r8   r   r!  rB   a1-b1-1a-b-1Nr  rl   rm   rn   )rZ   r.   r  rN   rP   rO   rQ   r   rS   rT   rV   r  r   ro   r{   set_output_rangerp   r   r   r   rq   rr   rs   r9   rt   ru   )rg   r.   r   r    r!   r>   r?   rrT   r   r!  rB   rM   rw   s                 r   rx   z$setOutputRangeTestCase.test00_simple  s    TZ   KtTIbgennD11199%@@FFHHFFHH{[%%dD!44R   [%%dD!44R   [%%dD!44wy!!eT4000		']] >U5$%=%=!>!> >?%T/> 	9/5)))($r!!!u++rx@@@%tAww888-beQ77>	@ 	@ 	@ 	@ 	@r   c           
         t          | j                  }| j        \  }}}t          j        t          j        |          d                              |          }|                                }|                                }d|| j        <   | j	        j
        }| j	                            |dt          j                    |          }	| j	                            |dt          j                    |          }
| j	                            |dt          j                    |          }|	                    |           |
                    |           |                    |           t          j        d          }|                    |           |                    |||           |                                 t%          d	          }t'          t)          d
          g| j        z            }t+          t-          |||                    }|                    |t)          |||          fz   |                    |t)          d|          fz                        t2          j        r^t7          d|           t7          dt9          |d
d
                   |j                   t7          dt9          |          |j                   |                     t3          j        |d
d
         |          d           d
S )z5Checking the range selection for output (maindim > 0)r   r8   r   r   rD   r!  rB   r  r  Nr  rl   rm   rn   ) rZ   r.   r  rN   rP   rO   rQ   r   r/   rS   rT   r[   r   r   r\   ro   r{   r  rp   r-   r(   r   r   __setitem__r,   r   rq   rr   rs   r9   rt   ru   )rg   r.   r   r    r!   r>   r?   r  rT   r   r!  rB   rM   rw   lsllranges                   r   test01_maindimz%setOutputRangeTestCase.test01_maindim  s    TZ   KtTIbgennD11199%@@FFHHFFHHdl{[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9[&&$R[]]% ' 9 9
		!
		!
		!wy!!eT4000		']]U4[[MDL011U5$--..	cU5$5577nnSE!V,<,<+>%>??	A 	A 	A> 	9/5)))($r!!!u++rx@@@%tAww888-beQ77>	@ 	@ 	@ 	@ 	@r   N)r	   r
   r   rx   r  r   r   r   r  r    s:        @ @ @:$@ $@ $@ $@ $@r   r  c                       e Zd ZdZdZdZdS )setOutputRange0r   r   )r   rH   r:   Nr  r   r   r   r  r  A  s        GEFFFr   r  c                       e Zd ZdZdZdZdS )setOutputRange1r   r   )r   r4   r:   Nr  r   r   r   r  r  G          GEFFFr   r  c                       e Zd ZdZdZdZdS )setOutputRange2r   r   )rH   r4   r:   Nr  r   r   r   r  r  M  r  r   r  c                       e Zd ZdZdZdZdS )setOutputRange3r   )r4   rH   rH   r4   r<   Nr  r   r   r   r  r  S          GEFFFr   r  c                       e Zd ZdZdZdZdS )setOutputRange4r   )r4   r:   r  Nr  r   r   r   r  r  Y  r  r   r  c                       e Zd ZdZdZdZdS )setOutputRange5r   )r   r<   rH   )rH   r   rH   Nr  r   r   r   r  r  _  r  r   r  c                       e Zd ZdZdZdZdS )setOutputRange6rH   )r:   r   r  Nr  r   r   r   r  r  e  r  r   r  c                       e Zd ZdZdZdZdS )setOutputRange7rH   )r:   r   rH   r  Nr  r   r   r   r  r  k  r  r   r  c                       e Zd ZdZdZdZdS )setOutputRange8r:   )rH   r<   r   )rH   r   r:   Nr  r   r   r   r  r  q  r  r   r  c                       e Zd ZdZdZdZdS )setOutputRange9r<   )rH   r<   rI   r   )rH   r   r<   Nr  r   r   r   r  r  w  s        GEFFFr   r  c                       e Zd Zd Zd ZdS )VeryLargeInputsTestCasec                 X   | j         }t          j        d          t          j        ddd          }nBt          j        d          t          j        ddd          }nt          j        dd          }| j        j        }| j                            |dt          j        d	
          ||          }|                     |           | j                            |dt          j        d
          ||          }|                     |           | j                            |dt          j        d	
          ||          }t          j	        d          }|
                    |           |                                 |dd         }t          j        dd          }t          j        rVt!          d|           t!          dt#          |          |j                   t!          dt#          |          |j                   |                     t          j        ||          d           dS )zChecking very large inputs.bloscNrH   F	complevelcomplibshufflelzor  r  r>   r<   dfltrE   r.   filtersr?   r:   rB   za * b-6ir4   rr  r8   r  zTen last rows:rm   rn   )r.   r   which_lib_versionFiltersrS   rT   rW   Float64Atomr  ro   r{   rp   rN   r   r   rq   rr   rs   r9   rt   ru   )	rg   r.   r  rT   r>   r?   rB   rM   rw   s	            r   rx   z%VeryLargeInputsTestCase.test00_simple  s+    
((4j1g).0 0 0GG!%((4j1eUKKKGGj1e<<<G{K%%dC+->q+A+A+A,17 & D D 	QK%%dC+->q+A+A+A,17 & D D 	Q[&&tT,.N,B,B,B-2G ' E E wy!!		XXb	***> 	;/5)))"DHHbh777%tBxx:::-b"55>	@ 	@ 	@ 	@ 	@r   c                 n   | j         }|d         dk    rt          j        rt          d           dS t	          j        d          t	          j        ddd          }nt	          j        dd	          }| j        j        }| j        	                    |d
t	          j
        d          ||          }|                     |           | j        	                    |dt	          j
        d          ||          }|                     |           | j        	                    |dt	          j
        d          ||          }t	          j        d          }t          |          }t          j        r0t          d|           t          d|           t          dd           |                     |dd           dS )z-Checking very large inputs (__iter__ version)r   i   zSkipping this *very* long testNr  rH   Fr  r  r>   r  r   r?   r:   rB   r<   za-b + 1r  zCummulated sum:rm   rn   )r.   r   rq   rr   r   r  r  rS   rT   rW   	Int32Atomr  ro   sumr   )rg   r.   r  rT   r>   r?   rB   rM   s           r   test01_iterz#VeryLargeInputsTestCase.test01_iter  s    
8u ~ 86777F&&2j1eUKKKGGj1e<<<G {K%%dC+-<Q+?+?+?,17 & D D 	QK%%dC+-<Q+?+?+?,17 & D D 	Q[&&tT,.La,@,@,@-2G ' E E wy!!YY> 	*/5)))#R(((%q)))Q FGGGGGr   N)r	   r
   r   rx   r  r   r   r   r  r  ~  s;        $@ $@ $@L$H $H $H $H $Hr   r  c                       e Zd ZdZdS )VeryLargeInputs1)i   Nr	   r
   r   r.   r   r   r   r
  r
    s        EEEr   r
  c                       e Zd ZdZdS )VeryLargeInputs2)l       Nr  r   r   r   r  r    s        EEEr   r  c                     t           j                                        } d}t          |          D 
]}|                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                                |                     t           j                            t"                               |                     t           j                            t$                               |                     t           j                            t&                               |                     t           j                            t(                               |                     t           j                            t*                               |                     t           j                            t,                               |                     t           j                            t.                               |                     t           j                            t0                               |                     t           j                            t2                               |                     t           j                            t4                               |                     t           j                            t6                               |                     t           j                            t8                               |                     t           j                            t:                               |                     t           j                            t<                               |                     t           j                            t>                               |                     t           j                            t@                               |                     t           j                            tB                               |                     t           j                            tD                               |                     t           j                            tF                               |                     t           j                            tH                               |                     t           j                            tJ                               |                     t           j                            tL                               |                     t           j                            tN                               |                     t           j                            tP                               |                     t           j                            tR                               |                     t           j                            tT                               |                     t           j                            tV                               |                     t           j                            tX                               |                     t           j                            tZ                               |                     t           j                            t\                               |                     t           j                            t^                               |                     t           j                            t`                               |                     t           j                            tb                               |                     t           j                            td                               |                     t           j                            tf                               |                     t           j                            th                               |                     t           j                            tj                               t           j6        r7|                     t           j                            tn                               
| S )zCReturn a test suite consisting of all the test cases in the module.rH   )8r   unittest	TestSuiter   addTest	makeSuiter   r   r   r   r   r   r   r   r   r   r   r   r,  r3  r6  r8  r;  r=  rI  rM  rP  rS  rV  rX  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  heavyr  )theSuiteniterr   s      r   suiter    s2    ((**HE 5\\ 2J 2J229==>>>229==>>>22:>>???22:>>???22:>>???223CDDEEE223CDDEEE223CDDEEE223CDDEEE22?CCDDD223FGGHHH229==>>>22:>>???22:>>???22:>>???22:>>???22:>>???22:>>???22;??@@@22;??@@@22;??@@@22;??@@@22;??@@@22=AABBB223DEEFFF228<<===228<<===228<<===228<<===22>BBCCC22?CCDDD22599:::22599:::22599:::22599:::22599:::22599:::22?CCDDD22?CCDDD22?CCDDD22?CCDDD22?CCDDD22?CCDDD22?CCDDD22?CCDDD22?CCDDD22?CCDDD223CDDEEE< 	JV_667GHHIIIOr   __main__r  )defaultTest)Q__doc__numpyrN   r   r  tablesr   tables.testsr   r  r   r%   r1   TempFileMixinPyTablesTestCaser3   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r,  r3  r6  r8  r;  r=  r?  rI  rM  rP  rS  rV  rX  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r	   sys
parse_argvargvprint_versionsr  mainr   r   r   <module>r$     s   < <                          
, , , , ,R , , ,    n@ n@ n@ n@ n@6')@ n@ n@ n@b                                   
B@ B@ B@ B@ B@f2F4K B@ B@ B@J" " " " ". " " "
" " " " ". " " "
" " " " ". " " "
# # # # #. # # #2@ 2@ 2@ 2@ 2@f- 2@ 2@ 2@l<@ <@ <@ <@ <@&1 <@ <@ <@@H; H; H; H; H;$f&= H; H; H;X@ @ @ @ @,f.E @ @ @B    "       "       "       "       "       "   !@ !@ !@ !@ !@-v/F !@ !@ !@H    $       $       $       $       $   V@ V@ V@ V@ V@F(&*A V@ V@ V@t3 3 3 3 3,f.E 3 3 30n1 n1 n1 n1 n1f*F,C n1 n1 n1b       
       
       
       #@ #@ #@ #@ #@-v/F #@ #@ #@L    '       (   
W@ W@ W@ W@ W@6')@ W@ W@ W@t    L       L       L       L       L       L   C@ C@ C@ C@ C@V163J C@ C@ C@L    ,       ,       ,       ,       ,       ,       ,       ,       ,       ,   LH LH LH LH LHf2F4K LH LH LH`    .       .   : : :z zJJJFchF
OW-----	 r   