U
    ÉZjè  ã                   @   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   ú\/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/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|k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   s     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   s:     ÿÿÿÿ
 ÿÿzFindFuncs.visit_Call)r   r   r   r	   r5   Ú__classcell__r   r   r   r   r      s   r   c               
   C   s†   t tjƒj} |  d¡D ]j}| d |jkr*q|| d kr8q|| d d krJqt t|ƒ¡�"}t	 
| ¡ ¡}t|ƒ |¡ W 5 Q R X qd S )Nz*.pyZ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    rF   )Ú__doc__ZpytestÚpathlibr   r
   r=   r8   r   r   r   ÚmarkZslowrF   r   r   r   r   Ú<module>   s   "