o
    ۾iV                     @   sp   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZ G dd deZed	kr6e   dS dS )
    N)patch)TestCase)njit)ir)NotifyLocBase_the_registryc                   @   s$   e Zd Zejddiddd ZdS )TestMiscCoverageSupportNUMBA_JIT_COVERAGE1)envvarsc           	         sf  G dd dt }t|g }d}t|| tdd }| }W d    n1 s(w   Y  | |d d}|jj| }tt	d}| 
d	||f|j | 
d
|j t|| d t fdd}| }W d    n1 sqw   Y  | |d |jj| }| 
d	||f|j | d	||d f|j | 
d	||d f|j | 
d
|j d S )Nc                   @   s    e Zd Zg Zdd Zdd ZdS )zBTestMiscCoverageSupport.test_custom_loc_notifier.<locals>.MyNotifyc                 S   s   | j d|f d S )NNOTIFYrecordsappend)selfloc r   Z/home/ubuntu/.local/lib/python3.10/site-packages/numba/tests/test_misc_coverage_support.pynotify   s   zITestMiscCoverageSupport.test_custom_loc_notifier.<locals>.MyNotify.notifyc                 S   s   | j d d S )NCLOSENr   )r   r   r   r   close   s   zHTestMiscCoverageSupport.test_custom_loc_notifier.<locals>.MyNotify.closeN)__name__
__module____qualname__r   r   r   r   r   r   r   MyNotify   s    r   z)numba.misc.coverage_support._the_registryc                   S   s   dS )N{   r   r   r   r   r   foo   s   z=TestMiscCoverageSupport.test_custom_loc_notifier.<locals>.foor         r   r   Fc                      s    rdS dS )NiA  r   r   r   condr   r   r   1   s   )r   r   r   r   assertEqual__code__co_firstlinenor   Loc__file__assertInwith_linenor   assertNotIn)	r   r   new_the_registrygvr   resfirst_offsetoffsetr   r   r    r   test_custom_loc_notifier   s8   


z0TestMiscCoverageSupport.test_custom_loc_notifierN)r   r   r   r   run_test_in_subprocessr/   r   r   r   r   r      s    r   __main__)unittestunittest.mockr   numba.tests.supportr   numbar   
numba.corer   numba.misc.coverage_supportr   r   r   r   mainr   r   r   r   <module>   s    ?