관리-도구
편집 파일: test_warnings.cpython-37.pyc
B ��Fd� � @ s� d Z ddlmZmZmZ ddlZejdkr�ddlmZ ddl Z ddl Z ddlZddlm Z ddlmZ G dd � d e j�ZG d d� de j�Zedd � �Zedkr�e � dS )z Tests which scan for certain occurrences in the code, they may not find all of these occurrences but should catch almost all. � )�division�absolute_import�print_functionN)� � )�Path)�run_module_suite)�slowc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )� ParseCallc C s g | _ d S )N)�ls)�self� r ��/builddir/build/BUILDROOT/alt-python37-numpy-1.13.3-8.el8.x86_64/opt/alt/python37/lib64/python3.7/site-packages/numpy/tests/test_warnings.py�__init__ s zParseCall.__init__c C s t j�| |� | j�|j� d S )N)�ast�NodeVisitor� generic_visitr �append�attr)r �noder r r �visit_Attribute s zParseCall.visit_Attributec C s | j �|j� d S )N)r r �id)r r r r r � visit_Name s zParseCall.visit_NameN)�__name__� __module__�__qualname__r r r r r r r r s r c s$ e Zd Z� fdd�Zdd� Z� ZS )� FindFuncsc s t � �� || _d S )N)�superr �_FindFuncs__filename)r �filename)� __class__r r r ! s zFindFuncs.__init__c C s� t � }|�|j� tj�| |� |jd dks<|jd dkr`|jd jdkr`t d� | j|j���|jd dkr�t |j�dks�|jd d kr�d| jkr�d S t |j�dkr�d S d d� |jD �}d|kr�d S t d� | j|j���d S )N����simplefilter�filterwarningsr �ignorez8ignore filter should not be used; found in {} on line {}�warn� ����warningsztesting/tests/test_warnings.pyr c S s h | ] }|j �qS r )�arg)�.0�kwr r r � <setcomp>: s z'FindFuncs.visit_Call.<locals>.<setcomp>� stacklevelzFwarnings should have an appropriate stacklevel; found in {} on line {})r �visit�funcr r r r �args�s�AssertionError�formatr �lineno�len�keywords)r r �pr0 r r r � visit_Call% s( zFindFuncs.visit_Call)r r r r r8 � __classcell__r r )r r r s r c C s� t tj�j} xx| �d�D ]j}| d |jkr,q|| d kr:q|| d d krLqt�t|���"}t � |�� �}t|�� |� W d Q R X qW 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_callsB s rJ �__main__)�__doc__� __future__r r r �sys�version_info�pathlibr r rA r<