
    xKgHR                     L   d Z ddlZddlmZ ddlZddlmZmZm	Z	m
Z
 ddlZddlmZmZmZmZmZmZmZ ddlmZ ddlmZm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      Z G d de      Z e!dk(  r ejD                          yy)z
Tests for sub-components of parfors.
These tests are aimed to produce a good-enough coverage of parfor passes
so that refactoring on these passes are easier with faster testing turnaround.
    Nreduce)njittypeofprangepndindex)rewritestyped_passesuntyped_passesinline_closurecallcompilercpuerrors)
cpu_target)TestCaseis_parfors_unsupportedc                       e Zd Zd Zy)
MyPipelinec                 F   t        j                         | _        || j                  _        || j                  _        || j                  _        || j                  _        d | j                  _        d | j                  _        d | j                  _	        i | j                  _
        y N)r   	StateDictstate	typingctx	targetctxargsfunc_irtypemapreturn_type	calltypesmetadata)selfr   r   r   test_irs        c/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_parfors_passes.py__init__zMyPipeline.__init__   sq    '')
(

(



$

!

!%

#

 

    N)__name__
__module____qualname__r$    r%   r#   r   r      s    	!r%   r   c                   X    e Zd Zed	d       Zed        Zed	d       Zd Zd Zd Z	d Z
y)
BaseTestNc           
         t         j                  }t         j                  }t        j                  |      }t        j                  d      }t        ||||      }|j                          |j                          t        j                  |j                  j                  |d      }	|	j                          t        j                  j!                  d|j                         t#        j$                         j'                  |j                         t)        j*                  |j                  j,                  |j                  j.                  |j                  j                  |j                  j0                  d       \  |j                  _        |j                  _        |j                  _        }
t)        j8                         j'                  |j                         t:        j<                  j>                  jA                         }t:        j<                  j>                  jC                  |j                  j                  |j                  j2                  |j                  j6                  |j                  j,                  |j                  j.                  ||jD                  |      }|j                          t        j                  j!                  d|j                         ||||fS )NT)typedzbefore-inference)swappedreplace_functions_mapzafter-inference)#r   typing_contexttarget_contextr   run_frontendr   ParallelOptionsr   refreshr   InlineClosureCallPassr   r   runr	   rewrite_registryapplyr   ReconstructSSArun_passr
   type_inference_stager   r   r   r   r   r   PreLowerStripPhisnumbaparforsparforParforDiagnosticsPreParforPassreplaced_fns)cls	test_funcr   swap_mapr   r   r"   optionstpinline_pass_diagnosticspreparfor_passs                r#   _run_parforzBaseTest._run_parfor(   s	    --	--	''	2%%d+	9dG<(>>HHgT
 	!!''(:BHHE%%'00: --HH 2 2BHH4D4DHHMM4
	
HHHH HH 	&&(11"((;mm**<<>--;;HHHHHHHHHH,,"* < 	
 	!!''(9288D7K77r%   c                 f   | j                  ||      \  }}}}t        j                         }t        j                  j
                  j                  |j                  j                  |j                  j                  |j                  j                  |j                  j                  |j                  j                  |j                  j                  |||j                  j                  |
      }|j                          | j!                  |      }	|	j#                  |j                  j$                         |	S )N)rJ   )rL   r   Flagsr=   r>   r?   
ParforPassr   r   r   r   r   r   r   r    _pre_runsub_pass_classr6   blocks)
rC   rD   r   rG   rF   rJ   rI   flagsparfor_passsub_passs
             r#   run_parfor_sub_passzBaseTest.run_parfor_sub_pass\   s    &)ooi&F#G[! mm**55HHHHHHHH  HHHHHH# 6 
 	%%k2[((//0r%   c                 6    | j                  |||      \  }}}}|S r   )rL   )rC   rD   r   rE   rG   rF   rJ   rK   s           r#   run_parfor_pre_passzBaseTest.run_parfor_pre_passt   s(    36??tX4
0G[. r%   c                 N     t        d      |      } ||i |} ||i |}||fS )NT)parallel)r   )r!   funcr   kwargscfuncexpectgots          r#   _run_parallelzBaseTest._run_parallel{   s;    #d#D)t&v&T$V$s{r%   c                 h    t         ry  | j                  |g|i |\  }}| j                  ||       y r   )r   r`   assertPreciseEqualr!   r[   r   r\   r^   r_   s         r#   run_parallelzBaseTest.run_parallel   s8    !(d((???,r%   c                    t         ry  | j                  |g|i |\  }}| j                  |t        j                         | j                  |t        j                         | j                  |j                  |j                         y r   )r   r`   assertIsInstancenpndarrayassertEqualshaperc   s         r#   run_parallel_check_output_arrayz(BaseTest.run_parallel_check_output_array   sh    !(d((???fbjj1c2::.syy1r%   c                     |D ]9  }| j                  |d   t        j                  j                  j                         ; y )Nnew)rf   r=   r>   r?   Parfor)r!   recordsrecs      r#   check_recordszBaseTest.check_records   s0    C!!#e*emm.B.B.I.IJ r%   r   )r&   r'   r(   classmethodrL   rV   rX   r`   rd   rk   rq   r)   r%   r#   r+   r+   '   sR    18 18f  .  -2Kr%   r+   c                   j    e Zd Zej                  j
                  j                  Zd Zd Z	d Z
d Zd Zy)TestConvertSetItemPassc                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                  >    d} t        j                  |       }d|d d  |S )N
      rg   onesnas     r#   	test_implzATestConvertSetItemPass.test_setitem_full_slice.<locals>.test_impl   s"    A
AAaDHr%   r)      reasonslicerV   ri   len	rewrittenrq   rd   r!   r~   rU   records       r#   test_setitem_full_slicez.TestConvertSetItemPass.test_setitem_full_slice   z    	 ++Ir:X//0!4%%)738--.)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                  >    d} t        j                  |       }d|d d |S )Nrw   rx      ry   r{   s     r#   r~   zGTestConvertSetItemPass.test_setitem_slice_stop_bound.<locals>.test_impl   s$    A
AAbqEHr%   r)   r   r   r   r   r   s       r#   test_setitem_slice_stop_boundz4TestConvertSetItemPass.test_setitem_slice_stop_bound   r   r%   c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                  >    d} t        j                  |       }d|dd  |S )Nrw   rx      ry   r{   s     r#   r~   zHTestConvertSetItemPass.test_setitem_slice_start_bound.<locals>.test_impl   s$    A
AAabEHr%   r)   r   r   r   r   r   s       r#   test_setitem_slice_start_boundz5TestConvertSetItemPass.test_setitem_slice_start_bound   r   r%   c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                      d} t        j                  |       }t        j                  |t         j                        }d||<   |S )Nrw   dtyperx   rg   rz   	ones_likebool_)r|   r}   bs      r#   r~   zGTestConvertSetItemPass.test_setitem_gather_if_scalar.<locals>.test_impl   s6    A
AQbhh/AAaDHr%   r)   r   r   masked_assign_broadcast_scalarr   r   s       r#   test_setitem_gather_if_scalarz4TestConvertSetItemPass.test_setitem_gather_if_scalar   s{    	 ++Ir:X//0!4%%)+KL8--.)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                      d} t        j                  |       }t        j                  |t         j                        }t        j                  |      }||   ||<   |S )Nrw   r   r   )r|   r}   r   cs       r#   r~   zFTestConvertSetItemPass.test_setitem_gather_if_array.<locals>.test_impl   sG    A
AQbhh/AQAQ4AaDHr%   r)   r   r   masked_assign_arrayr   r   s       r#   test_setitem_gather_if_arrayz3TestConvertSetItemPass.test_setitem_gather_if_array   s{    	 ++Ir:X//0!4%%)+@A8--.)$r%   N)r&   r'   r(   r=   r>   r?   ConvertSetItemPassrQ   r   r   r   r   r   r)   r%   r#   rt   rt      s0    ]]))<<N%%%% %r%   rt   c                   |    e Zd Zej                  j
                  j                  Zd Zd Z	d Z
d Zd Zd Zd Zd Zy	)
TestConvertNumpyPassc                    fd}| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                      d}  |       }|S Nrw   r)   r|   r}   fns     r#   r~   z>TestConvertNumpyPass.check_numpy_allocators.<locals>.test_impl       A1AHr%   r)   r   r   numpy_allocatorr   r!   r   r~   rU   r   s    `   r#   check_numpy_allocatorsz+TestConvertNumpyPass.check_numpy_allocators   s|    	
 ++Ir:X//0!4%%)+<=8--.)$r%   c                    fd}| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                      d}  |       }|S r   r)   r   s     r#   r~   z:TestConvertNumpyPass.check_numpy_random.<locals>.test_impl   r   r%   r)   r   r   r   )rV   ri   r   r   rq   rk   r   s    `   r#   check_numpy_randomz'TestConvertNumpyPass.check_numpy_random   s|    	
 ++Ir:X//0!4%%)+<=8--.,,Y7r%   c                     t         j                  t         j                  g}|D ]7  }| j                  |j                        5  | j                  |       d d d        9 y # 1 sw Y   DxY wr   )rg   rz   zerossubTestr&   r   r!   fnsr   s      r#   test_numpy_allocatorsz*TestConvertNumpyPass.test_numpy_allocators  sK    ww!Bbkk*++B/ +* **s   AA'	c                     t         j                  j                  g}|D ]7  }| j                  |j                        5  | j	                  |       d d d        9 y # 1 sw Y   DxY wr   )rg   randomr   r&   r   r   s      r#   test_numpy_randomz&TestConvertNumpyPass.test_numpy_random  sK    yy Bbkk*''+ +* **s   AA"	c                    d }t        j                  d      x}}||f}|D cg c]  }t        |       }}| j                  ||      }| j	                  t        |j                        d       |j                  \  }| j	                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                     | |z   S r   r)   r}   r   s     r#   r~   z<TestConvertNumpyPass.test_numpy_arrayexpr.<locals>.test_impl  s    q5Lr%   rw   r   r   	arrayexpr	rg   rz   r   rV   ri   r   r   rq   rd   	r!   r~   r}   r   r   xargtypesrU   r   s	            r#   test_numpy_arrayexprz)TestConvertNumpyPass.test_numpy_arrayexpr  s    	 A1v'+,t!F1It,++Ix@X//0!4%%);78--.)+d+ -   C c                    d }t        j                  d      x}}||f}|D cg c]  }t        |       }}| j                  ||      }| j	                  t        |j                        d       |j                  \  }| j	                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                     t        j                  |        t        j                  d      t        j                  |      z  z   S Nr   )rg   sinfloat64sqrtr   s     r#   r~   zBTestConvertNumpyPass.test_numpy_arrayexpr_ufunc.<locals>.test_impl&  s,    661":

1
 :::r%   rw   r   r   r   r   r   s	            r#   test_numpy_arrayexpr_ufuncz/TestConvertNumpyPass.test_numpy_arrayexpr_ufunc%  s    	; A1v'+,t!F1It,++Ix@X//0!4%%);78--.)+d+ -r   c                    d }t        j                  d      }t        j                  d      }||f}|D cg c]  }t        |       }}| j                  ||      }| j	                  t        |j                        d       |j                  \  }| j	                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                 8    | |z   t        j                  d      z   S r   )rg   arrayr   s     r#   r~   zFTestConvertNumpyPass.test_numpy_arrayexpr_boardcast.<locals>.test_impl7  s    q5288A;&&r%   rw   )   rw   r   r   r   r   r   s	            r#   test_numpy_arrayexpr_boardcastz3TestConvertNumpyPass.test_numpy_arrayexpr_boardcast6  s    	' GGBKGGG1v'+,t!F1It,++Ix@X//0!4%%);78--.)+d+ -   Cc                    d }t        j                  d      }t        j                  d      }||f}|D cg c]  }t        |       }}| j                  ||      }| j	                  t        |j                        d       |j                  \  }| j	                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                 D    | j                  d| j                        } | |z   S r   )reshapesizer   s     r#   r~   zETestConvertNumpyPass.test_numpy_arrayexpr_reshaped.<locals>.test_implI  s    		!QVV$Aq5Lr%   rw   r   r   r   r   r   s	            r#   test_numpy_arrayexpr_reshapedz2TestConvertNumpyPass.test_numpy_arrayexpr_reshapedH  s    	 GGBKGGBK1v'+,t!F1It,++Ix@X//0!4%%);78--.)+d+ -r   N)r&   r'   r(   r=   r>   r?   ConvertNumpyPassrQ   r   r   r   r   r   r   r   r   r)   r%   r#   r   r      s?    ]]))::N%80,,",",$,r%   r   c                   X    e Zd Zej                  j
                  j                  Zd Zd Z	y)TestConvertReducePassc                    d }t        j                  d      }|f}|D cg c]  }t        |       }}| j                  ||      }| j	                  t        |j                        d       |j                  \  }| j	                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                     t        d | d      S )Nc                     t        | |      S r   maxr   ys     r#   <lambda>zPTestConvertReducePass.test_reduce_max_basic.<locals>.test_impl.<locals>.<lambda>a  
    s1ayr%           r   arrs    r#   r~   z>TestConvertReducePass.test_reduce_max_basic.<locals>.test_impl`  s    0#s;;r%   rw   r   r   r   r   r!   r~   r   r   r   rU   r   s          r#   test_reduce_max_basicz+TestConvertReducePass.test_reduce_max_basic_  s    	< GGBKt'+,t!F1It,++Ix@X//0!4%%)848--.)+d+ -   B=c                    d }t        j                  d      }|f}|D cg c]  }t        |       }}| j                  ||      }| j	                  t        |j                        d       |j                  \  }| j	                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                 *    t        d | | dkD     d      S )Nc                     t        | |      S r   r   r   s     r#   r   zQTestConvertReducePass.test_reduce_max_masked.<locals>.test_impl.<locals>.<lambda>q  r   r%   r   r   r   r   s    r#   r~   z?TestConvertReducePass.test_reduce_max_masked.<locals>.test_implp  s    0#cAg,DDr%   rw   r   r   r   r   r   s          r#   test_reduce_max_maskedz,TestConvertReducePass.test_reduce_max_maskedo  s    	E GGBKt'+,t!F1It,++Ix@X//0!4%%)848--.)+d+ -r   N)
r&   r'   r(   r=   r>   r?   ConvertReducePassrQ   r   r   r)   r%   r#   r   r   \  s!    ]]));;N, ,r%   r   c                       e Zd Zej                  j
                  j                  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y)TestConvertLoopPassc                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                  8    d} d}t        |       D ]  }||z  }	 |S N   r   )r   )r|   r   is      r#   r~   z@TestConvertLoopPass.test_prange_reduce_simple.<locals>.test_impl  s(    AAAYQ Hr%   r)   r   r   loopr   r   s       r#   test_prange_reduce_simplez-TestConvertLoopPass.test_prange_reduce_simple  sz    	 ++Ir:X//0!4%%)628--.)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                  n    d} t        j                  |       }t        |       D ]  }||xx   |z  cc<    |S Nr   rg   rz   r   r|   r   r   s      r#   r~   z=TestConvertLoopPass.test_prange_map_simple.<locals>.test_impl  s4    A''!*CAYA! Jr%   r)   r   r   r   r   r   s       r#   test_prange_map_simplez*TestConvertLoopPass.test_prange_map_simple  z    	 ++Ir:X//0!4%%)628--.)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                  p    d} t        j                  |       }t        d|       D ]  }||xx   |z  cc<    |S )Nr   r   r   r   s      r#   r~   z;TestConvertLoopPass.test_prange_two_args.<locals>.test_impl  s6    A''!*CAq\A! "Jr%   r)   r   r   r   r   r   s       r#   test_prange_two_argsz(TestConvertLoopPass.test_prange_two_args  r   r%   c                     d }| j                  t        j                        5 }| j                  |d       d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  r    d} t        j                  |       }t        d| d      D ]  }||xx   |z  cc<    |S )Nr   r      r   r   s      r#   r~   z=TestConvertLoopPass.test_prange_three_args.<locals>.test_impl  s8    A''!*CAq!_A! %Jr%   r)   z4Only constant step size of 1 is supported for prangeassertRaisesr   UnsupportedRewriteErrorrV   assertInstr	exceptionr!   r~   raisess      r#   test_prange_three_argsz*TestConvertLoopPass.test_prange_three_args  sZ    	 v==>&$$Y3 ?B  !	
 ?>   A$$A-c                    d }| j                  |d      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j	                  |j                         | j                  |       y )Nc                      d} t        j                  | | f      }t        |       D ]'  }t        |      D ]  }|||fxx   ||| z  z   z  cc<    ) |S r   )rg   rz   r   ranger|   r   r   js       r#   r~   zATestConvertLoopPass.test_prange_map_inner_loop.<locals>.test_impl  sU    A''1a&/CAYqA1IQU*I "  Jr%   r)   r   r   r   r   r   s       r#   test_prange_map_inner_loopz.TestConvertLoopPass.test_prange_map_inner_loop  sz    	 ++Ir:X//0!4%%)628--.)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       | j	                  |j                         |j                  D ]  }| j                  |d   d        | j                  |       y )Nc                      d} t        j                  | | f      }t        |       D ]'  }t        |      D ]  }|||fxx   ||| z  z   z  cc<    ) |S r   r   r  s       r#   r~   zDTestConvertLoopPass.test_prange_map_nested_prange.<locals>.test_impl  sU    A''1a&/CAYA1IQU*I #  Jr%   r)   r   r   r   r   r   s       r#   test_prange_map_nested_prangez1TestConvertLoopPass.test_prange_map_nested_prange  s    	 ++Ir:X//0!48--.((FVH-v6 ) 	)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       | j	                  |j                         |j                  \  }| j                  |d   d       | j                  |       y )Nc                  ~    d} t        j                  |       }t        |       D ]  }|||dz    }|dxx   dz  cc<    |S )Nr   r   r)   r   )r|   r   r   inners       r#   r~   zATestConvertLoopPass.test_prange_map_none_index.<locals>.test_impl  sE    A''!*CAYAAb	Q	  Jr%   r)   r   r   r   r   r   s       r#   test_prange_map_none_indexz.TestConvertLoopPass.test_prange_map_none_index  sz    	 ++Ir:X//0!48--.%%)62)$r%   c                     d }| j                  t        j                        5 }| j                  |d       d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  n    d} t        j                  |       }t        |       D ]  }|dz  }|||dz
  <    |S )Nr   r   r   r   s      r#   r~   zFTestConvertLoopPass.test_prange_map_overwrite_index.<locals>.test_impl  s?    A''!*CAYQAE
  Jr%   r)   z Overwrite of parallel loop indexr  r  s      r#   test_prange_map_overwrite_indexz3TestConvertLoopPass.test_prange_map_overwrite_index  sZ    	 v==>&$$Y3 ?.  !	
 ?>r
  c                    d }| j                  |d      }| j                  t        |j                        d       | j	                  |j                         |j                  \  }| j                  |d   d       | j                  |       y )Nc                     d} t        j                  |       }t        j                  j                  j                          d}t        j                  j                  j                  t        |            D ]
  }|||   z  } |S r   )rg   rz   r=   r>   r?   init_prangeinternal_pranger   )r|   r   valr   s       r#   r~   z7TestConvertLoopPass.test_init_prange.<locals>.test_impl  se    A''!*CMM  ,,.C]]))99#c(Cs1v DJr%   r)   r   r   r   r   r   s       r#   test_init_prangez$TestConvertLoopPass.test_init_prange  sz    	 ++Ir:X//0!48--.%%)62)$r%   c                    d }| j                  |d      }| j                  t        |j                        d       | j	                  |j                         |j                  \  }| j                  |d   d       | j                  |       y )Nc                      d} t        j                  | | f      }d}t        |j                        D ]  }||d   |d   z  z  } |S )Nr   r   r   )rg   rz   r   rj   )r|   r   r  idxs       r#   r~   z4TestConvertLoopPass.test_pndindex.<locals>.test_impl  sK    A''1a&/CC		*s1vA& +Jr%   r)   r   r   r   r   r   s       r#   test_pndindexz!TestConvertLoopPass.test_pndindex  sz    	 ++Ir:X//0!48--.%%)62)$r%   c                    d }d}t        j                  t        j                  |            j                  |      }|f}|D cg c]  }t	        |       }}| j                  ||      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                 ,    t        j                  |       S r   rg   sumr   s    r#   r~   z5TestConvertLoopPass.test_numpy_sum.<locals>.test_impl*  s    66#;r%         r   r   r   rg   arangeprodr   r   rV   ri   r   r   rq   rd   	r!   r~   rj   r   r   r   r   rU   r   s	            r#   test_numpy_sumz"TestConvertLoopPass.test_numpy_sum)  s    	 ii'//6v'+,t!F1It,++Ix@X//0!4%%)628--.)+d+ -   C!c                    d }d}t        j                  t        j                  |            j                  |      }|f}|D cg c]  }t	        |       }}| j                  ||      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                 R    | d d df   }t        j                  | |dk\  ddf         S )Nr   r   r   r   r'  )r   sliceds     r#   r~   zGTestConvertLoopPass.test_numpy_sum_bool_array_masked.<locals>.test_impl:  s0    AYF66#fk1Q3./00r%   r)  r   r   r   r,  r/  s	            r#    test_numpy_sum_bool_array_maskedz4TestConvertLoopPass.test_numpy_sum_bool_array_masked9  s    	1 ii'//6v'+,t!F1It,++Ix@X//0!4%%)628--.)+d+ -r1  c                    d }d}t        j                  t        j                  |            j                  |      }|f}|D cg c]  }t	        |       }}| j                  ||      }| j                  t        |j                        d       |j                  D ]  }| j                  |d   d        | j                  |j                          | j                  |g|  y c c}w )Nc                 ~    t        j                  | j                  d         }t        j                  | d d |f         S r   )rg   r-  rj   r(  )r   sels     r#   r~   zFTestConvertLoopPass.test_numpy_sum_int_array_masked.<locals>.test_implK  s/    ))CIIaL)C66#af+&&r%   r)  r   r   r   r,  r/  s	            r#   test_numpy_sum_int_array_maskedz3TestConvertLoopPass.test_numpy_sum_int_array_maskedJ  s    	' ii'//6v'+,t!F1It,++Ix@X//0!4((FVH-v6 )8--.)+d+ -s   C$c                    d }d}t        j                  t        j                  |            j                  |      }|f}|D cg c]  }t	        |       }}| j                  ||      }| j                  t        |j                        d       |j                  \  }| j                  |d   d       | j                  |j                          | j                  |g|  y c c}w )Nc                 (    | j                  d       | S )Nr   )fillr   s    r#   r~   z=TestConvertLoopPass.test_numpy_fill_method.<locals>.test_impl]  s    HHQKJr%   r)  r   r   r   r,  r/  s	            r#   test_numpy_fill_methodz*TestConvertLoopPass.test_numpy_fill_method\  s    	 ii'//6v'+,t!F1It,++Ix@X//0!4%%)628--.)+d+ -r1  N)r&   r'   r(   r=   r>   r?   ConvertLoopPassrQ   r   r   r   r	  r  r  r  r  r   r$  r0  r5  r9  r=  r)   r%   r#   r   r     s]    ]]))99N% % % 
%"%"%"
 %$%$, ,",$,r%   r   c                   2    e Zd Z G d d      Zd Zd Zd Zy)TestPreParforPassc                       e Zd Zd Zd Zy) TestPreParforPass.sub_pass_classc                      y r   r)   )r!   pass_statess     r#   r$   z)TestPreParforPass.sub_pass_class.__init__q      r%   c                      y r   r)   )r!   rR   s     r#   r6   z$TestPreParforPass.sub_pass_class.runt  rE  r%   N)r&   r'   r(   r$   r6   r)   r%   r#   rQ   rB  p  s    		r%   rQ   c                 :   d }t        j                  d      }|f}|D cg c]  }t        |       }}| j                  ||      }| j	                  |j
                  d   d       | j	                  |j
                  d   d        | j                  |g|  y c c}w )Nc                 H    t        j                  d| j                        }|S )Nr   r   )rg   rz   r   r   s     r#   r~   z:TestPreParforPass.test_dtype_conversion.<locals>.test_imply  s    !''*AHr%   rw   replaced_funcr   replaced_dtyper   rg   r-  r   rX   ri   statsrd   r!   r~   r   r   r   r   pre_passs          r#   test_dtype_conversionz'TestPreParforPass.test_dtype_conversionw  s    	 iimv'+,t!F1It,++Ix@8!<(891=)+d+ -   Bc                 :   d }t        j                  d      }|f}|D cg c]  }t        |       }}| j                  ||      }| j	                  |j
                  d   d       | j	                  |j
                  d   d        | j                  |g|  y c c}w )Nc                 ,    t        j                  |       S r   r'  r}   s    r#   r~   z9TestPreParforPass.test_sum_replacement.<locals>.test_impl      66!9r%   rw   rI  r   rJ  r   rK  rM  s          r#   test_sum_replacementz&TestPreParforPass.test_sum_replacement  s    	 iimv'+,t!F1It,++Ix@8!<(891=)+d+ -rP  c                    d }t        j                  d      }|f}|D cg c]  }t        |       }}t        j                  j
                  j                  j                         }|j                  d       | j                  |||      }| j                  |j                  d   d       | j                  |j                  d   d        | j                  |g|  y c c}w )Nc                 ,    t        j                  |       S r   r'  rS  s    r#   r~   z9TestPreParforPass.test_replacement_map.<locals>.test_impl  rT  r%   rw   )r(  numpyrI  r   rJ  )rg   r-  r   r=   r>   r?   swap_functions_mapcopypoprX   ri   rL  rd   )r!   r~   r   r   r   r   rE   rN  s           r#   test_replacement_mapz&TestPreParforPass.test_replacement_map  s    	 iimv'+,t!F1It,==''::??A%&++IxJ8!<(891=)+d+ -s   CN)r&   r'   r(   rQ   rO  rU  r\  r)   r%   r#   r@  r@  o  s     ,,,r%   r@  __main__)#__doc__unittest	functoolsr   rX  rg   r=   r   r   r   r   numba.parfors.parfor
numba.corer	   r
   r   r   r   r   r   numba.core.registryr   numba.tests.supportr   r   objectr   r+   rt   r   r   r   r@  r&   mainr)   r%   r#   <module>rg     s   
    0 0    + B
! 
!mKx mK`O%X O%dp,8 p,f!,H !,Hl,( l,^1, 1,h zHMMO r%   