a
    hÝEbè  ã                   @   sh   d Z ddlZddlmZ ddlZddlZddlZG dd„ dejƒZG dd„ dejƒZ	ej
jdd	„ ƒZdS )
z
Tests which scan for certain occurrences in the code, they may not find
all of these occurrences but should catch almost all.
é    N)ÚPathc                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )Ú	ParseCallc                 C   s
   g | _ d S ©N)Úls)Úself© r   úY/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/numpy/tests/test_warnings.pyÚ__init__   s    zParseCall.__init__c                 C   s    t j | |¡ | j |j¡ d S r   )ÚastÚNodeVisitorÚgeneric_visitr   ÚappendÚattr©r   Únoder   r   r   Úvisit_Attribute   s    zParseCall.visit_Attributec                 C   s   | j  |j¡ d S r   )r   r   Úidr   r   r   r   Ú
visit_Name   s    zParseCall.visit_NameN)Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r   r   r      s   r   c                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )Ú	FindFuncsc                    s   t ƒ  ¡  || _d S r   )Úsuperr	   Ú_FindFuncs__filename)r   Úfilename©Ú	__class__r   r   r	      s    
zFindFuncs.__init__c                 C   sÞ   t ƒ }| |j¡ tj | |¡ |jd dks<|jd dkr`|jd jdkr`t	d 
| j|j¡ƒ‚|jd dkrÚt|jƒdksŠ|jd	 d
krÚd| jkr˜d S t|jƒdkrªd S dd„ |jD ƒ}d|v rÆd S t	d 
| j|j¡ƒ‚d S )NéÿÿÿÿÚsimplefilterÚfilterwarningsr   ÚignorezFwarnings should have an appropriate stacklevel; found in {} on line {}Úwarné   éþÿÿÿÚwarningsztesting/tests/test_warnings.pyé   c                 S   s   h | ]
}|j ’qS r   )Úarg)Ú.0Úkwr   r   r   Ú	<setcomp>2   ó    z'FindFuncs.visit_Call.<locals>.<setcomp>Ú
stacklevel)r   ÚvisitÚfuncr
   r   r   r   ÚargsÚsÚAssertionErrorÚformatr   ÚlinenoÚlenÚkeywords)r   r   Úpr.   r   r   r   Ú
visit_Call   s6    ÿÿÿÿ
ÿÿzFindFuncs.visit_Call)r   r   r   r	   r6   Ú__classcell__r   r   r   r   r      s   r   c               	   C   sš   t tjƒj} |  d¡D ]~}| d |jv r*q|| d kr8q|| d d krJqt t|ƒ¡�,}t	 
| ¡ ¡}t|ƒ |¡ W d   ƒ q1 sŠ0    Y  qd S )Nz*.pyÚtestingz__init__.pyÚrandom)r   ÚnumpyÚ__file__ÚparentÚrglobÚparentsÚtokenizeÚopenÚstrr
   ÚparseÚreadr   r,   )ÚbaseÚpathÚfileÚtreer   r   r   Útest_warning_calls:   s    rH   )Ú__doc__ZpytestÚpathlibr   r
   r?   r:   r   r   r   ÚmarkZslowrH   r   r   r   r   Ú<module>   s   "