
    pi{                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZm	Z	 d dl
mZmZ d dlmZmZmZ d dlZd dlmZ d dlmZ d Zd Zd	 Zd
 Zd Z G d de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ej                        Z!e"dk(  r ejF                          yy)    N)njit	vectorize)MemoryLeakMixinTestCase)TypingErrorNumbaNotImplementedErrorNumbaExperimentalFeatureWarning)dufunc)
from_dtypec                     | |z   S N a0a1s     b/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/numba/tests/npyufunc/test_dufunc.pypyuaddr          7N    c                     | |z
  S r   r   r   s     r   pysubr      r   r   c                     | |z  S r   r   r   s     r   pymultr      r   r   c                     | |z  S r   r   r   s     r   pydivr      s    8Or   c                     | |k  r| S |S r   r   r   s     r   pyminr   "   s    b2 b r   c                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	
TestDUFuncc                 D    t        j                  |t        d            S )NT)nopython)targetoptions)r
   DUFuncdict)selfpyfuncs     r   nopython_dufunczTestDUFunc.nopython_dufunc(   s    }}V43FGGr   c           	         | j                  t              }| j                  |j                         d|_        | j	                  |j                         | j                  t              5  d|_        d d d        | j                  t              5   |t        j                  ddd      t        j                  ddd             d d d        y # 1 sw Y   [xY w# 1 sw Y   y xY w)NTFr      
      )
r'   r   assertFalse_frozen
assertTrueassertRaises
ValueError	TypeErrornplinspacer%   duadds     r   test_frozenzTestDUFunc.test_frozen+   s    $$V,'&z* 	"!EM	"y) 	<"++a"%r{{1Qr':;	< 	<	" 	"	< 	<s   (C
4C
CCc                 t    | j                  t              }| j                  t        dd       |dd             y )Nr)   r+   )r'   r   assertEqualr4   s     r   test_scalarzTestDUFunc.test_scalar5   s.    $$V,!eAaj1r   c                 h   | j                  t              t        fd       }t        j                  ddd      }|d d }|dd  }t        j
                  d      } ||||       t        j                  j                  ||z   |       |j                  d      }|j                  d      }t        j
                  d      } ||||       t        j                  j                  ||z   |       |d d }	t        j
                  d      }
 |||	|
       t        j                  j                  ||	z   |
       y )Nc                      | ||       y r   r   )r   r   o0r5   s      r   npmaddz(TestDUFunc.test_npm_call.<locals>.npmadd<   s    "b"r   r   ffffff?   r*   r+      rA   )	r'   r   r   r2   r3   zerostestingassert_array_equalreshape)r%   r=   XX0X1out0Y0Y1out1Y2out2r5   s              @r   test_npm_callzTestDUFunc.test_npm_call9   s   $$V,		 
	KK#b!sVrsVxx|r2t


%%b2gt4ZZZZxxr2t


%%b2gt4Vxxr2t


%%b2gt4r   c                    | j                  t              t        fd       }t        j                  ddd      }|d d }|dd  } |||      }t        j
                  j                  ||z   |       |j                  d      }|j                  d      } |||      }t        j
                  j                  ||z   |       |d d }	 |||	      }
t        j
                  j                  ||	z   |
        |dd	      }| j                  |d
       y )Nc                      | |      S r   r   )r   r   r5   s     r   r=   z8TestDUFunc.test_npm_call_implicit_output.<locals>.npmaddR   s    R= r   r   r>   r?   r*   r@   rA         ?       @g      @)	r'   r   r   r2   r3   rC   rD   rE   r8   )r%   r=   rF   rG   rH   rI   rJ   rK   rL   rM   rN   out3r5   s               @r   test_npm_call_implicit_outputz(TestDUFunc.test_npm_call_implicit_outputO   s    $$V,		! 
	!KK#b!sVrsVb"~


%%b2gt4ZZZZb"~


%%b2gt4Vb"~


%%b2gt4b}r"r   c                    | j                  t              }| j                  |j                  d       | j                  |j                  d       | j                  |j
                  |j                  |j                  z          | j                  |j                  d       | j                  |j                  g        | j                  |j                  d         |dd       | j                  |j                  d       | j                  |j                  t        |j                               | j                  |j                         y )Nr+   r)   r   )r'   r   r8   ninnoutnargsntypestypesidentitylenassertIsNone	signaturer4   s     r   test_ufunc_propszTestDUFunc.test_ufunc_propsd   s    $$V,A&Q'eii%**&<=q)b).aq)s5;;'78%//*r   c                 H   | j                  t               dd       j                  j                  j                  j
                  j                  d}fd}|j                         D ]1  \  }}t         ||            }| j                  | |       d|        3 y )Nr)   r+   )rW   rX   rY   r\   r_   c                 b    d|  d}i }t        t        j                  |      di|       |d   S )Nz>
                def impl():
                    return duadd.z
            r5   impl)exectextwrapdedent)attrfnlr5   s      r   get_attr_fnz4TestDUFunc.test_ufunc_props_jit.<locals>.get_attr_fn}   sD    ""& (B A$w&6:V9r   z!Attribute differs from original: )
r'   r   rW   rX   rY   r\   r_   itemsr   r8   )r%   
attributesrj   rg   valcfuncr5   s         @r   test_ufunc_props_jitzTestDUFunc.test_ufunc_props_jitq   s    $$V,a"YY#jj${{ #(..#(??4
	 $))+ 	IID#T*+ES%'@GI	Ir   N)
__name__
__module____qualname__r'   r6   r9   rO   rU   r`   ro   r   r   r   r   r   &   s'    H<25,#*+Ir   r   c                   D    e Zd Zej                  dd       Zd Zd Zd Zy)TestDUFuncMethodsBaseNc                    |dv sJ |dk(  rKj                   dk(  r t        |      fd      n t        |      fd      t        dfd	       }|S |dk(  r@j                   dk7  rt        d	       t        |      fd
      t        dfd	       }|S j                   dk(  r t        |      fd      n t        |      fd      t        fd       }|S )N)reducereduceatatrv   r+   r\   c                      | |      S r   r   abufuncs     r   <lambda>z5TestDUFuncMethodsBase._generate_jit.<locals>.<lambda>       a r   c                      |       S r   r   r|   r~   s    r   r   z5TestDUFuncMethodsBase._generate_jit.<locals>.<lambda>       U1X r   c                 ,    j                  | ||      S Naxisinitialrv   arrayr   r   vecs      r   rh   z/TestDUFuncMethodsBase._generate_jit.<locals>.fn   s    zz%dGzDDr   rw   ,reduceat only supported for binary functionsc                      | |      S r   r   r{   s     r   r   z5TestDUFuncMethodsBase._generate_jit.<locals>.<lambda>       E!QK r   c                 .    j                  | ||||      S r   rw   )r   indicesr   dtypeoutr   s        r   rh   z/TestDUFuncMethodsBase._generate_jit.<locals>.fn   s    ||E7D%EEr   c                      | |      S r   r   r{   s     r   r   z5TestDUFuncMethodsBase._generate_jit.<locals>.<lambda>   r   r   c                      |       S r   r   r   s    r   r   z5TestDUFuncMethodsBase._generate_jit.<locals>.<lambda>   r   r   c                  "     j                   |  S r   rx   )argsr   s    r   rh   z/TestDUFuncMethodsBase._generate_jit.<locals>.fn   s    svvt}$r   r   N)r   NN)rW   r   r   r0   )r%   r~   kindr\   rh   r   s    `   @r   _generate_jitz#TestDUFuncMethodsBase._generate_jit   s    33338yyA~2i23KL2i23EFE EIZyyA~ !OPP.)X./GHCF FIyyA~2i23KL2i23EF% %Ir   c                 *    | j                  |d|      S )Nrv   ry   r   r%   r~   r\   s      r   _reducezTestDUFuncMethodsBase._reduce   s    !!%H!EEr   c                 *    | j                  |d|      S )Nrw   ry   r   r   s      r   	_reduceatzTestDUFuncMethodsBase._reduceat   s    !!%h!GGr   c                 &    | j                  |d      S )Nrx   r   )r%   r~   s     r   _atzTestDUFuncMethodsBase._at   s    !!%..r   r   )	rp   rq   rr   	functoolscacher   r   r   r   r   r   r   rt   rt      s*    __ @FH/r   rt   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d Zej$                  d        Zd Zd Zd Zd Zej$                  d        Zd Zd Zd Zd Zd Zy)TestDUFuncAtc                     |j                         }|j                         } |j                  |g|   ||g|  | j                  ||       y r   )copyrx   assertPreciseEqual)r%   rh   r~   r|   r   expectedgots          r   _compare_outputzTestDUFuncAt._compare_output   sF    668ffh!D!
3#.r   c                    t        j                  dt              }| j                  t         j                        }| j                  t         j
                        } t               d       t        fd       }| j                  |t         j                  |g dd       d}| j                  t        |      5   ||j                         g dd        d d d        | j                  |t         j
                  |j                         g d       t        j                  g d	      }| j                  |t         j                  |j                         g d|       d
}| j                  t        |      5   ||j                         g dg d       d d d        | j                  t              5   ||j                         g dddgdg       d d d        y # 1 sw Y   xY w# 1 sw Y   RxY w# 1 sw Y   y xY w)Nr*   r   c                 ,    t        j                  |       S r   r2   negativer|   s    r   r   z8TestDUFuncAt.test_numpy_ufunc_at_basic.<locals>.<lambda>   s    R[[^ r   c                 *    j                  | ||      S r   r   )r|   r   r}   negative_vecs      r   negative_jit_2z>TestDUFuncAt.test_numpy_ufunc_at_basic.<locals>.negative_jit_2   s    ??1gq11r   r+   rA   r+   r)   zsecond operand needed for ufunc)r+   rA      d   r   r   z+second operand provided when ufunc is unaryr)   r+   r   r+   )r2   arangeintr   addr   r   r   r   assertRaisesRegexr   r   r   r/   )r%   r|   add_atnegative_atr   err_msgr}   r   s          @r   test_numpy_ufunc_at_basicz&TestDUFuncAt.test_numpy_ufunc_at_basic   s    IIb$"&&!hhr{{+"y{#;<		2 
	2 	VRVVQ	1= 4##K9 	.1668Y-	. 	["++qvvxKHH_%VRVVQVVXy!D @##K9 	;1668Y	:	; {+ 	51668Y!Q4	5 	5	. 	.	; 	;	5 	5s$   7G.G(G(GG%(G1c           
      |   t         j                  d   }t         j                  t         j                  t         j                  f}|D ]R  }	 t        t        j                  |             |D ]*  }t        j                  d|      }t        j                  t        j                  dt         j                        t        j                  ddt         j                        g      }|j                  j                  d      }| j                  |      } ||||       t        j                  |      }	|t         j                  u rdx|	d	<   |	d<   |	d	xx   d|t         j                  u r|n| z  z  cc<   |	dxx   d|t         j                  u r|n| z  z  cc<   - U | j                  	       y # t        $ r Y uw xY w)
NComplexr*   r            y              ?r)   )r2   	typecodesr   subtractmultiplyr   r   r   onesconcatenateintpfulltyper   	ones_liker   )
r%   r   ufuncstypecoder~   r|   indxvalueufunc_atr   s
             r   test_ufunc_at_inner_loopz%TestDUFuncAt.test_ufunc_at_inner_loop   sj   LL+	&&"++r{{3! 	OH288H-.   OGGBh/~~rwwq'@')wwr1BGG'D'F GR(88E?D%(<<?BKK'022HQK(1+QK1"&&uf#MMKQK2%266/v#NNKO	O* 	8,# , s   
F..	F;:F;c           
         t        j                  dt              }| j                  t         j                        }| j                  |t         j                  |t        d       t        j                  dt                     y )NrA   r   )r2   rB   r   r   r   r   slicer   r%   arrr   s      r   test_ufunc_at_ellipsisz#TestDUFuncAt.test_ufunc_at_ellipsis  sR     hhq$"&&!VRVVS%+WWQc2	4r   c                     t        j                  dt         j                        }t        j                  d      }| j	                  t         j
                        } |||       t        j                  |g dk(        sJ y )NrA   r   )r   r   r   r   r   )r2   r   int32r   r   r   all)r%   r   r   rx   s       r   test_ufunc_at_negativez#TestDUFuncAt.test_ufunc_at_negative  sV    ggarxx(yy|XXbkk"
3vvc11222r   c                 Z   t        j                  dt         j                        }t        j                  dt              }d|d<   d|d<   d|dd  t        j                  dt              }| j	                  t         j
                        } ||||       |d   |j                         k(  sJ y )	Ni   r   r*   r   rA   r)   r   i    )r2   rB   int16floatr   r   sum)r%   r   r}   r|   r   s        r   test_ufunc_at_largez TestDUFuncAt.test_ufunc_at_large  s    ((4rxx0HHT'!!$%HHQe$"&&!q'1tquuwr   c                 ,   t        j                  d      }t        j                  d      }| j                  t         j                        }t        j                  t        |      t         j                        } ||||       |d   t        |      k(  sJ y )Nr*   i r   r   )r2   rB   r   r   r   r]   uint8)r%   r   valuesr   indexs        r   test_cast_index_fastpathz%TestDUFuncAt.test_cast_index_fastpath!  sh    hhrl"&&!VBHH5sE6"1vV$$$r   c           	         t        j                  d      t        j                  d      t        j                  d      df}|D ]  }t        j                  d      }t        j                  t        j
                  d      d      }| j                  t         j                        } ||||       t         j                  j                  |t        j                  |d|z                y )Nr)   r   rR   i  r+   )r2   r   float64rB   repeatr   r   r   rC   rD   	full_like)r%   r   r   r   r   r   s         r   #test_ufunc_at_scalar_value_fastpathz0TestDUFuncAt.test_ufunc_at_scalar_value_fastpath*  s    ''!*bggbk2::b>2> 	ME((4.CIIbiioq1EXXbff%F3u%JJ))#r||CU/KL	Mr   c                 x	   t        j                  d      j                  dd      }t        j                  g dg dg dg      }| j	                  t         j
                        } ||t        d       t        j                  g d      f|       | j                  |t        j                  g dg dg d	g             t        j                  d
      j                  ddd      }t        j                  g d      } ||t        d       t        d       t        j                  g d      f|       | j                  |t        j                  g dg dg dgg dg dg dgg dg dg dgg             t        j                  d      j                  dd      }t        j                  g dg dg dg      } ||t        j                  g d      t        d       f|       | j                  |t        j                  g dg dg dg             t        j                  d
      j                  ddd      }t        j                  g d      } ||t        d       t        j                  g d      t        d       f|       | j                  |t        j                  g dg dg dgg dg dg dgg dg dg dgg             t        j                  d      j                  dd      }t        j                  g d      } ||dt        j                  g d      f|       | j                  |t        j                  g dg d g d!g             t        j                  d
      j                  ddd      }t        j                  g d      } ||t        j                  g d      dt        d       f|       | j                  |t        j                  g dg d g d!gg d"g d#g d$gg d%g d&g d'gg             t        j                  d
      j                  ddd      }t        j                  g d      }| j	                  t         j
                        } ||t        d       t        d       t        d       f|       | j                  |t        j                  g d(g d)g dgg d*g d+g dgg d%g d,g dgg             y )-N	   r   r   )   r   r   ),  r   r   r)   r+   r)   )r      f   )r        )r   i_  4     )r   r   r   )r   i     )r   i     )r        )        )   i     )r   i     )        )   i     r   r)   r+   )i  r   i  )      r   )   r   i]  )j   r  r   )r   r*      )   r  if  )s      i=  )r      r?   )   r  io  )|      iF  r   r   r   rA   )r         )   r   ic  )r        )r        )v      i@  )r        )r
        )r   r   i.  )g      i1  )m      i7  )p      i:  )y      iC  )	r2   r   rE   r   r   r   r   asarrayr   )r%   r|   r}   r   s       r   test_ufunc_at_multiDz!TestDUFuncAt.test_ufunc_at_multiD4  s   IIaL  A&HHoHI"&&!q5;

9 56:288M=9$; 	< IIbM!!!Q*HH_%q5;dRZZ	-BCQG288"/"/"/"1 #0"0"0"2 #1"0"0"2
!3$4 	5 IIaL  A&HHoHIq2::i(%+6:2::9$; 	< IIbM!!!Q*HH_%q5;

9 5uT{CQG2::"-"1"1"3 #/"1"1"3 #/"1"1"3
!4$5 	6 IIaL  A&HH_%q1bjj+,a02::Iy1$3 	4 IIbM!!!Q*HH_%q2::i(!U4[91=2::"-"-"-"/ #2"/"/"1 #2"/"/"1
!2$3 	4 IIbM!!!Q*HH_%"&&!q5;dU4[91=2::"1"1"1"3 #2"1"1"3 #2"1"1"3
!4$5 	6r   c                 &   t        j                  d      }| j                  t         j                        } ||dd       | j	                  |t        j                  d             | j                  t              5   ||dd       d d d        t        j                  d      } ||dd       | j	                  |t        j                  g d             | j                  t              5   ||g d       d d d        y # 1 sw Y   xxY w# 1 sw Y   y xY w)Nr   r   r)   r   )r)   r)   r+   )	r2   r   r   r   r   r/   r   r   r0   )r%   r|   r   r}   s       r   test_ufunc_at_0DzTestDUFuncAt.test_ufunc_at_0D  s    HHQK"&&!q"a288A;/{+ 	1aO	 IIaLq!Q288I#67 z* 	1b!	 		 		 	s   9C;'D;DDc                     t        j                  d      }| j                  t         j                        } ||g dd       | j	                  |t        j
                  g d             y )Nr*   )r)   r+   r   r+   g      @)
r   r)   i>  .   r   rA   r   r  r  r   )r2   r   r   powerr   r   )r%   r|   power_ats      r   test_ufunc_at_dtypesz!TestDUFuncAt.test_ufunc_at_dtypes  sG    IIbM88BHH%L#&288,N#OPr   c                     t        j                  d      }|dz  dk(  }| j                  t         j                        } |||g d       | j	                  |t        j
                  g d             y )Nr*   r+   r   )r   r+   r   r   r  )
r)   r)   r)   r   r)   rA   r)   r  r)   r   )r2   r   r   equalr   r   )r%   r|   r   equal_ats       r   test_ufunc_at_booleanz"TestDUFuncAt.test_ufunc_at_boolean  sT    IIbMA
88BHH%E?+288,J#KLr   c                     t        j                  dd      }| j                  t         j                        } ||g d       | j	                  |t        j
                  g dt         j                               y )Nr*   u4r   r   )
r   r)   r+   r   r   l    r   r  r  r   )r2   r   r   invertr   r   uint32)r%   r|   	invert_ats      r   test_ufunc_at_boolean2z#TestDUFuncAt.test_ufunc_at_boolean2  sW    IIb%HHRYY'	!Y288 -6=?YY$H 	Ir   c                     t        j                  d      }|d d d f   d d ddf   }| j                  t         j                        } ||ddgd       | j	                  |t        j                  d             y )Nr   r   r)   r   )r2   r   r   r   r   )r%   origr|   r   s       r   test_ufunc_at_advancedz#TestDUFuncAt.test_ufunc_at_advanced  sc    yy|DM!QqS&!"&&!q1a&!biil3r   c                 b   t        j                  g dt        j                  d      j                               }t        j                  g dt        j                  d      j                               }| j	                  t         j
                        } |||d       | j                  |g d       y )Nr   ir)   r+   r   r   fr   )r)   r  r   r   )r2   r   r   newbyteorderr   r   r   )r%   r   r   r   s       r   test_ufunc_at_advanced_2z%TestDUFuncAt.test_ufunc_at_advanced_2  st     BHHSM$>$>$@A,(B(B(DE"&&!vua 5r   c                 B   t        j                  ddgt              }| j                  t         j                        }| j                  t              5   ||ddgd       d d d        | j                  |t        j                  ddgt                     y # 1 sw Y   7xY w)Nr|   r)   r   r   )r2   r   objectr   r   r/   r   r   )r%   r   r   s      r   test_ufunc_at_advanced_3z%TestDUFuncAt.test_ufunc_at_advanced_3  sz    3(&1"&&!{+ 	&6Aq61%	&#q(HI	& 	&s   BBc                     | j                  t        j                        }| j                  t              5   |t        j
                  d      dg       d d d        y # 1 sw Y   y xY w)Nr*   r)   )r   r2   modfr/   r   r   )r%   modf_ats     r   test_ufunc_at_advanced_4z%TestDUFuncAt.test_ufunc_at_advanced_4  sK    ((277#{+ 	(BIIbMA3'	( 	( 	(s   AA%c                     | j                  t        j                        }t        j                  g d      } ||dgd       | j	                  |t        j                  g d             y )Nr   r   )r   r2   maximumr   r   )r%   
maximum_atr|   s      r   test_ufunc_at_advanced_5z%TestDUFuncAt.test_ufunc_at_advanced_5  sI    XXbjj)
HHY1qc1288I#67r   c                    t         j                  d   t         j                  d   z   }t         j                  t         j                  t         j                  t         j
                  t         j                  f}|D ]6  }|dv r		 t        t        j                  |             |D ]	  }t        j                  dd      j                  |      }t        j                  g d      j                  t         j                        }t        j                  g d|j                        }|j                         }t        ||      D ]  \  }	}
 |||	   |
      ||	<    | j!                  |      } ||||       t         j"                  j%                  ||       t        j&                  |g dk(        r
J  9 y # t        $ r Y Gw xY w)	N
AllIntegerFloat)er   r*   )r   r)   r   r+   )r)   rA   r+   r*   r   )r2   r   r   r   divideminimumrS  r   r   r   r   astyper   r   r   zipr   rC   rD   r   )r%   dtypesr   r   r~   r|   indxsvalsr   rF  vr   s               r   test_ufunc_at_negative_indexesz+TestDUFuncAt.test_ufunc_at_negative_indexes  s`   l+bll7.CC&&"++ryy"**bjjI 	7E288E?+   7IIa$++E2077@xxQWW=668t, 8DAq"'Q"7HQK8  88E?E4(

--a:vve~56667	7 , s   F22	F?>F?c                    t        j                  d      }t        j                  d      }| j                  t         j                        }d}| j	                  t
        |      5   ||dg|       d d d        y # 1 sw Y   y xY w)N)r+   r+   r+   )r)   r+   r+   z1does not support ufunc with non-trivial signaturer   )r2   r   r   matmulr   r   )r%   r|   r}   	matmul_atr   s        r    test_ufunc_at_not_none_signaturez-TestDUFuncAt.test_ufunc_at_not_none_signature  sj     GGIGGIHHRYY'	E##K9 	!a!a 	! 	! 	!s   "A77B c                     t        j                  dt              }| j                  t         j                        }| j                  t              5   ||ddgddg       d d d        y # 1 sw Y   y xY w)Nr*   r   r   r)   )r2   r   strr   r   r/   r   r   s      r   test_ufunc_at_no_loop_for_opz)TestDUFuncAt.test_ufunc_at_no_loop_for_op  s[    ggb$"&&!{+ 	(3AA'	( 	( 	(s   A((A1c                     t        j                  dg      }| j                  t         j                        } ||dgdg       |d   dk(  sJ y )Nr   r   )r2   r   r   r9  )r%   r   r:  s      r   test_ufunc_at_output_castingz)TestDUFuncAt.test_ufunc_at_output_casting  sC    hhtn88BHH%qcA31v{{r   c                     t        j                  d      }| j                  t         j                        }d}| j	                  t
        |      5   ||ddgg d       d d d        y # 1 sw Y   y xY w)NrA   z=operands could not be broadcast together with remapped shapesr   r)   r   )r2   r   r   r   r   r0   )r%   r   r   msgs       r   test_ufunc_at_broadcast_failurez,TestDUFuncAt.test_ufunc_at_broadcast_failure  s^    iil"&&! N##J4 	+3A	*	+ 	+ 	+s   A%%A.c                    t        j                  d      }t        d        }| j                  t	        |j
                        d       |j                  |ddg       | j                  t	        |j
                        d       y )NrA   c                     | dz   S )Nr)   r   )xs    r   incz/TestDUFuncAt.test_ufunc_at_dynamic.<locals>.inc  s    q5Lr   r   r)   r   )r2   r   r   r8   r]   r[   rx   assertGreater)r%   r   rr  s      r   test_ufunc_at_dynamicz"TestDUFuncAt.test_ufunc_at_dynamic  sg    iil		 
	 	SYY+ 	sQF3syy>1-r   c                    t        j                  d      }| j                  t         j                        }t	        j
                  d      5 }t	        j                  dt                ||ddgd       d d d        | j                  t              d       | j                  dt        |d   j                               y # 1 sw Y   MxY w)	NrA   T)recordalwaysr   r   r*   z ufunc.at feature is experimental)r2   r   r   r   warningscatch_warningssimplefilterr	   rs  r]   assertInrh  message)r%   r   r   ws       r   "test_ufunc_at_experimental_warningz/TestDUFuncAt.test_ufunc_at_experimental_warning)  s    iil"&&!$$D1 	$Q!!(,KL3A#	$
 	3q61%8#adll:KL	$ 	$s   'B>>CN)rp   rq   rr   r   r   r   r   r   r   r   r   r0  r2  r7  r;  rA  rD  unittestexpectedFailurerJ  rM  rQ  rU  rb  rf  ri  rk  rn  rt  r~  r   r   r   r   r      s    /"5H-443
%MS6j$QMI4 6 6J(878 ! !(+.
Mr   r   c                   t    e Zd ZddZej
                  d        Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zy)TestDUFuncReduceNumPyTestsNc                     j                   dk(  r t        |      fd      n t        |      fd      t        dfd	       }|S )Nr+   ry   c                      | |      S r   r   r{   s     r   r   z:TestDUFuncReduceNumPyTests._generate_jit.<locals>.<lambda><  r   r   c                      |       S r   r   r   s    r   r   z:TestDUFuncReduceNumPyTests._generate_jit.<locals>.<lambda>>  s    q r   c                 ,    j                  | ||      S r   r   r   s      r   rh   z4TestDUFuncReduceNumPyTests._generate_jit.<locals>.fn@  s    ::e$:@@r   r   )rW   r   r   )r%   r~   r\   rh   r   s    `  @r   r   z(TestDUFuncReduceNumPyTests._generate_jit:  sK    99>.)X./GHC.)X./ABC		A 
	A	r   c                     | j                  t        j                        }t        j                  j                  d      } |d      }| j	                  ||       y )Nr   )r   r2   r5  rv   r   )r%   power_reducer   r   s       r   test_numpy_scalar_reductionz6TestDUFuncReduceNumPyTests.test_numpy_scalar_reductionE  sC     ))"((388??1%1o#.r   c                 Z   d }| j                  t        j                  d      }d|d<   d|d<    | ||d       d        | ||d	      g d
        | ||d      g d        | ||d      ddg        | ||d      g d
g dg dg        | ||d      g dg d
g        | ||d      g dg dg        | ||d      |       d|d<   d|d<    | ||d       d        | ||d	      g d
        | ||d      g d        | ||d      ddg        | ||d      g dg d
g dg        | ||d      g d
g dg        | ||d      g dg dg        | ||d      |       d|d<   d|d<    | ||d       d        | ||d	      g d        | ||d      g d        | ||d      ddg        | ||d      g dg dg dg        | ||d      g dg dg        | ||d      g dg dg        | ||d      |       y )Nc                 D    t         j                  j                  | |       y r   )r2   rC   assert_equal)r|   r}   s     r   compare_outputzOTestDUFuncReduceNumPyTests.check_identityless_reduction.<locals>.compare_outputN  s     JJ##Aq)r   reorderablery   r)   .r   )r)   r   r   r   r   r)   )r   r)   r)   r)   r   r+   )r   r)   r)   r)   r+   )r)   r)   r)   r)   r+   )r)   r)   r)   r   r   r)   r   )r)   r   r)   )r   r   r)   )r)   r   r)   r)   )r   r2   r[  )r%   r|   r  minimum_reduces       r   check_identityless_reductionz7TestDUFuncReduceNumPyTests.check_identityless_reductionM  sO   	* ++BJJ+O
 #'
~ad3Q7~af5|D~af5yA~af51v>~aa0$lLA	C~aa0$l3	5~aa0!9-	/~ab115#'
~ad3Q7~af5|D~af5yA~af51v>~aa0$lLA	C~aa0$l3	5~aa0!9-	/~ab115#'
~ad3Q7~af5|D~af5yA~af51v>~aa0$lLA	C~aa0$l3	5~aa0!9-	/~ab115r   c                 T    t        j                  dd      }| j                  |       y )Nr+   r   r   Corderr2   emptyr  r%   r|   s     r   (test_numpy_identityless_reduction_corderzCTestDUFuncReduceNumPyTests.test_numpy_identityless_reduction_corder       HHYc*))!,r   c                 T    t        j                  dd      }| j                  |       y )Nr  Fr  r  r  s     r   (test_numpy_identityless_reduction_forderzCTestDUFuncReduceNumPyTests.test_numpy_identityless_reduction_forder  r  r   c                 t    t        j                  dd      j                  dd      }| j                  |       y )N)r+   r   r   r  r  r)   r+   r2   r  swapaxesr  r  s     r   ,test_numpy_identityless_reduction_otherorderzGTestDUFuncReduceNumPyTests.test_numpy_identityless_reduction_otherorder  s-    HHYc*33Aq9))!,r   c                     t        j                  dd      j                  dd      }|dd dd dd f   }| j                  |       y )N)r   rA   r   r  r  r)   r+   r  r  s     r   +test_numpy_identityless_reduction_noncontigzFTestDUFuncReduceNumPyTests.test_numpy_identityless_reduction_noncontig  sB    HHYc*33Aq9ab!"abjM))!,r   c                     t        j                  dd      }|dd  j                  d      }d|_        |dd dd dd f   }| j	                  |       y )N)i  i1r   r)   f8r  )r2   r  viewshaper  r  s     r   5test_numpy_identityless_reduction_noncontig_unalignedzPTestDUFuncReduceNumPyTests.test_numpy_identityless_reduction_noncontig_unaligned  sS    HH)6abEJJTJ"ab!"abjM))!,r   c                 V   | j                  t        j                        }| j                  t        j                        }| j                  t        j                        }| j                   |t        j                  g       d      d       | j                   |t        j                  g       t        j                        t        j                         | j                   |t        j                  g       t        j                         t        j                          | j                   |t        j                  dg      d      d       | j                   |t        j                  dg      d      d       | j                   |t        j                  dg      d      d       | j                   |t        j                  dg      d      d       d}||fD ]>  }| j                  t        |      5   |t        j                  g       d        d d d        @ y # 1 sw Y   KxY w)Nr   r   g        rA   r   &zero-size array to reduction operation)
r   r2   r   r[  rS  r   r/  infr   r0   )r%   
add_reduce
min_reduce
max_reducerm  funcs         r   test_numpy_initial_reductionz7TestDUFuncReduceNumPyTests.test_numpy_initial_reduction  s   ''/
''

3
''

3
 	
2::b>1 EsK 	
2::b>266 J "	(
2::b>BFF7 K!#	) 	
2::qc?A FJ
2::qc?A FJ
2::qc?A FJ
2::qc?A FJ 7, 	3D''
C8 3RZZ^T23 3	33 3s   6HH(	c                    t        j                  d      }| j                  t         j                        }t         j                  j	                  |d      } ||d      }| j                  ||       | j                  |j                  d       d}| j                  t        |      5   ||d       d d d        t        j                  d      }| j                  t        |      5   ||d       d d d        t         j                  j	                  |dd      } ||dd      }| j                  ||       y # 1 sw Y   xY w# 1 sw Y   UxY w)	N)r   rA   r)   r  )r   r  r   )r   r   rA   r   )	r2   rB   r   true_dividerv   r   r  r   r0   )r%   r   true_divide_reducer   r   rm  s         r   'test_numpy_empty_reduction_and_identityzBTestDUFuncReduceNumPyTests.test_numpy_empty_reduction_and_identity  s    hhv!//? >>((1(5 1-#.		40 7##J4 	,s+	, hhy!##J4 	,s+	, >>((1a(@ 1a8#.	, 	,
	, 	,s   &D7$E7E Ec                 t   t        j                  g dg dg      }| j                  t         j                        } ||d      }| j	                  |t        j
                  g d              ||d      }| j	                  |t        j
                  ddg              ||d	      }| j	                  ||       y )
N)       @rS   rS   )rR   g      ?g      ?r   r  )r  g      @r  r)   rS   r  r   )r2   r   r   rZ  r   r/  )r%   r|   divide_reduceress       r   *test_identityless_reduction_nonreorderablezETestDUFuncReduceNumPyTests.test_identityless_reduction_nonreorderable  s    HHo'789**2995AA&RZZ%@AAA&RZZc
%;<AB'Q'r   c                     d } fd}d } j                  t        j                  d      } j                  t        j                  j                  d         |||dd        |||dd        |||dd        |||dd        ||g         |t        j
                  d      d	
        j                  t        j                  d      } |||dd        |||dd        |||dd        |||dd        |t        j                  g t        j                                |t        j
                  d      d	
       y )Nc                      | |i | y r   r   )rH  r   kwargss      r   okz<TestDUFuncReduceNumPyTests.test_reduce_zero_axis.<locals>.ok  s    tvr   c                 j    j                  t              5   | |i | d d d        y # 1 sw Y   y xY wr   )r/   r0   )rH  r   r  r%   s      r   errz=TestDUFuncReduceNumPyTests.test_reduce_zero_axis.<locals>.err  s3    "":. #4"6"# # #s   	)2c                 j    | |t        j                  ||f      d        | |t        j                  ||f      d        | |t        j                  |dz  |dz  |f      d        | |t        j                  |dz  ||dz  f      d        | |t        j                  ||dz  |dz  f      d        | |t        j                  |dz  ||dz  f      d        | |t        j                  |dz  |dz  |dz  |dz  |dz  f      d        | |t        j                  d	||f      d
        | |t        j                  d	||f      d        | |t        j                  |d	|f      d        | |t        j                  d	||f      d        | |t        j                  d	||f      d       y )Nr)   r  r   r+   r  r  r   r  r*   r  )r2   rB   )expectr  nms       r   tz;TestDUFuncReduceNumPyTests.test_reduce_zero_axis.<locals>.t  s   41a&)241a&)2416161"56Q?4161a1f"56Q?41a1fa1f"56VD4161a1f"56VD4161616#$616#3 4:CE 42q!*-F;42q!*-F;41b!*-A642q!*-A642q!*-A6r   r  ry      r   r   r   r   r  r   )	r   r2   rS  r8   r\   rB   r   r   int64)r%   r  r  r  maximum_reducer  s   `     r   test_reduce_zero_axisz0TestDUFuncReduceNumPyTests.test_reduce_zero_axis  s   		#	7$ ++BJJ+O,,d3	"nb"%	"na$	#~r1%	#~q!$NBrxx'b1 ''';
	"j"b!	"j!R 	"j"a 	"j!Q288Bbhh/0288F#"-r   r   )rp   rq   rr   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r  r  6  sT    	 / /56n----
-3:/2( 8.r   r  c                   X    e Zd ZddZddZd Zd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zy)TestDUFuncReduceNc                    t         fd       }t        j                  d      t        j                  d      j                  dd      t        j                  d      j                  ddd      g}|D ]M  }t	        |j
                        D ]3  }|j                  ||||      } |||||      }	| j                  ||	       5 O y )Nc                 .    j                  | |||      S )N)r   r   r   r   )r|   r   r   r   r~   s       r   fooz+TestDUFuncReduce._check_reduce.<locals>.foo   s$    <<%)&+(/   1 1r   rA   r   r+   (   )r   r2   r   rE   rangendimpy_funcr   )
r%   r~   r   r   r  inputsr   r   r   r   s
    `        r   _check_reducezTestDUFuncReduce._check_reduce  s    		1 
	1 IIaLIIaL  A&IIbM!!!Q*

  	7Eejj) 7;;udE7C%ug6''#67	7r   c                    	
 t         fd       
	
 fd}dj                   d	t        j                  d|      j	                  ddd	      t        j                  d
|      g}|D ]h  t        dj                  dz         D ]:  }t        j                  t        j                        |      D ]   |        < dD ]   |        j y )Nc                 ,    j                  | |      S r   r   )r|   r   r   r~   s     r   r  z0TestDUFuncReduce._check_reduce_axis.<locals>.foo4  s    <<g<>>r   c                  @   	 j                        }       }j                  ||       y # t        $ rc}j                  |j                  d          j                  t              5         }d d d        n# 1 sw Y   nxY wY d }~y Y d }~y d }~ww xY w)Nr   )r  r   r0   r8   r   r   r   )	r   r   r   rY  r   r   exc_msgr  r%   s	       r   _checkz3TestDUFuncReduce._check_reduce_axis.<locals>._check8  s    7;;ud3 %&''#6  +  G4++KA +eT*C+ + + + ++s,   1 	B5B/
B9	BB	BBzreduction operation 'z:' is not reorderable, so at most one axis may be specifiedr  r   rA   r   r+   r*   r)   )r)r   N)	r   rp   r2   r   rE   r  r  	itertoolscombinations)r%   r~   r   r   r  r  rF  r   r   r  r  s   `` `   @@@@r   _check_reduce_axisz#TestDUFuncReduce._check_reduce_axis2  s    		? 
	?		7 		7 +5>>*: ;G G IIb&..q!Q7IIb&
  	$E1ejj1n- (%2253DJ (D5$'((
 # $ud#$	$r   c                      t        dd      t              }| j                  |       | j                  |t        j
                         y )Nint64(int64, int64)r   ry   r   )r   r   r  r  r2   r  r4   s     r   test_add_reducez TestDUFuncReduce.test_add_reduceR  s;    <	/!<VD5!RXX6r   c                 T     t        dd      t              }| j                  |       y )Nr  r)   ry   )r   r   r  )r%   dumuls     r   test_mul_reducez TestDUFuncReduce.test_mul_reduceW  s$    <	/!<VD5!r   c                 (    t        dd       t              } t        dd       t              }| j                  |       | j	                  |t
        j                         | j                  |       | j	                  |t
        j                         y )Nr  ry   r   )r   r   r   r  r  r2   r  )r%   dusubdudivs      r   test_non_associative_reducez,TestDUFuncReduce.test_non_associative_reduce[  st    ?	/$?F?	/$?F5!RXX65!RXX6r   c                 t     t        dd      t              }| j                  |t        j                         y )Nfloat64(float64, int64)r   ry   r   )r   r   r  r2   r   r4   s     r   test_reduce_dtypez"TestDUFuncReduce.test_reduce_dtypec  s-    @	3a@H5

3r   c                      t        dd      t              }| j                  |d       | j                  |t        j
                         y )Nr  r  ry   r*   r  r   )r   r   r  r  r2   r  )r%   dumins     r   test_min_reducez TestDUFuncReduce.test_min_reduceg  s@    H	/-HO5"-RXX6r   c                 v     t        dd      t              }| j                  |t        j                  d       y )Nr  r   ry   r   )r   r   r   r   r  r2   r  r4   s     r   test_add_reduce_initialz(TestDUFuncReduce.test_add_reduce_initiall  s/    <	/!<VD5#>r   c                 p     t        d      t              }| j                  |t        j                         y )Nr  r   r  r4   s     r   &test_add_reduce_no_initial_or_identityz7TestDUFuncReduce.test_add_reduce_no_initial_or_identityq  s+    0	/0851r   c                      t        dd      t              t        fd       }d}| j                  t        |      5   |d       d d d        y # 1 sw Y   y xY w)Nr  r   ry   c                 &    j                  |       S r   r   )r|   r5   s    r   r  z0TestDUFuncReduce.test_invalid_input.<locals>.fooy  s    <<?"r   z-The first argument "array" must be array-liker|   )r   r   r   r   r   )r%   r  r  r5   s      @r   test_invalid_inputz#TestDUFuncReduce.test_invalid_inputv  s]    @	3a@H		# 
	# B##K9 	H	 	 	s   	AAc                     t        dd      t              t        fd       }t        j                  d      j                  ddd      }d	}|D ]/  }j                  ||      } |||      }| j                  ||       1 y )
Nr  r   ry   c                 *    j                  | |      S Nr  r   r|   r   r5   s     r   r  z7TestDUFuncReduce.test_dufunc_negative_axis.<locals>.foo      <<<--r   r  rA   r   r+   )r   r   )r   r   )r   )r)   r   )r   r   r   r2   r   rE   rv   r   )r%   r  r|   casesr   r   r   r5   s          @r   test_dufunc_negative_axisz*TestDUFuncReduce.test_dufunc_negative_axis  s    <	/!<VD		. 
	. IIbM!!!Q*7 	3D||At,Ha,C##Hc2	3r   c                     t        dd      t              t        fd       }t        j                  d      j                  ddd      }d	}|D ],  }d
}| j                  t        |      5   |||       d d d        . d}|D ]*  }| j                  t        d      5   |||       d d d        , y # 1 sw Y   jxY w# 1 sw Y   CxY w)Nr  r   ry   c                 *    j                  | |      S r  r   r   s     r   r  z6TestDUFuncReduce.test_dufunc_invalid_axis.<locals>.foo  r  r   r  rA   r   r+   )r  r  )r   r  )r   r   )r   r+   zduplicate value in 'axis')r   )r   r  zInvalid axis)r   r   r   r2   r   rE   r   r0   )r%   r  r|   r  r   rm  r5   s         @r   test_dufunc_invalid_axisz)TestDUFuncReduce.test_dufunc_invalid_axis  s    <	/!<VD		. 
	. IIbM!!!Q*? 	D-C''
C8 At 	
 " 	D''
NC At 		 
 s   ,
B2
B>2B;	>C	)NNr   )rp   rq   rr   r  r  r  r  r  r  r  r  r  r  r  r	  r   r   r   r  r    s?    7($@7
"747
?
2
	3r   r  c                   ~    e Zd Zd Zd Zej                  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)TestDUFuncReduceAtc                     t        |d      }| j                  ||      }|j                         }|j                         } |j                  ||fi |  |||fi | | j	                  ||       y )Nr\   )getattrr   r   rw   r   )	r%   r~   r|   idxr  r\   rh   r   r   s	            r   r   z"TestDUFuncReduceAt._compare_output  sh    5*-^^E8,668ffhx//
3v#.r   c                 d   t        j                  d      }t        j                  g d      }| j                  t         j                  d      } ||||       | j                  t        j                  g d      |        ||||       | j                  t        j                  g d      |       y )Nr   r   r   r)   r+   r   r   )r   r   r   r   )r   r   r   r  )r2   r   r/  r   r   r   )r%   r   r  r  s       r   test_reduceat_out_kwz'TestDUFuncReduceAt.test_reduceat_out_kw  s{    iiljj&^^BFFA.
3%

< 8#>3%

= 93?r   c           	         t        j                  d      j                  dd      t        j                  d      j                  ddd      t        j                  d      f}t        j                  g d      t        j                  g d      f}d	}|D ]3  }|D ],  }|D ]%  }| j                  t         j                  |||
       ' . 5 y )Nr  r   r  rA   r+   r   r   r   r   r)   r+   r   r  )r)   r   r   r  )r2   r   rE   r   r/  r   r   )r%   arraysr   r   r   r  axs          r   test_reduceat_axis_kwz(TestDUFuncReduceAt.test_reduceat_axis_kw  s     IIbM!!!Q'IIbM!!!Q*GGFO
 JJ'JJ|$
  	FE F FB(("(EFF	Fr   c                 8   t        j                  d      }t        j                  g d      }| j                  t         j                  d      }dD ]=  }d| d|j
                   }| j                  t        |      5   ||||       d d d        ? y # 1 sw Y   JxY w)Nr  r  r   )r+   r  zaxis z) is out of bounds for array of dimension )r2   r   r/  r   r   r  r   r0   )r%   r   r  add_reduceatr  rm  s         r   test_reduceat_invalid_axisz-TestDUFuncReduceAt.test_reduceat_invalid_axis  s    ggfojj&~~bffa0 	+B2$GhhZ!C''
C8 +S#r*+ +	++ +s   :BB	c                 H   | j                  t        j                  d      }g d}g d}t        j                  j                  ||      } |||      }| j	                  ||       d}d}t        j                  j                  ||      } |||      }| j	                  ||       y )Nr   rG  r   )r   r2   r   rw   r   )r%   r  r|   r  r   r   s         r    test_reduceat_cast_args_to_arrayz3TestDUFuncReduceAt.test_reduceat_cast_args_to_array  s    ~~bffa0 66??1c*1c"#. 66??1c*1c"#.r   c                 x    t        j                  d      }g d}| j                  t         j                  ||       y )Nr  )r   r   r)   rA   r+   r   r   r  )r2   r   r   r   r%   rq  r  s      r   test_reduceat_basicz&TestDUFuncReduceAt.test_reduceat_basic  s*    IIaL"RVVQ,r   c                     t        j                  ddd      j                  dd      }g d}| j                  t         j                  ||       y )Nr   r  r  r   r  )r2   r3   rE   r   r   r  s      r   test_reduceat_basic_2dz)TestDUFuncReduceAt.test_reduceat_basic_2d  s<    KK2r"**1a0RVVQ,r   c                 >   d}t        j                  |      }t        j                  t        t	        t        j                  |dz
        t        j                  |dz
        dz                     j                         }| j                  t         j                  ||       y )Nr   r+   )r2   r   r   listr]  ravelr   r   )r%   Lrq  r  s       r   test_reduceat_shifting_sumz-TestDUFuncReduceAt.test_reduceat_shifting_sum  sl    IIaLhhtC		!a% 0"))AE2BQ2FGHIOOQRVVQ,r   c                    t        j                  dt         j                        }t        j                  dt         j                        }| j                  t         j                  |t        j
                  d      |       | j                  t         j                  |t        j
                  d      |       | j                  ||       t        j                  dt         j                        }t        d      D cg c]  }d c}|dd d f<   t        j                  dt         j                        }t        d      D cg c]  }d c}|dd d f<   | j                  t         j                  |t        j
                  d      |d       | j                  t         j                  |t        j
                  d      |d       | j                  ||       y c c}w c c}w )	Nr   r   r  )r+   r   r+   r   r   )r   r   )r2   r   r  r   r   r   r   r  )r%   r   r   rF  s       r   (test_reduceat_int_array_reduceat_inplacez;TestDUFuncReduceAt.test_reduceat_int_array_reduceat_inplace  sD   ggarxx(ggarxx(RVVS"))A,C@RVVS"))A,C@S) ggfBHH- %a)1Q)AqD	ggfBHH- %a)1Q)AqD	RVVS"))A,CbIRVVS"))A,CbIS) *)s   ;	G 	Gc                 V   | j                  t        j                  d      }dD ]x  }t        j                  d      }t        j                  d      }|r|j	                  t        j
                        }| j                  t              5   ||ddg|       d d d        z y # 1 sw Y   xY w)Nr   )TFrA   r   r  )r   r2   r   r   r\  r   r/   r0   )r%   r  	with_castr   r   s        r    test_reduceat_out_shape_mismatchz3TestDUFuncReduceAt.test_reduceat_out_shape_mismatch  s     ~~bffa0& 		3I))A,C))A,C jj,"":. 3S1a&c23 3		33 3s   BB(	c                 ^   t        j                  g d      }t        j                  g d      }| j                  t         j                  d      }t         j                  j	                  ||      } |||      }| j                  ||       | j                  |j                  |j                         t        j                  d      }t        j                  g t         j                        }| j                  t         j                  ||d       | j                  t         j                  ||d       y)	z&Reduceat should work with empty arraysi4r  r   )rA   r+   r   r  r)   N)r2   r   r   r   rw   r   r8   r   r   r/  r   r   )r%   r   rq  r  r   r   r  s          r   test_reduceat_emptyz&TestDUFuncReduceAt.test_reduceat_empty  s    ((2t$HHR~~bffa066??1g.1g&#.3 GGFOjj277+RVVQ!4RVVQ!4r   c                     | j                  t        j                  d      }t        j                  d      }t        j                  d      j	                  dd      }| j                  t        d      5   |||       d d d        y # 1 sw Y   y xY w)Nr   rA   r*   r+   zhave at most 1 dimension)r   r2   r   r   rE   r   r   )r%   r  r|   r  s       r   test_reduceat_error_ndim_2z-TestDUFuncReduceAt.test_reduceat_error_ndim_2(  so    ~~bffa0 IIaLiim##Aq)##K1KL 	!C 	! 	! 	!s   1
BBc                     t         d        t        fd       }t        j                  d      }d}| j	                  t
        |      5   ||g d       d d d        y # 1 sw Y   y xY w)Nc                 ,    t        j                  |       S r   r   r   s    r   negzGTestDUFuncReduceAt.test_reduceat_error_non_binary_function.<locals>.neg3  s    ;;q>!r   c                 (    j                  | |      S r   r   )r|   r  r4  s     r   neg_reduceatzPTestDUFuncReduceAt.test_reduceat_error_non_binary_function.<locals>.neg_reduceat7  s    <<3''r   rA   r   r  )r   r   r2   r   r   r   )r%   r6  r|   rm  r4  s       @r   'test_reduceat_error_non_binary_functionz:TestDUFuncReduceAt.test_reduceat_error_non_binary_function1  sl    		" 
	" 
	( 
	( IIaL<##K5 	'I&	' 	' 	's   	AA'c                 j   | j                  t        j                  d      }| j                  t        d      5   |dg d       d d d        | j                  t        d      5   |t        j
                  d      d       d d d        | j                  t        d      5   |t        j
                  d      g dd	
       d d d        | j                  t        d      5   |t        j
                  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)Nr   z"array" must be array-likeabcr   z"indices" must be array-likerA   abcdzoutput must be an arrayr   r  z"axis" must be an integer)r)   r  )r   r2   r   r   r   r   )r%   r  s     r   "test_reduceat_error_argument_typesz5TestDUFuncReduceAt.test_reduceat_error_argument_types@  s    ~~bffa0##K1MN 	+	*	+ ##K1OP 	/1v.	/ ##K1JK 	:1yb9	: ##K1LM 	=1yt<	= 	=	+ 	+	/ 	/	: 	:	= 	=s/   D!D!D!D)DDD&)D2N)rp   rq   rr   r   r  r  r  r  r  r  r   r"  r'  r)  r,  r/  r1  r7  r;  r   r   r   r  r    s`    /@ F F 	+/&-
-
-*$3"5 !'=r   r  c                       e Zd Zd Zd Zd Zy)TestDUFuncPicklingc                 &   t        j                  |      }t        j                  |       d      }| j                  d|       | j	                  ||       t
        fd       } |d      }| j                  d|       | j	                  ||       y )N{   c                      |       S r   r   )rq  rebuilts    r   r  z%TestDUFuncPickling.check.<locals>.foo[  s    1:r   iA  )pickledumpsloadsr8   assertIsInstancer   )r%   identresult_typebufr  r  rA  s         @r   checkzTestDUFuncPickling.checkQ  s    ll5!,,s# CLa a- 
	 
	 Ha a-r   c                 j    t         d        }| j                  |t        t        j                  f       y )Nc                     | S r   r   x1s    r   rF  z3TestDUFuncPickling.test_unrestricted.<locals>.identd      Ir   rG  )r   rI  r   r2   integerr%   rF  s     r   test_unrestrictedz$TestDUFuncPickling.test_unrestrictedc  s/    		 
	 	

5sBJJ&7
8r   c                 V    t        dg      d        }| j                  |t               y )Nzfloat64(float64)c                     | S r   r   rL  s    r   rF  z1TestDUFuncPickling.test_restricted.<locals>.identk  rN  r   rO  )r   rI  r   rQ  s     r   test_restrictedz"TestDUFuncPickling.test_restrictedj  s/    	&'	(	 
)	 	

5e
,r   N)rp   rq   rr   rI  rR  rU  r   r   r   r=  r=  P  s    .$9-r   r=  __main__)$r   r  rB  re   rx  numpyr2   numbar   r   numba.tests.supportr   r   numba.core.errorsr   r   r	   r  numba.np.ufuncr
   numba.np.numpy_supportr   r   r   r   r   r   r   rt   r   r  r  r  r=  rp   mainr   r   r   <module>r^     s          ! 9@ @  ! -!cI("3"3 cIZ*/H */ZsM( sMld. d.NC, CLj=. j=Z-(*;*; -D zHMMO r   