HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/tests/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/tests/__pycache__/test_warnings.cpython-36.pyc
3

���h��@shdZddlZddlmZddlZddlZddlZGdd�dej�ZGdd�dej�Z	ej
jdd	��ZdS)
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$eZdZdd�Zdd�Zdd�ZdS)�	ParseCallcCs
g|_dS)N)�ls)�self�r�:/tmp/pip-build-5_djhm0z/numpy/numpy/tests/test_warnings.py�__init__
szParseCall.__init__cCs tjj||�|jj|j�dS)N)�ast�NodeVisitor�
generic_visitr�append�attr)r�noderrr�visit_AttributeszParseCall.visit_AttributecCs|jj|j�dS)N)rr�id)rrrrr�
visit_NameszParseCall.visit_NameN)�__name__�
__module__�__qualname__rrrrrrrrsrcs$eZdZ�fdd�Zdd�Z�ZS)�	FindFuncscst�j�||_dS)N)�superr�_FindFuncs__filename)r�filename)�	__class__rrrs
zFindFuncs.__init__cCs�t�}|j|j�tjj||�|jddks<|jddkr`|jdjdkr`t	dj
|j|j���|jddkr�t
|j�dks�|jdd	kr�d
|jkr�dSt
|j�dkr�dSdd
�|jD�}d|kr�dSt	dj
|j|j���dS)N��simplefilter�filterwarningsr�ignorezFwarnings should have an appropriate stacklevel; found in {} on line {}�warn��warningsztesting/tests/test_warnings.py�cSsh|]
}|j�qSr)�arg)�.0�kwrrr�	<setcomp>2sz'FindFuncs.visit_Call.<locals>.<setcomp>�
stacklevel���r'r'���)r�visit�funcr	r
rr�args�s�AssertionError�formatr�lineno�len�keywords)rr�pr+rrr�
visit_Calls(
zFindFuncs.visit_Call)rrrrr3�
__classcell__rr)rrrsrc
Cs�ttj�j}xx|jd�D]j}|d|jkr,q||dkr:q||ddkrLqtjt|���"}t	j
|j��}t|�j
|�WdQRXqWdS)Nz*.pyZtestingz__init__.py�random)r�numpy�__file__�parentZrglob�parents�tokenize�open�strr	�parse�readrr))�base�path�file�treerrr�test_warning_calls:srC)
�__doc__ZpytestZpathlibrr	r:r6r
rr�markZslowrCrrrr�<module>s"