o
    8ήcA	                     @   sZ   d dl Z d dlmZ d dlmZmZmZ d dlZG dd dejZ	e
dkr+e  dS dS )    N)jit)NumbaDeprecationWarningNumbaPendingDeprecationWarningNumbaWarningc                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestDeprecationc                 C   sR   |  t|d |  |d j| | |t|d j | dt|d j d S )N   r   https://numba.readthedocs.io)assertEquallencategoryassertInstrmessage)selfwarningsexpected_strr    r   D/tmp/pip-target-vg8gfxp4/lib/python/numba/tests/test_deprecations.pycheck_warning
   s   zTestDeprecation.check_warningc                 C   sr   t jdd)}t jdtd t jdtd dd }t|  d}| ||t W d    d S 1 s2w   Y  d S )	NTrecordignorer   alwaysc                   S   s   g S )Nr   r   r   r   r   foo   s   z-TestDeprecation.test_jitfallback.<locals>.foozPFall-back from the nopython compilation path to the object mode compilation path)r   catch_warningssimplefilterr   r   r   r   )r   wr   msgr   r   r   test_jitfallback   s   
"z TestDeprecation.test_jitfallbackc           	   	   C   s   dd }dd }||fD ]l}|j d}t|dg}tjddO}tjd	td
 tjdtd
 tdd|| | 	t
|d | 	|d jt t|d j}d}| || d| }| || | d| W d    n1 ssw   Y  qd S )Nc                 S   
   |  dS Nr   )appendar   r   r   foo_list!      
zFTestDeprecation.test_reflection_of_mutable_container.<locals>.foo_listc                 S   r    r!   )addr#   r   r   r   foo_set$   r&   zETestDeprecation.test_reflection_of_mutable_container.<locals>.foo_setfoo_
   Tr   r   r   r   )nopythonr   r   z?Encountered the use of a type that is scheduled for deprecationz!'reflected %s' found for argumentr   )__name__stripevalr   r   r   r   r   r   r	   r
   r   r   r   r   )	r   r%   r(   f	containerinpr   warn_msgr   r   r   r   $test_reflection_of_mutable_container   s,   z4TestDeprecation.test_reflection_of_mutable_containerN)r,   
__module____qualname__r   r   r3   r   r   r   r   r      s    r   __main__)r   numbar   numba.core.errorsr   r   r   unittestTestCaser   r,   mainr   r   r   r   <module>   s    2