
    Bwg                         d Z ddlZddlZddlmZmZmZ ddlm	Z	 ej                  j                  d   ej                  j                  d   z   ej                  j                  d   z   ej                  j                  d   z   Zd	dii d
diddiddiddiddiddiddii i dZ G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d       Z G d! d"      Z G d# d$      Zd% Zd& Zej6                  j9                  d'g d(      d)        Z G d* d+      Zej6                  j9                  d'ej?                               d,        Z d- Z!ej6                  j9                  d'd.d/ e"       dd0d1g      d2        Z#ej6                  j9                  d'ej?                               d3        Z$ej6                  j9                  d'ej?                               d4        Z%ej6                  j9                  d5e      ej6                  j9                  d'ej?                               d6               Z&y)7z(Tests for the array padding functions.

    N)assert_array_equalassert_allcloseassert_equal)	_as_pairsuintintfloatcomplexconstant_values
end_valuesstat_lengthreflect_typeeven)constantedgelinear_rampmaximummeanmedianminimumreflect	symmetricwrapemptyc                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestAsPairsc                     t        j                  ddggdz        }ddgdggfD ]  }t        |d      }t        ||        t	               }t        t        |d      t        j                  ||ggdz               y)z Test casting for a single value.   
   Nnparrayr   r   objectselfexpectedxresultobjs        T/var/www/horilla/myenv/lib/python3.12/site-packages/numpy/lib/tests/test_arraypad.pytest_single_valuezTestAsPairs.test_single_value!   s}    88aVHrM*aSA3% 	+Aq"%F*	+ hc2HHsCj\B&'	
    c                    t        j                  ddggdz        }ddgddggfD ]  }t        |d      }t        ||        t	               }t        t        d|gd      t        j                  d|ggdz               t        t        dgdggd      t        j                  ddgddgg             t        t        dg|ggd      t        j                  ddg||gg             y)z-Test proper casting for two different values.r      r   a   Nr    r$   s        r*   test_two_valueszTestAsPairs.test_two_values.   s     88aVHrM*a&Aq6(# 	+Aq"%F*	+ hsCj"%HHsCj\B&'	
 	sQCj!$HHq!fq!f%&	

 	usena(HHsCj3*-.	
r,   c                 h    d}t        t        d dd      |       t        t        d dd      |       y )N)NNr3   r3   r   Fas_indexT)r   r   r%   r&   s     r*   test_with_nonezTestAsPairs.test_with_noneG   s7    =dA.	
 	dA-	
r,   c                 x    t        j                  d      j                  d      }t        t	        |d      |       y)z?Test if `x` already matching desired output are passed through.   )   r0   r:   N)r!   arangereshaper   r   r6   s     r*   test_pass_throughzTestAsPairs.test_pass_throughR   s/    99R=((0h"	
r,   c           
         t        t        ddgdd      t        j                  ddggdz  t        j                               t        t        ddgdd      t        j                  dd	ggdz  t        j                               d
d
gd
ggd
d	gddgd
d	ggd	d
ggddggdz  ddggz   fD ]4  }t        j                  t        d      5  t        |dd       ddd       6 y# 1 sw Y   AxY w)z Test results if `as_index=True`.g@gffffff
@r   Tr4   r   dtypeg(\@r.      r0   	   znegative valuesmatchN)r   r   r!   r"   intppytestraises
ValueError)r%   r'   s     r*   test_as_indexzTestAsPairs.test_as_indexZ   s    sCj"t4HHq!fX]"''2	
 	sDk25HHq!fX]"''2	
 rdbTFRGaWAwi1b'q6(Q,1b'*, 	0Az1BC 0!R$/0 0	00 0s   C""C+	c                    t        j                  t        d      5  t        dgggd       ddd       t        j                  t        d      5  t        ddgdd	ggd       ddd       t        j                  t        d      5  t        t	        j
                  d
      d       ddd       y# 1 sw Y   xY w# 1 sw Y   YxY w# 1 sw Y   yxY w)z"Ensure faulty usage is discovered.zmore dimensions than allowedrF   r   r   Nzcould not be broadcastrC   r0   r.   r0   r   )rI   rJ   rK   r   r!   ones)r%   s    r*   test_exceptionszTestAsPairs.test_exceptionsi   s    ]]:-KL 	#ugr"	#]]:-EF 	+1v1v&*	+]]:-EF 	*bggfoq)	* 	*		# 	#	+ 	+	* 	*s#   B.B: C.B7:CCN)	__name__
__module____qualname__r+   r1   r7   r=   rL   rP    r,   r*   r   r       s     

2	

0*r,   r   c                       e Zd Zej                  j                  dej                               d        Zej                  j                  dg d      d        Z	ej                  j                  dg d      d        Z
y)TestConditionalShortcutsmodec                     t        j                  d      j                  ddd      }|j                  D cg c]  }d }}t	        |t        j
                  |||             y c c}w )Nx   r.      r:   r   r   rW   r!   r;   r<   shaper   padr%   rW   test_pad_amts        r*   test_zero_padding_shortcutsz4TestConditionalShortcuts.test_zero_padding_shortcutst   sQ    yy~%%aA.#'::.a6..4gD!AB /s   	A#)r   r   r   r   c           	          t        j                  d      j                  ddd      }|j                  D cg c]  }d }}t	        t        j
                  ||d      t        j
                  |||d	             y c c}w )
NrY   r.   rZ   r:   rC   rC   r   r\   rC   rW   r   r]   r`   s        r*   test_shallow_statistic_rangez5TestConditionalShortcuts.test_shallow_statistic_rangez   sd    yy~%%aA.#'::.a6..266$f=66$dJ	L /s   	A:c           	          t        j                  d      j                  dd      }|j                  D cg c]  }d }}t	        t        j
                  |||      t        j
                  |||d             y c c}w )N   rZ   r:   )r   r   r\   rg   r]   r`   s        r*   test_clip_statistic_rangez2TestConditionalShortcuts.test_clip_statistic_range   sb    yy}$$Q*#'::.a6..266$d;66$dK	M /s   	A9N)rQ   rR   rS   rI   markparametrize
_all_modeskeysrd   rh   rk   rT   r,   r*   rV   rV   s   s    [[VZ__%67C 8C
 [[V%NOL PL [[V%NOM PMr,   rV   c                   :   e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zej"                  j%                  dg d      d        Zej"                  j%                  dg d      ej"                  j%                  dg d      d               Zd Zej"                  j-                  d      ej"                  j-                  d      ej"                  j%                  dddg      d                      Zej"                  j%                  dddg      d        Zy)TestStatisticc                     t        j                  d      j                  d      }t        j                  |ddd      }t        j                  g d      }t        ||       y )Nd   f)      r   )rN   r   )      ?ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry   ry                 ?       @      @      @      @      @      @       @      "@      $@      &@      (@      *@      ,@      .@      0@      1@      2@      3@      4@      5@      6@      7@      8@      9@      :@      ;@      <@      =@      >@      ?@      @@     @@      A@     A@      B@     B@      C@     C@      D@     D@      E@     E@      F@     F@      G@     G@      H@     H@      I@     I@      J@     J@      K@     K@      L@     L@      M@     M@      N@     N@      O@     O@      P@     @P@     P@     P@      Q@     @Q@     Q@     Q@      R@     @R@     R@     R@      S@     @S@     S@     S@      T@     @T@     T@     T@      U@     @U@     U@     U@      V@     @V@     V@     V@      W@     @W@     W@     W@      X@     @X@     X@     X@r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r;   astyper_   r"   r   r%   r/   bs      r*   test_check_mean_stat_lengthz)TestStatistic.test_check_mean_stat_length   sM    IIcN!!#&FF1lF
CHH& 	1a r,   c                     t        j                  d      }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   )c   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   rC   r0   r   r.   rZ   r:         rD   r      r9                        rw               rv               rj          !   "   #   $   %   &   '   (   )   *   +   ,   -   .   /   0   1   2   3   4   5   6   7   8   9   :   ;   <   =   >   ?   @   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z   [   \   ]   ^   _   `   a   b   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   s      r*   test_check_maximum_1z"TestStatistic.test_check_maximum_1   @    IIcNFF1h	*HH5& 	1a r,   c                     t        j                  d      dz   }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   rC   ru   r   )rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   r;  r   s      r*   test_check_maximum_2z"TestStatistic.test_check_maximum_2   sE    IIcNQFF1h	*HH?& 	1a r,   c                     t        j                  d      dz   }t        j                  |ddd      }t        j                  g d      }t	        ||       y )Nrs   rC   ru   r   r   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   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   rs   r;  r   s      r*   test_check_maximum_stat_lengthz,TestStatistic.test_check_maximum_stat_length   sG    IIcNQFF1h	r:HH?& 	1a r,   c                     t        j                  d      }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   ru   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   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r;  r   s      r*   test_check_minimum_1z"TestStatistic.test_check_minimum_1   s@    IIcNFF1h	*HH+& 	1a r,   c                     t        j                  d      dz   }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   r0   ru   r   )r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   rs   e   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r0   r;  r   s      r*   test_check_minimum_2z"TestStatistic.test_check_minimum_2  sE    IIcNQFF1h	*HH+& 	1a r,   c                     t        j                  d      dz   }t        j                  |ddd      }t        j                  g d      }t	        ||       y )Nrs   rC   ru   r   r   rx   )rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   rs   r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r3  r;  r   s      r*   test_check_minimum_stat_lengthz,TestStatistic.test_check_minimum_stat_length  sG    IIcNQFF1h	r:HH5& 	1a r,   c                     t        j                  d      j                  d      }t        j                  |dd      }t        j                  g d      }t        ||       y )Nrs   rt   ru   r        H@rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rz   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   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   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   r   r   r   rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  rL  r   r   s      r*   test_check_medianzTestStatistic.test_check_median2  sL    IIcN!!#&FF1h)HHI& 	1a r,   c                     t        j                  g dg dg dg      }t        j                  |dd      }t        j                  g dg dg dg d	g dg      }t        ||       y )
Nr   rC   r.   r.   rZ   rD   rD   r   r0   rC   r   )r.   r.   rZ   r.   r.   r   r   rC   r.   r   rZ   r.   rZ   rD   rZ   r   rD   r   r0   r   )r!   r"   r_   r   r   s      r*   test_check_median_01z"TestStatistic.test_check_median_01J  sW    HHiI67FF1a"HH 	1a r,   c                     t        j                  g dg dg dg      }t        j                  |j                  dd      j                  }t        j                  g dg dg dg d	g dg      }t	        ||       y )
NrO  rP  rQ  rC   r   )rZ   r.   rZ   r.   rZ   rR  rS  rT  )r!   r"   r_   Tr   r   s      r*   test_check_median_02z"TestStatistic.test_check_median_02X  sa    HHiI67FF1338$&&HH 	1a r,   c                     t        j                  d      j                  d      }d|d<   d|d<   t        j                  |ddd	
      }t        j                  g d      }t        ||       y )Nrs   rt   r|   rC   r   r9  ru   r   r   rZ   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|   rz   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   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   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   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   s      r*   test_check_median_stat_lengthz+TestStatistic.test_check_median_stat_lengthf  s_    IIcN!!#&!"FF1hf=HH?& 	1a r,   c                     g dg}t        j                  |ddd      }t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg      }t        ||       y )Nr.   rZ   r:   rZ   r   r   r0   rx   )r.   r.   r.   r.   r.   r.   rZ   r:   r:   r:   r:   r:   r:   r:   r:   r!   r_   r"   r   r   s      r*   test_check_mean_shape_onez'TestStatistic.test_check_mean_shape_one  sc    KFF1ff!4HH:::::::::::::<" 	1a r,   c                     t        j                  d      j                  d      }t        j                  |dd      }t        j                  g d      }t        ||       y )Nrs   rt   ru   r   rK  r   r   s      r*   test_check_mean_2zTestStatistic.test_check_mean_2  sL    IIcN!!#&FF1h'HHI& 	1a r,   rW   )r   r   r   r   c                     t        j                  g d      t        j                  g dt         j                        z   }t        j                  |d|      }t	        |d   |d          y)z3 Test that appended and prepended values are equal )r0   rd  )r   g-q=r   r?   rf   r   rd  N)r!   r"   float64r_   r   )r%   rW   r/   s      r*   test_same_prepend_appendz&TestStatistic.test_same_prepend_append  sJ     HH[!BHH]"**$MMFF1fd#QqT1R5!r,   r   rE   )rE   )r   rd  ))rZ   r0   )rE   r   ))rB   r0   c                     t        j                  d      j                  d      }d}t        j                  t
        |      5  t        j                  |d||       d d d        y # 1 sw Y   y xY w)Nrj   r:   rZ   #index can't contain negative valuesrF   r0   rx   r!   r;   r<   rI   rJ   rK   r_   )r%   rW   r   arrrG   s        r*   test_check_negative_stat_lengthz-TestStatistic.test_check_negative_stat_length  sV    
 iim##F+5]]:U3 	:FF34[9	: 	: 	:s   A%%A.c                    t        j                  d      }t        j                  |d      }t        j                  |ddd      }t        j                  g dg dg dg dg d	g d
g dg dg dg dg dg      }t        ||       y )Nrj   rj  rN   r   r0   r   r   rg   )
r:   r:   r:   rZ   r:   r   r   rD   r   r   )
rC   rC   rC   r   rC   r0   r   r.   r   r   )
r   r   r   r   r   r9   r   r   r   r   )
r   r   r   r   r   r   r   r   r   r   )
r   r   r   rw   r   r   r   r   r   r   )
r   r   r   rv   r   r   r   r   r   r   r!   r;   r<   r_   r"   r   r   s      r*   test_simple_stat_lengthz%TestStatistic.test_simple_stat_length  st    IIbMJJq&!FF1&VFHH++++55555557 	1a r,   z)ignore:Mean of empty slice:RuntimeWarningzCignore:invalid value encountered in( scalar)? divide:RuntimeWarningr   r   c                     t        j                  ddgd|d      }t        j                  t         j                  ddt         j                  t         j                  g      }t	        ||       y )Nr{   r|   rC   r0   r   rx   )r!   r_   r"   nanr   )r%   rW   rm  r&   s       r*   test_zero_stat_length_validz)TestStatistic.test_zero_stat_length_valid  sK     ffb"Xvt;88RVVRRVVRVV<=S(#r,   r   r   c                 `   d}t        j                  t        |      5  t        j                  ddgd|d       d d d        t        j                  t        |      5  t        j                  ddgd|d       d d d        t        j                  t        |      5  t        j                  ddgd|d       d d d        t        j                  t        |      5  t        j                  ddgd|d       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   axY w# 1 sw Y   y xY w)	Nz,stat_length of 0 yields no value for paddingrF   r{   r|   r   rx   )rC   r   rC   )rI   rJ   rK   r!   r_   r%   rW   rG   s      r*   test_zero_stat_length_invalidz+TestStatistic.test_zero_stat_length_invalid  s    >]]:U3 	5FFB8Q!4	5]]:U3 	:FFB8Q&9	:]]:U3 	5FFB8Q!4	5]]:U3 	:FFB8Q&9	: 	:	5 	5	: 	:	5 	5	: 	:s/   D DDD$ D	DD!$D-N)rQ   rR   rS   r   r<  r?  rA  rD  rG  rI  rM  rU  rX  r[  r`  rb  rI   rl   rm   rf  rn  rt  filterwarningsrx  r{  rT   r,   r*   rq   rq      s?   !0!0!0!0!0!0!0!0!!!4!,!0 [[V & "" [[V%MN[[M: O:!* [[ KL[[M [[Vfh%78$ 9 M
$
 [[Vi%;<	: =	:r,   rq   c                   H    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)TestConstantc                     t        j                  d      }t        j                  |ddd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   )r   rw   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   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   rw   r;  r   s      r*   test_check_constantz TestConstant.test_check_constant  sB    IIcNFF1h
HEHH5& 	1a r,   c                     t        j                  d      }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   rC  r;  r   s      r*   test_check_constant_zerosz&TestConstant.test_check_constant_zeros  s@    IIcNFF1h
+HH5& 	1a r,   c                     t        j                  d      j                  dd      }t        j                  |ddd      }t        j                  g dg d	g d
g dg dg dg dg dg      }t        ||       y )Nrj   rZ   r:   rv  r   皙?rW   r   )	rC   rC   rC   rC   rC   rC   rC   rC   rC   )	rC   r   rC   r0   r   r.   rZ   rC   rC   )	rC   r:   r   r   rD   r   r   rC   rC   )	rC   r9   r   r   r   r   r   rC   rC   )	rC   r   r   rw   r   r   r   rC   rC   )	rC   r   rv   r   r   r   r   rC   rC   r!   r;   r<   r_   r"   r   r%   rm  ra   r&   s       r*   test_check_constant_floatz&TestConstant.test_check_constant_float#  sl     iim##Aq)vvc6
#&(8811111111	3 	h'r,   c                 0   t        j                  d      j                  dd      }|j                  t         j                        }t        j
                  |ddd      }t        j                  g dg d	g d
g dg dg dg dg dg      }t        ||       y )Nrj   rZ   r:   rv  rv  r   r  r  )	r  r  r  r  r  r  r  r  r  )	r  rz   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   r  r  )	r  r   r   r   r   r   r   r  r  r!   r;   r<   r   re  r_   r"   r   )r%   rm  	arr_floatra   r&   s        r*   test_check_constant_float2z'TestConstant.test_check_constant_float27  s     iim##Aq)JJrzz*	vvi!1
#&(88LLLLLLLL	N 	h'r,   c                     t        j                  dt              }t        j                  |ddd      }t        j                  g d      }t        ||       y )Nrs   r?   ru   r   )皙333333r  )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   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  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   s      r*   test_check_constant_float3z'TestConstant.test_check_constant_float3L  sF    IIc'FF1h
LIHHI& 	1r,   c           
          t        j                  d      j                  dd      }t        j                  |ddd      }t        j                  g dg d	g d
g dg dg dg dg      }t        ||       y )Nrj   rZ   r:   )rC   rh  r   r   r  )
r   r   r   r   r   r   r   r   r   r   )
r   r   r   rC   r0   r   r.   rZ   r   r   )
r   r   r:   r   r   rD   r   r   r   r   )
r   r   r9   r   r   r   r   r   r   r   )
r   r   r   r   rw   r   r   r   r   r   )
r   r   r   rv   r   r   r   r   r   r   r  r  s       r*   "test_check_constant_odd_pad_amountz/TestConstant.test_check_constant_odd_pad_amountd  sg    iim##Aq)vvc<j#$&8855555557
 	h'r,   c                     t        j                  d      j                  dd      }t        j                  |ddd      }t        j                  g dg dg d	g d
g d
g      }t        ||       y )Nr.   r0   )rv  rC   r   r   )rv  r   r.   r  )r   rC   rC   r.   r.   r.   )r   r   rC   r.   r.   r.   )r   r0   r   r.   r.   r.   )r   r0   r0   r.   r.   r.   r  r  s       r*   test_check_constant_pad_2dz'TestConstant.test_check_constant_pad_2du  sb    iil""1a(vvc+**:<88	!
 	h'r,   c                    d}t        j                  d|t         j                        }t        j                  |dd|j	                               }t        j                  d|t         j                        }t        ||       d}t        j                  d|t         j                        }t        j                  |dd|j	                               }t        j                  d|t         j                        }t        ||       y )	Nl    rZ   r?   rC   r   r  r   l    )r!   fulluint64r_   minr   int64)r%   
uint64_maxrm  ra   r&   	int64_maxs         r*   test_check_large_integersz&TestConstant.test_check_large_integers  s     
gga2995vvc1:swwyI771j		:4*	gga"((3vvc1:swwyI771irxx84*r,   c                 "   t        j                  dt              }t               }||d<   t               }t               }t        j                  |dd||f      }t        j                  dt              }||d<   ||d<   ||d<   t	        ||       y )NrC   r?   r   r   )	pad_widthrW   r   rr  r0   )r!   r   r#   r_   r   )r%   rm  obj_aobj_bobj_cr&   s         r*   test_check_object_arrayz$TestConstant.test_check_object_array  s    hhq'AffSAJ&+U^5 88D/3)r,   c                     t        j                  d      }t        j                  |g dd      }|j                  dk(  sJ y )Nr   r   r0   r   rh  r  r   r\   r   r.   r.   r!   zerosr_   r^   r%   rm  r(   s      r*   test_pad_empty_dimensionz%TestConstant.test_pad_empty_dimension  s5    hhy!/jA||y(((r,   N)rQ   rR   rS   r  r  r  r  r  r  r  r  r  r  rT   r,   r*   r~  r~    s4    !0!0(((*0("(+* )r,   r~  c                       e Zd Zd Zd Zej                  j                  ef      d        Z	d Z
ej                  j                  de      d        Zy)	TestLinearRampc                     t        j                  d      j                  d      }t        j                  |ddd      }t        j                  g d      }t        ||dd	       y )
Nrs   rt   ru   r   )r.   rZ   )r   )r~   gQ@gq=
ףp@g)\(@gzG
@g	@gRQ@g
ףp=
@g(\@g{Gz@g333333@gQ@gp=
ף @gQ?g)\(?g?g
ףp=
?g{Gz?gQ?gQ?g?g{Gz?gQ?g{Gz?g{Gz?rz   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   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   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   r   r   r   g33333W@gffffffV@g9U@gT@g     R@g33333Q@gfffffP@g33333N@gYL@r   gfffffG@gLE@g33333B@g@@g     <@g7@g3@g,@gffffff#@r   gh㈵>)rtolatol)r!   r;   r   r_   r"   r   r   s      r*   test_check_simplez TestLinearRamp.test_check_simple  sR    IIcN!!#&FF1h&AHHF& 	14d3r,   c                 ,   t        j                  d      j                  dd      j                  t         j                        }t        j
                  |ddd      }t        j                  g dg d	g d
g dg dg dg dg dg      }t        ||       y )Nrw   r.   rZ   )r0   r0   r   r[   rW   r   )	rz   rz   rz   rz   rz   rz   rz   rz   rz   )	rz   rz   rz   ry   r{   g      ?r|   r{   rz   )	rz   rz   rz   r{   r|   r}   r~   r|   rz   )	rz   g      @r   r   r   r   r   g      @rz   )	rz   r   r   r   r   r   r   r   rz   )	rz         @r   r   r   r   r         #@rz   )	rz   g      @r  r   g      !@r   r  g      @rz   r  r  s       r*   test_check_2dzTestLinearRamp.test_check_2d  sx    iim##Aq)00<vvc6&I88BBBBBBBBDE 	h'r,   )
exceptionsc                 >   ddl m} t        j                   |dd       |dd      g      }t        j                  |ddd      }t        j                   |dd	       |d
d	       |dd	       |dd	       |dd	       |dd	       |dd	      g      }t        ||       y )Nr   )FractionrC   r0   rd  rN   r   r  r9   r   r:   rB   rE   )	fractionsr  r!   r"   r_   r   )r%   r  rm  actualr&   s        r*   test_object_arrayz TestLinearRamp.test_object_array  s    &hhAQ89V-AF 88aaaRRRR
  	VX&r,   c                    t        j                  t        j                  d      j                  dd      dd      }t	        |dddf   d	       t	        |ddd
f   d	       t	        |dddf   d	       t	        |d
ddf   d	       y)z!Ensure that end values are exact.r   r0   rZ   )   {   r   r\   Nr   rz   rd  )r!   r_   rO   r<   r   )r%   r/   s     r*   test_end_valueszTestLinearRamp.test_end_values  sq    FF2772;&&q!,j}MQq!tWb!Qq"uXr"Qq!tWb!Qr1uXr"r,   r@   c                 \   t        j                  dg|      }t        j                  |ddd      }t        j                  g d|      }t        ||       t        j                  dg|      }t        j                  |ddd      }t        j                  g d|      }t        ||       y)	a<  
        Check correct behavior of unsigned dtypes if there is a negative
        difference between the edge to pad and `end_values`. Check both cases
        to be independent of implementation. Test behavior for all other dtypes
        in case dtype casting interferes with complex dtypes. See gh-14191.
        r   r?   r   r   r  )r   rC   r0   r   r0   rC   r   )r   r0   rC   r   rC   r0   r   N)r!   r"   r_   r   )r%   r@   r'   r(   r&   s        r*   test_negative_differencez'TestLinearRamp.test_negative_difference  s     HHaS&1=Q?881?VX&HHaS&1=Q?881?VX&r,   N)rQ   rR   rS   r  r  rI   rl   xfailAssertionErrorr  r  rm   _numeric_dtypesr  rT   r,   r*   r  r    s_    40( [[>"34' 5'$# [[Wo6' 7'r,   r  c                   N    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zy)TestReflectc                     t        j                  d      }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   )rv   r   r   r   r   rw   r   r   r   r   r   r   r   r9   r   r   rD   r   r   r:   rZ   r.   r   r0   rC   r   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   r:  r9  r8  r7  r6  r5  r4  r3  r2  r1  r0  r/  r.  r-  r,  r+  r*  r)  r(  r'  r;  r   s      r*   r  zTestReflect.test_check_simple  r=  r,   c                     t        j                  d      }t        j                  |ddd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   oddr   )ir  rB   rA   rE   rd  r   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   rs   rF  f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   r;  r   s      r*   test_check_odd_methodz!TestReflect.test_check_odd_method  sB    IIcNFF1h	>HH?& 	1a r,   c                     g dg dg}t        j                  |dd      }t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg dg      }t        ||       y )Nr]  r:   r   r   r^  r   )r   r:   r   r   r   r:   r   r   r   r:   r   r   r   r:   r   rZ   r.   rZ   r:   rZ   r.   rZ   r:   rZ   r.   rZ   r:   rZ   r.   rZ   r_  r   s      r*   test_check_large_padz TestReflect.test_check_large_pad+  sg    	"FF1fi(HH::::::::::::::<$ 	1a r,   c                     g dg}t        j                  |dd      }t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg      }t        ||       y )Nr]  r^  r   r  r_  r   s      r*   test_check_shapezTestReflect.test_check_shapeB  sa    KFF1fi(HH:::::::::::::<" 	1a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )NrC   r0   r   r0   r   )r   r0   rC   r0   r   r0   rC   r_  r   s      r*   test_check_01zTestReflect.test_check_01X  s-    FF9a+HH*+1a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r   r   )	r0   r   r0   rC   r0   r   r0   rC   r0   r_  r   s      r*   test_check_02zTestReflect.test_check_02]  s-    FF9a+HH011a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r.   r   )rC   r0   r   r0   rC   r0   r   r0   rC   r0   r   r_  r   s      r*   test_check_03zTestReflect.test_check_03b  s-    FF9a+HH671a r,   c                     t        j                  g dddgd      }t        j                  g d      }t        ||       y )Nr  rC   r   r   )r0   rC   r0   r   r0   rC   r0   r   r0   rC   r0   r   r0   rC   r_  r   s      r*   test_check_04zTestReflect.test_check_04g  s1    FF9q"gy1HH?@1a r,   c                     t        j                  g dddgd      }t        j                  g d      }t        ||       y )NrC   r0   r   r.   r  r   r   );r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r   r.   r   r0   rC   r0   r_  r   s      r*   test_check_05zTestReflect.test_check_05l  s7    FF<"b95HH() 	1a r,   c                     t        j                  g dddgd      }t        j                  g d      }t        ||       y )Nr  r   r0   r   )r0   r   r.   r.   r   r0   rC   rC   r0   r   r.   r.   r   r0   rC   rC   r0   r   r.   r.   r   r_  r   s      r*   test_check_06zTestReflect.test_check_06w  s7    FF<"a+6HH

 	1a r,   c                     t        j                  g dddgd      }t        j                  g d      }t        ||       y )N)rC   r0   r   r.   rZ   r:   r  r   r   )6r.   rZ   r:   r:   rZ   r.   r   r0   rC   rC   r0   r   r.   rZ   r:   r:   rZ   r.   r   r0   rC   rC   r0   r   r.   rZ   r:   r:   rZ   r.   r   r0   rC   rC   r0   r   r.   rZ   r:   r:   rZ   r.   r   r0   rC   rC   r0   r   r.   rZ   r:   r:   rZ   r.   r_  r   s      r*   test_check_07zTestReflect.test_check_07  s8    FF%Aw<HH 	1a r,   N)rQ   rR   rS   r  r  r  r  r   r  r  r  r	  r  r  rT   r,   r*   r  r    s9    !0!0!.!,!
!
!
!
	!!	!r,   r  c                       e Zd ZdZej
                  j                  d eej                         ddhz
              d        Z
ej
                  j                  dej                               d        Zy)TestEmptyArrayz<Check how padding behaves on arrays with an empty dimension.rW   r   r   c                    d}t        j                  t        |      5  t        j                  g d|       d d d        t        j                  t        |      5  t        j                  t        j
                  d      d|       d d d        t        j                  t        |      5  t        j                  t        j                  d      d|       d d d        y # 1 sw Y   xY w# 1 sw Y   exY w# 1 sw Y   y xY w)NzFcan't extend empty axis 0 using modes other than 'constant' or 'empty'rF   r.   r\   r   )r   r   )r  r  )rI   rJ   rK   r!   r_   ndarrayr  rz  s      r*   r  z'TestEmptyArray.test_pad_empty_dimension  s    ]]:U3 	%FF2qt$	%]]:U3 	0FF2::a=!$/	0]]:U3 	>FF288F#\=	> 	>		% 	%	0 	0	> 	>s#   C,C*),C6C'*C36C?c                 |    t        j                  t        j                  d      d|      }|j                  dk(  sJ y )N)r0   r   r0   )rr  r  r  r\   )r   r   r.   )r!   r_   rO   r^   )r%   rW   r(   s      r*   test_pad_non_empty_dimensionz+TestEmptyArray.test_pad_non_empty_dimension  s0    	*,>TJ||y(((r,   N)rQ   rR   rS   __doc__rI   rl   rm   sortedrn   ro   r  r  rT   r,   r*   r  r    so    F[[ 	z(J+@@A
>
> [[VZ__%67) 8)r,   r  c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
TestSymmetricc                     t        j                  d      }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   )r   r   r   r   rw   r   r   r   r   r   r   r   r9   r   r   rD   r   r   r:   rZ   r.   r   r0   rC   r   r   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   r   r:  r9  r8  r7  r6  r5  r4  r3  r2  r1  r0  r/  r.  r-  r,  r+  r*  r)  r(  r;  r   s      r*   r  zTestSymmetric.test_check_simple  s@    IIcNFF1h,HH5& 	1a r,   c                     t        j                  d      }t        j                  |ddd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   r  r  )r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rB   rA   rE   rd  r   r   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   r   rs   rF  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r;  r   s      r*   r  z#TestSymmetric.test_check_odd_method  sB    IIcNFF1h%@HH?& 	1a r,   c                     g dg dg}t        j                  |dd      }t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg dg      }t        ||       y )Nr]  r  r^  r   rZ   r:   r:   rZ   r.   r.   rZ   r:   r:   rZ   r.   r.   rZ   r:   r:   )r   r   r   r   r:   r:   r   r   r   r   r:   r:   r   r   r   r_  r   s      r*   r  z"TestSymmetric.test_check_large_pad  sg    	"FF1fk*HH::::::::::::::<& 	1a r,   c                     g dg dg}t        j                  |ddd      }t        j                  g dg dg dg dg d	g d	g d
g d
g dg dg dg dg dg dg      }t        ||       y )Nr]  r  r^  r   r  r  )rA   rE   rE   rd  r   r   rC   r0   r0   r   r.   r.   rZ   r:   r:   )rd  r   r   rC   r0   r0   r   r.   r.   rZ   r:   r:   r   r   r   )rC   r0   r0   r   r.   r.   rZ   r:   r:   r   r   r   rD   r   r   )r   r.   r.   rZ   r:   r:   r   r   r   rD   r   r   r   r9   r9   )rZ   r:   r:   r   r   r   rD   r   r   r   r9   r9   r   r   r   )r   r   r   rD   r   r   r   r9   r9   r   r   r   r   r   r   )rD   r   r   r   r9   r9   r   r   r   r   r   r   r   r   r   r_  r   s      r*   test_check_large_pad_oddz&TestSymmetric.test_check_large_pad_odd  sj    	"FF1fk>HHIIIIIIIIIIIIIIK$ 	1a r,   c                     g dg}t        j                  |dd      }t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg      }t        ||       y )Nr]  r^  r   r  r_  r   s      r*   r  zTestSymmetric.test_check_shape  sa    KFF1fk*HH:::::::::::::<" 	1a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r0   r   )r0   rC   rC   r0   r   r   r0   r_  r   s      r*   r   zTestSymmetric.test_check_01  s-    FF9a-HH*+1a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r   r   )	r   r0   rC   rC   r0   r   r   r0   rC   r_  r   s      r*   r  zTestSymmetric.test_check_02  s-    FF9a-HH011a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r:   r   )rC   r0   r   r   r0   rC   rC   r0   r   r   r0   rC   rC   r0   r   r_  r   s      r*   r  zTestSymmetric.test_check_03$  s-    FF9a-HHBC1a r,   N)rQ   rR   rS   r  r  r  r  r  r   r  r  rT   r,   r*   r  r    s*    !0!0!0!.!,!
!
!r,   r  c                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	TestWrapc                     t        j                  d      }t        j                  |dd      }t        j                  g d      }t	        ||       y )Nrs   ru   r   )r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   r   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   rw   r   r   r   r   rv   r   r   r   r   rj   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  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/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r   r   rC   r0   r   r.   rZ   r:   r   r   rD   r   r   r9   r   r   r   r   r   r   r   r;  r   s      r*   r  zTestWrap.test_check_simple+  s@    IIcNFF1h'HH5& 	1a r,   c                 `   t        j                  d      }t        j                  |d      }t        j                  |dd      }t        j                  g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg      }t        ||       y )Nr9   r  )r   r9   r   )r   r   r   rD   r   r   r   rD   r   r   r   rD   r   r   r   rD   r   r   r   rD   r   r   r   rD   r   r   )r0   r   r   rC   r0   r   r   rC   r0   r   r   rC   r0   r   r   rC   r0   r   r   rC   r0   r   r   rC   r0   r   )r:   r   r.   rZ   r:   r   r.   rZ   r:   r   r.   rZ   r:   r   r.   rZ   r:   r   r.   rZ   r:   r   r.   rZ   r:   r   rs  r   s      r*   r  zTestWrap.test_check_large_padC  s    IIbMJJq&!FF1h'HH.)).)).)).)).)).)).)).)).e3/5l 	1a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r   r   )	rC   r0   r   rC   r0   r   rC   r0   r   r_  r   s      r*   r   zTestWrap.test_check_01  s-    FF9a(HH011a r,   c                 |    t        j                  g ddd      }t        j                  g d      }t        ||       y )Nr  r.   r   )r   rC   r0   r   rC   r0   r   rC   r0   r   rC   r_  r   s      r*   r  zTestWrap.test_check_02  s-    FF9a(HH671a r,   c                     t        j                  d      }t        j                  |dd      }t        ||d dd df          y )NrZ  )r   rZ   r   r\   r  )r!   rO   r_   r   r   s      r*   test_pad_with_zerozTestWrap.test_pad_with_zero  s;    GGFOFF1f6*1aSbSk*r,   c                 H   t        j                  d      }t        j                  |dd      }t        t         j                  ||||f   dd |       t        j                  d      }t        j                  |dd      }t        t         j                  ||||f   dd |       y)	zy
        Check wrapping on each side individually if the wrapped area is longer
        than the original array.
        rZ   )r9   r   r   r\   r   N)r   r9   rA   )r!   r;   r_   r   r_r   s      r*   test_repeated_wrappingzTestWrap.test_repeated_wrapping  s    
 IIaLFF1gF+255Aq!,QR0!4IIaLFF1gF+255Aq!,Sb115r,   c           	          t        j                  d      j                  dd      }t        j                  |ddgd      }t        j                  g dg dg dg dg dg dg      }t        ||       y	)
z
        Assert that 'wrap' pads only with multiples of the original area if
        the pad width is larger than the original array.
        r.   r0   r  r   rC   r   r\   )r   r0   r   r0   r   r0   )rC   r   rC   r   rC   r   Nrs  r   s      r*   &test_repeated_wrapping_multiple_originz/TestWrap.test_repeated_wrapping_multiple_origin  sf    
 IIaL  A&FF1vv&V4HH!
 	1a r,   N)
rQ   rR   rS   r  r  r   r  r)  r,  r/  rT   r,   r*   r#  r#  *  s&    !0:!x!
!
+
6!r,   r#  c                       e Zd Zd Zd Zy)TestEdgec                     t        j                  d      }t        j                  |d      }t        j                  |dd      }t        j                  g dg dg dg dg dg dg dg dg dg	      }t        ||       y 	Nr9   r.   r   rp  r   )r   r   r   r   rC   r0   r0   r0   )r   r   r   r   r.   rZ   rZ   rZ   )r:   r:   r:   r:   r   r   r   r   )rD   rD   rD   rD   r   r   r   r   rs  r   s      r*   r  zTestEdge.test_check_simple  sl    IIbMJJq&!FF1&/HH%%%%%))))
+ 	1a r,   c                    t        j                  g d      }t        j                  |dd      }t        j                  g d      }t        ||       t        j                  g dg dg      }t        j                  |dd      }t        j                  |dd      }t        ||       t        j                  d      j                  dd	d
      }t        j                  |dd      }t        j                  |dd      }t        ||       y )Nr  )rv  r   )rC   rC   r0   r   r   r   r]  r  r   r0   r   r.   )rv  rv  rv  )r!   r"   r_   r   r;   r<   )r%   r/   paddedr&   s       r*   test_check_width_shape_1_2z#TestEdge.test_check_width_shape_1_2  s     HHY9f-88./68,HHi+,9f-66!-v668,IIbM!!!Q*9f-66!5v>68,r,   N)rQ   rR   rS   r  r7  rT   r,   r*   r1  r1    s    !&-r,   r1  c                       e Zd Zd Zd Zy)	TestEmptyc                     t        j                  d      j                  dd      }t        j                  |ddgd      }|j                  dk(  sJ t        ||d	d
ddf          y )Nr   r.   r:   rN   r.  r   r\   )rD   r   r0   rA   r   rd  r!   r;   r<   r_   r^   r   r  s      r*   test_simplezTestEmpty.test_simple  s`    iim##Aq)ff-G<||w&&&S&2qt,-r,   c                     t        j                  d      }t        j                  |g dd      }|j                  dk(  sJ y )Nr  r  r   r\   r  r  r  s      r*   r  z"TestEmpty.test_pad_empty_dimension  s5    hhy!/g>||y(((r,   N)rQ   rR   rS   r<  r  rT   r,   r*   r9  r9    s    .)r,   r9  c            	          d } t        j                  d      j                  dd      }t        j                  |d|       }t        j                  g dg dg dg dg dg dg      }t        ||       y )Nc                 &    d| d |d    d| |d    d  y )Nr   r   rC   rT   )vectorr  iaxiskwargss       r*   _padwithtensz6test_legacy_vector_functionality.<locals>._padwithtens  s$     "}	!!#	!}~r,   r:   r0   r   )r   r   r   r   r   r   r   )r   r   r   rC   r0   r   r   )r   r   r   r.   rZ   r   r   rs  )rC  r/   r   s      r*    test_legacy_vector_functionalityrD    sf    $ 			!Q"A
q!\"A
	%	%	%	%	%	%	'		
A q!r,   c                  |    t        j                  dgdd      } t        j                  g d      }t        | |       y )NrC   r0   r   r\   )r   r   rC   r   r   r_  )r/   r   s     r*   test_unicode_moderF    s.    
sAJ'A
!Aq!r,   rW   )r   r   r   r   c                     t        j                  dd       }d}t        j                  dd       }t        t        j                  |||       |       y )Nr4  )
fill_valuerp  )rD   r   r\   )r!   r  r   r_   )rW   r/   rc   r   s       r*   test_object_inputrI    s@     	4(AG
4(Arvvat4a8r,   c                   *   e Zd Zej                  j                  dg d      ej                  j                  dej                               d               Zej                  j                  dej                               d        Z	ej                  j                  dg d      ej                  j                  dej                               d               Z
ej                  j                  dd	d
d e       dfddef edd      dfdg      ej                  j                  dej                               d               Zd Zej                  j                  dg d      ej                  j                  dej                               d               Zy)TestPadWidthr  ))r.   rZ   r:   r   )r  rh  rr  )rv  r  )rZ   r:   ))r   r.   rZ   )r   rC   r0   rW   c                     t        j                  d      j                  d      }d}t        j                  t
        |      5  t        j                  |||       d d d        y # 1 sw Y   y xY w)Nrj   rj  z(operands could not be broadcast togetherrF   rl  r%   r  rW   rm  rG   s        r*   test_misshaped_pad_widthz%TestPadWidth.test_misshaped_pad_width  sT     iim##F+:]]:U3 	)FF3	4(	) 	) 	)   A##A,c                     t        j                  d      j                  d      }d}t        j                  t
        |      5  t        j                  |d|       d d d        y # 1 sw Y   y xY w)Nrj   rj  zDinput operand has more dimensions than allowed by the axis remappingrF   ))rr  )r.   )rZ   )r  r  rh  rl  )r%   rW   rm  rG   s       r*   test_misshaped_pad_width_2z'TestPadWidth.test_misshaped_pad_width_2  sY    iim##F+]]:U3 	HFF3@$G	H 	H 	HrO  rg  c                     t        j                  d      j                  d      }d}t        j                  t
        |      5  t        j                  |||       d d d        y # 1 sw Y   y xY w)Nrj   rj  rk  rF   rl  rM  s        r*   test_negative_pad_widthz$TestPadWidth.test_negative_pad_width  sT     iim##F+5]]:U3 	)FF3	4(	) 	) 	)rO  zpad_width, dtype)3N)wordNr3   N)g333333@N))r0   r   r.   rq  rC   rd  )))g r   rq  Nc                 P   t        j                  d      j                  d      }d}|Qt        j                  t
        |      5  t        j                  |t        j                  ||      |       d d d        y t        j                  t
        |      5  t        j                  |||       d d d        t        j                  t
        |      5  t        j                  |t        j                  |      |       d d d        y # 1 sw Y   y xY w# 1 sw Y   dxY w# 1 sw Y   y xY w)Nrj   rj  z%`pad_width` must be of integral type.rF   r?   )r!   r;   r<   rI   rJ   	TypeErrorr_   r"   )r%   r  r@   rW   rm  rG   s         r*   test_bad_typezTestPadWidth.test_bad_type#  s     iim##F+7y6 DsBHHYe<dCD D y6 -sIt,-y6 7sBHHY/67 7D D- -7 7s$   -DD+DDDD%c                 &   t        j                  d      }t        j                  |d      }t        j                  |t        j                  d      d      }t        j                  g dg dg dg dg dg dg dg dg dg	      }t        ||       y r3  rs  r   s      r*   test_pad_width_as_ndarrayz&TestPadWidth.test_pad_width_as_ndarray;  su    IIbMJJq&!FF1bhh/0&9HH000000000
2 	1a r,   )r   r[   )r[   r[   c                     t        j                  d      j                  dd      }t        |t        j                  |||             y )Nrj   r:   rZ   r\   )r!   r;   r<   r   r_   )r%   r  rW   rm  s       r*   test_zero_pad_widthz TestPadWidth.test_zero_pad_widthN  s5     iim##Aq)3sID ABr,   )rQ   rR   rS   rI   rl   rm   rn   ro   rN  rQ  rS  r#   r
   rX  rZ  r\  rT   r,   r*   rK  rK    s   [[[ +  [[VZ__%67) 8) [[VZ__%67H 8H [[KM[[VZ__%67) 8M) [[/	4	f%	B#	2 	 [[VZ__%677 8	7!& [[[*GH[[VZ__%67C 8 ICr,   rK  c                    t         |    }i }t         j                         D ]  }||k7  s	|j                  |        t        j                  g dd| fi | |j                         D ]V  \  }}dj                  |       }t        j                  t        |      5  t        j                  g dd| fi ||i ddd       X y# 1 sw Y   cxY w)z1Test behavior of pad's kwargs for the given mode.r  rC   z+unsupported keyword arguments for mode '{}'rF   N)
rn   valuesupdater!   r_   itemsformatrI   rJ   rK   )rW   allowednot_allowedrB  keyvaluerG   s          r*   test_kwargsrf  U  s     GK##% 'Wv&' FF9a))!'') 7
U=DDTJ]]:U3 	7FF9a6#u6	7 	77	7 	7s   C  C		c                  v    t        j                  ddg      } t        t        j                  | d      g d       y )NrC   r0   )r   r   rC   rC   r   r   )r!   r"   r   r_   )rm  s    r*   test_constant_zero_defaultrh  f  s)    
((Aq6
Crvvc1~'9:r,   rC   constTFc                     dj                  |       }t        j                  t        |      5  t	        j
                  g dd|        d d d        y # 1 sw Y   y xY w)Nzmode '{}' is not supportedrF   r  r.   r\   )ra  rI   rJ   rK   r!   r_   )rW   rG   s     r*   test_unsupported_moderk  k  sE    '..t4E	z	/ (
y!$'( ( (s   AAc                     t        j                  d      j                  dd      d d dd d df   }t        j                  |d|       }|j                  dk(  sJ t        |ddddf   |       y )Nr   r.   r:   r0   rN   )r   r   rA   r;  )rW   rm  r(   s      r*   test_non_contiguous_arrayrm  r  sl    
))B-

1
%cc3Q3h
/CVVC&F<<6!!!"ad
#S)r,   c                     t        j                  dd      }t        j                  |d|       j                  d   sJ t        j                  dd      }t        j                  |d|       j                  d   sJ y)	z5Test if C and F order is preserved for all pad modes.)rZ   r   C)orderrZ   C_CONTIGUOUSFF_CONTIGUOUSN)r!   rO   r_   flags)rW   r'   s     r*   test_memory_layout_persistenceru  z  sf     	s#A66!Q##N333
s#A66!Q##N333r,   r@   c                     t        j                  d|       }t        j                  |d|      }|j                  | k(  sJ y )N)r   r0   rC   r?   rC   r\   )r!   r  r_   r@   )r@   rW   rm  r(   s       r*   test_dtype_persistencerw    s8     ((9E
*CVVC&F<<5   r,   )'r  rI   numpyr!   numpy.testingr   r   r   numpy.lib._arraypad_implr   _coresctypesr  rn   r   rV   rq   r~  r  r  r  r  r#  r1  r9  rD  rF  rl   rm   rI  rK  ro   rf  rh  r#   rk  rm  ru  rw  rT   r,   r*   <module>r}     s     K K . HHVhhuhhw  	hhy!"  #A& !$t$D!d#t$' &)
P* P*fM M,f: f:Rp) p)fR' R'jO! O!d) )0C! C!L@! @!F$- $-N
) 
)( !IJ9 K9NC NCb !237 47 ;
 !WfhdE!JK( L( !23* 4* !234 44 /2!23! 4 3!r,   