3
­?d]€  ã               @   s”  d dl mZmZmZ 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ejd  dkr€d dlmZ n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 ƒ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
�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-e+ƒZ,d.d/„ Z-dS )0é    )ÚdivisionÚabsolute_importÚprint_functionN)Ú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   ú;/tmp/pip-build-op5p2y5_/numpy/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_func53   s    r   c             C   s   |S )z
    Also in PEP-257.
    r   )r   r   r   r   r   Ú	old_func6<   s    r    c               C   s   t dtjkƒ d S )NZ
deprecated)r   r   Ú__doc__r   r   r   r   Útest_deprecate_decoratorD   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_messageH   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_fnL   s    r$   z-OO discards docstringsc               C   s"   t ttƒ t ttƒ t ttƒ d S )N)Ú_compare_docsr   Ú	new_func4r   Ú	new_func5r    Ú	new_func6r   r   r   r   Útest_deprecate_help_indentationQ   s    

r)   c             C   s8   t j| ƒ}t j|ƒ}|jdƒd }t||d … |ƒ d S )Nz

r   )ÚinspectÚgetdocÚindexr   )r   Únew_funcZold_docZnew_docr,   r   r   r   r%   X   s    

r%   c               C   s   t dtjkƒ d S )Nz
        Bizarre)r   r'   r!   r   r   r   r   Ú"test_deprecate_preserve_whitespace_   s    r.   c               C   s   t jdƒ d S )NÚNone)r   Z	safe_evalr   r   r   r   Útest_safe_eval_nameconstantd   s    r0   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
   é   )r   Úreshaper   Úbyte_boundsr   ÚsizeÚitemsize)r   ÚaÚlowÚhighr   r   r   Útest_byte_boundsk   s    zTestByteBounds.test_byte_boundsc             C   s>   t dƒjddƒ}|j}tj|ƒ\}}t|| |j|j ƒ d S )Nr2   r
   r3   )r   r4   ÚTr   r5   r   r6   r7   )r   r8   Úbr9   r:   r   r   r   Ú"test_unusual_order_positive_strider   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 )Nr2   r
   r3   é   éÿÿÿÿ)r   r4   r<   r   r5   r   r6   r7   )r   r8   r=   r9   r:   r   r   r   Ú"test_unusual_order_negative_stridex   s    z1TestByteBounds.test_unusual_order_negative_stridec             C   sH   t dƒ}|d d d… }tj|ƒ\}}t|| |jd |j |j ƒ d S )Nr2   r   )r   r   r5   r   r6   r7   )r   r8   r=   r9   r:   r   r   r   Útest_strided~   s    zTestByteBounds.test_stridedN)Ú__name__Ú
__module__Ú__qualname__r;   r>   rA   rB   r   r   r   r   r1   i   s   r1   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    rG   ).Ú
__future__r   r   r   r*   ÚsysZpytestZ
numpy.corer   Znumpy.testingr   r   r   Z	numpy.libr	   Znumpy.lib.utilsÚlibr   Úversion_infoÚior   ÚmarkZskipifÚflagsÚoptimizer   r   r   r   r   r   r&   r   r'   r    r(   r"   r#   r$   r)   r%   r.   r0   Úobjectr1   rG   r   r   r   r   Ú<module>   s<    	  