3
Kd                 @   s  d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl	m
Z
 d dljjZd dlmZ ejjejjdkddd	d
 Ze
dd Ze
dddd Zdd Ze
edddZdd Ze
eZdd Ze
eddZdd Ze
eZdd Zdd Z d d! Z!ejjejjdkd"dejj"d#eefeefeefgd$d% Z#d&d' Z$ejjejjdkd"dd(d) Z%d*d+ Z&G d,d- d-Z'd.d/ Z(dS )0    N)arange)assert_assert_equalassert_raises_regex)	deprecate)StringIO   zPython running -OO)reasonc              C   s0   t  } tjdd| dd | j } td| k d S )NZ
eigenvalueZnumpyF)moduleoutputZimport_modulesznumpy.linalg.eig)r   utilsZlookforgetvaluer   )out r   N/var/www/html/virt/lib64/python3.6/site-packages/numpy/lib/tests/test_utils.pytest_lookfor   s
    
r   c             C   s   |S )Nr   )selfxr   r   r   old_func   s    r   zRather use new_func2)messagec             C   s   |S )Nr   )r   r   r   r   r   	old_func2   s    r   c             C   s   |S )Nr   )r   r   r   r   r   	old_func3    s    r   	new_func3)Zold_namenew_namec             C   s   |S )z Summary.

    Further info.
    r   )r   r   r   r   r   	old_func4%   s    r   c             C   s   |S )z+Summary.

        Bizarre indentation.
    r   )r   r   r   r   r   	old_func5.   s    r   zThis function is
deprecated.c             C   s   |S )z
    Also in PEP-257.
    r   )r   r   r   r   r   	old_func67   s    r   c               C   s   t dtjk d S )N
deprecated)r   r   __doc__r   r   r   r   test_deprecate_decorator?   s    r   c               C   s   t dtjk d S )NzRather use new_func2)r   r   r   r   r   r   r    test_deprecate_decorator_messageC   s    r    c               C   s    t dtjk t dtjk d S )Nr   r   )r   r   r   r   r   r   r   test_deprecate_fnG   s    r!   z-OO discards docstringszold_func, new_funcc             C   s   t | | xxd| fd|ffD ]d\}}xZt|jjdD ]F\}}|dkrf|jds||jd s|t|q6|r6|jds6t|q6W qW d S )Noldnew
r   z     )_compare_docs	enumerater   split
startswithAssertionError)r   new_funcZkndfuncliliner   r   r   test_deprecate_help_indentationL   s    
 r/   c             C   s8   t j| }t j|}|jdd }t||d  | d S )Nz

r   )inspectgetdocindexr   )r   r+   Zold_docZnew_docr2   r   r   r   r&   ]   s    

r&   c               C   s   t dtjk d S )Nz
        Bizarre)r   	new_func5r   r   r   r   r   "test_deprecate_preserve_whitespaced   s    r4   c               C   s   t jd d S )NNone)r   Z	safe_evalr   r   r   r   test_safe_eval_nameconstanti   s    r6   c               @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestByteBoundsc             C   s8   t djdd}tj|\}}t|| |j|j  d S )N         )r   reshaper   byte_boundsr   sizeitemsize)r   alowhighr   r   r   test_byte_boundsp   s    zTestByteBounds.test_byte_boundsc             C   s>   t djdd}|j}tj|\}}t|| |j|j  d S )Nr8   r9   r:   )r   r;   Tr   r<   r   r=   r>   )r   r?   br@   rA   r   r   r   "test_unusual_order_positive_stridew   s    z1TestByteBounds.test_unusual_order_positive_stridec             C   sH   t djdd}|jd d d }tj|\}}t|| |j|j  d S )Nr8   r9   r:      )r   r;   rC   r   r<   r   r=   r>   )r   r?   rD   r@   rA   r   r   r   "test_unusual_order_negative_stride}   s    z1TestByteBounds.test_unusual_order_negative_stridec             C   sH   t d}|d d d }tj|\}}t|| |jd |j |j  d S )Nr8   r   )r   r   r<   r   r=   r>   )r   r?   rD   r@   rA   r   r   r   test_strided   s    zTestByteBounds.test_stridedN)__name__
__module____qualname__rB   rE   rH   rI   r   r   r   r   r7   n   s   r7   c            	   C   s"   t td tdW d Q R X d S )Nzno deprecation warning)r   
ValueErrorr   r   r   r   (test_assert_raises_regex_context_manager   s    rN   ))r0   sysZpytestZ
numpy.corer   Znumpy.testingr   r   r   Z	numpy.libr   Znumpy.lib.utilslibr   ior   markZskipifflagsoptimizer   r   r   r   r   r   Z	new_func4r   r3   r   Z	new_func6r   r    r!   Zparametrizer/   r&   r4   r6   r7   rN   r   r   r   r   <module>   s>    	 