
    J/Ph                         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 d dl	m
Z
mZmZmZ d dlmZ d dlmZ  G d dej                  Zedk    r ej                     dS dS )	    N)jit)NumbaWarning
deprecatedNumbaDeprecationWarningNumbaPendingDeprecationWarning)errors)ignore_internal_warningsc                   D    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )TestBuiltinsc                     d}|                      |j        t                     |                     |t	          |j                             d S )NzbFall-back from the nopython compilation path to the object mode compilation path has been detectedassertEqualcategoryr   assertInstrmessageselfwmsgs      Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/tests/test_warnings.py!check_objmode_deprecation_warningz.TestBuiltins.check_objmode_deprecation_warning   sD    9%<===c3qy>>*****    c                     d}|                      |j        t                     |                     |t	          |j                             d S )Nz0The 'nopython' keyword argument was not suppliedr   r   s      r   $check_nopython_kwarg_missing_warningz1TestBuiltins.check_nopython_kwarg_missing_warning   sE     D%<===c3qy>>*****r   c                    t          j        dt           j                  fd}t          j        d          5 }t          j        dt                     t                        t          d          |          } |             | 	                    t          |          d           d	d	d	           d	S # 1 swxY w Y   d	S )
z9
        Rerun test_return_type_warning with nrt
           )dtypec                       S N )ys   r   return_external_arrayzMTestBuiltins.test_return_type_warning_with_nrt.<locals>.return_external_array)   s    Hr   Trecordalways)nopythonr   N)nponesfloat32warningscatch_warningssimplefilterr   r	   r   r   len)r   r#   r   cfuncr"   s       @r   !test_return_type_warning_with_nrtz.TestBuiltins.test_return_type_warning_with_nrt#   s    GARZ(((	 	 	 	 	 $D111 	(Q!(L999$&&&&C&&&'<==EEGGGSVVQ'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   A/B88B<?B<c                 8   d }t          j        d          5 }t          j        dt                     t	                       t          |d          } |dd           |                     t          |          d           d d d            d S # 1 swxY w Y   d S )	Nc                     g }| |z   S r    r!   )xr"   as      r   addz7TestBuiltins.test_no_warning_with_forceobj.<locals>.add6   s    Aq5Lr   Tr$   r&   )forceobj      r   )r+   r,   r-   r   r	   r   r   r.   )r   r5   r   r/   s       r   test_no_warning_with_forceobjz*TestBuiltins.test_no_warning_with_forceobj5   s    	 	 	 $D111 	(Q!(L999$&&&d+++EE!QKKKSVVQ'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   A)BBBc                 4   t          d          d             }t          j        d          5 }t          j        d           t	                        |             |                     t          |          d           |                     |d         j        t                     | 	                    dt          |d         j                             | 	                    dt          |d         j                             d d d            d S # 1 swxY w Y   d S )	Nfooc                      d S r    r!   r!   r   r   barz)TestBuiltins.test_deprecated.<locals>.barD   s    Dr   Tr$   r&   r7   r   r=   )r   r+   r,   r-   r	   r   r.   r   DeprecationWarningr   r   r   )r   r=   r   s      r   test_deprecatedzTestBuiltins.test_deprecatedC   s@   	E			 	 
		 $D111 	4Q!(+++$&&&CEEESVVQ'''QqT],>???MM%QqT\!2!2333MM%QqT\!2!2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   CDDDc                    t          j        t           j                  }|                    dd          5  t	          j        t          j        d                     t	          j        t          j        d                     t                       d d d            n# 1 swxY w Y   t	          j        d          5 }t	          j        d           t                       |	                                 | 
                    t          |          d           | 
                    |d         j        t                     | 
                    |d	         j        t                     |                     dt          |d         j                             |                     dt          |d	         j                             d d d            d S # 1 swxY w Y   d S )
Nr;   
   sameTr$   r&   r8   r   r7   )r   WarningsFixerr   r,   r+   warnr   r	   r-   flushr   r.   r   r   r   r   )r   wfixr   s      r   test_warnings_fixerz TestBuiltins.test_warnings_fixerR   s     #F$788  ++ 	' 	'M&-f55666M&8@@AAA$&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'
 $D111 	5Q!(+++$&&&JJLLLSVVQ''' QqT],CDDDQqT]L999MM&#adl"3"3444MM&#adl"3"3444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5s%   ABB #B <DGGGc                    d}d}d}d|d|d|d}t          j        t          j        d|g          }|                                \  }}|                     |j        |           t          t          j	                  }d	|d
<   t          j        t          j        d|g|          }|                                \  }}|                     |j        |           d S )N7   c   z3'parallel=True' was specified but no transformationa  if 1:
            import warnings
            from numba.tests.error_usecases import foo
            import numba
            from numba.tests.support import ignore_internal_warnings
            with warnings.catch_warnings(record=True) as w:
                warnings.simplefilter('always')
                ignore_internal_warnings()
                foo()
            for x in w:
                if x.category == numba.errors.NumbaPerformanceWarning:
                    if "z2" in str(x.message):
                        exit(z)
            exit(z
)
        z-c1"NUMBA_DISABLE_PERFORMANCE_WARNINGS)env)

subprocessPopensys
executablecommunicater   
returncodedictosenviron)	r   not_found_ret_codefound_ret_codeexpectedparallel_codepopenouterrrM   s	            r   !test_disable_performance_warningsz.TestBuiltins.test_disable_performance_warningsi   s    H& xx);););="  #.$!FGG$$&&S)>::: 2:4701 #.$!FCPPP$$&&S)+=>>>>>r   c                    t          j                    5  t          j        d           t          j        dt                     t          j        dt                     t          j        t          d                     t          j        t	          d                     t          j        t          d                     t          j        t          d                     |                     t                    5  t          j        t          d                     d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nerrorignorer   this is ignoredthis is not ignored)
r+   r,   r-   r>   PendingDeprecationWarningrD   r   r   assertRaisesr   r   s    r    test_filter_deprecation_warningsz-TestBuiltins.test_filter_deprecation_warnings   s    $&& 		C 		C!'***!(5GHHHH!(5NOOOOM,->??@@@M34EFFGGGM12CDDEEEM89JKKLLL""<00 C Cl+@AABBBC C C C C C C C C C C C C C C		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		C 		Cs6   C)E="D+E+D/	/E2D/	3EE
Ec                    t          j                    5  t          j        dt                     t          j        dt                     t          j        dt
                     t          j        dt                     |                     t                    5  t          j        t          d                     d d d            n# 1 swxY w Y   |                     t                    5  t          j        t	          d                     d d d            n# 1 swxY w Y   t          j        t          d                     t          j        t          d                     t          j        dt
                     t          j        dt                     |                     t                    5  t          j        t          d                     d d d            n# 1 swxY w Y   |                     t                    5  t          j        t          d                     d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr`   rb   ra   rd   rc   )	r+   r,   r-   r>   re   r   r   rf   rD   rg   s    r   )test_filter_ignore_numba_deprecation_onlyz6TestBuiltins.test_filter_ignore_numba_deprecation_only   s    $&& 	, 	,!'4FGGGG!'4MNNNN!(5LMMMM!(+IK K K K ""#566 I I01FGGHHHI I I I I I I I I I I I I I I""#<== P P78MNNOOOP P P P P P P P P P P P P P P M12CDDEEEM89JKKLLL !'4KLLLL!'+IK K K K ""#566 N N56KLLMMMN N N N N N N N N N N N N N N""#<== , ,<)+ + , , ,, , , , , , , , , , , , , , ,-	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   BI"C	=I	C	IC	I."DID 	 I#D 	$BI9"G'I'G+	+I.G+	/I"H:.I:H>	>IH>	IIIN)__name__
__module____qualname__r   r   r0   r9   r?   rG   r^   rh   rj   r!   r   r   r   r      s        + + ++ + +( ( ($( ( (4 4 45 5 5.#? #? #?JC C C, , , , ,r   r   __main__)rU   rN   rP   r+   numpyr(   unittestnumbar   numba.core.errorsr   r   r   r   
numba.corer   numba.tests.supportr	   TestCaser   rk   mainr!   r   r   <module>rw      s   				     



                              8 8 8 8 8 8d, d, d, d, d,8$ d, d, d,N zHMOOOOO r   