U
    ,dA	                     @   sV   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rRe  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warningsZexpected_strr    r   A/tmp/pip-unpacked-wheel-eu7e0c37/numba/tests/test_deprecations.pycheck_warning
   s    zTestDeprecation.check_warningc              	   C   s\   t jddF}t jdtd t jdtd dd }t|  d}| ||t W 5 Q R X 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 ]}|j d}t|dg}tjdd}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 5 Q R X qd S )Nc                 S   s
   |  dS Nr   )appendar   r   r   foo_list!   s    zFTestDeprecation.test_reflection_of_mutable_container.<locals>.foo_listc                 S   s
   |  dS r   )addr!   r   r   r   foo_set$   s    zETestDeprecation.test_reflection_of_mutable_container.<locals>.foo_setZfoo_
   Tr   r   r   r   )Z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   Zwarn_msgr   r   r   r   $test_reflection_of_mutable_container   s&    z4TestDeprecation.test_reflection_of_mutable_containerN)r'   
__module____qualname__r   r   r-   r   r   r   r   r      s   r   __main__)r   Znumbar   Znumba.core.errorsr   r   r   ZunittestZTestCaser   r'   mainr   r   r   r   <module>   s   2