o
    ʩZhJ                     @   s  d dl 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mZ d dlm  mZ d dlmZ ejjejjdkddejje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"eddd d! Z#d"d# Z$d$d% Z%d&d' Z&d(d) Z'ejjejjdkd*de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d0d1 Z+d2d3 Z,d4d5 Z-G d6d7 d7Z.d8d9 Z/d:d; Z0d<d= Z1ej(d>e2d?d@dAg e2dBe2dCgdDdE Z3dS )F    N)arange)assert_assert_equalassert_raises_regex)	deprecatedeprecate_with_doc)StringIO   zPython running -OO)reason)   
   r   	candidate   zBroken as of bpo-44524c                  C   s0   t  } tjdd| dd |  } td| v  d S )NZ
eigenvaluenumpyF)moduleoutputZimport_modulesznumpy.linalg.eig)r   utilsZlookforgetvaluer   )out r   Q/var/www/html/lang_env/lib/python3.10/site-packages/numpy/lib/tests/test_utils.pytest_lookfor   s   
r   c                 C      |S Nr   selfxr   r   r   old_func      r   Rather use new_func2)messagec                 C   r   r   r   r   r   r   r   	old_func2    r   r!   c                 C   r   r   r   r   r   r   r   	old_func3%      r"   	new_func3)Zold_namenew_namec                 C   r   )z Summary.

    Further info.
    r   r   r   r   r   	old_func4*      r&   c                 C   r   )z+Summary.

        Bizarre indentation.
    r   r   r   r   r   	old_func53   r'   r(   zThis function is
deprecated.c                 C   r   )z
    Also in PEP-257.
    r   r   r   r   r   	old_func6<   s   r)   Rather use new_func7)msgc                 C   r   r   r   r   r   r   r   	old_func7D   r   r,   c                   C      t dtjv  d S )N
deprecated)r   r   __doc__r   r   r   r   test_deprecate_decoratorI      r0   c                   C   r-   )Nr   )r   r!   r/   r   r   r   r    test_deprecate_decorator_messageM   r1   r2   c                   C   s    t dtjv  t dtjv  d S )Nr"   r$   )r   r$   r/   r   r   r   r   test_deprecate_fnQ   s   r3   c                   C   r-   )Nr*   )r   r,   r/   r   r   r   r   )test_deprecate_with_doc_decorator_messageV   r1   r4   z-OO discards docstringszold_func, new_funcc                 C   s~   t | | d| fd|ffD ]/\}}t|jdD ]"\}}|dkr0|ds/|dr/J |q|r;|ds;J |qqd S )Noldnew
r   z     )_compare_docs	enumerater/   split
startswith)r   new_funcZkndfuncZliliner   r   r   test_deprecate_help_indentationZ   s   
r@   c                 C   s8   t | }t |}|dd }t||d  | d S )Nz

r	   )inspectgetdocindexr   )r   r=   Zold_docZnew_docrC   r   r   r   r9   k   s   

r9   c                   C   r-   )Nz
        Bizarre)r   	new_func5r/   r   r   r   r   "test_deprecate_preserve_whitespacer   s   rE   c                   C   s   t tjtk d S r   )r   r   
__module____name__r   r   r   r   test_deprecate_modulew   r1   rH   c                   C   s   t d d S )NNone)r   Z	safe_evalr   r   r   r   test_safe_eval_nameconstant{   s   rJ   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dd}t|\}}t|| |j|j  d S N   r      )r   reshaper   byte_boundsr   sizeitemsize)r   alowhighr   r   r   test_byte_bounds   s   zTestByteBounds.test_byte_boundsc                 C   s>   t ddd}|j}t|\}}t|| |j|j  d S rL   r   rO   Tr   rP   r   rQ   rR   r   rS   brT   rU   r   r   r   "test_unusual_order_positive_stride   s   z1TestByteBounds.test_unusual_order_positive_stridec                 C   sH   t ddd}|jd d d }t|\}}t|| |j|j  d S )NrM   r   rN   rW   rY   r   r   r   "test_unusual_order_negative_stride   s   z1TestByteBounds.test_unusual_order_negative_stridec                 C   sH   t d}|d d d }t|\}}t|| |jd |j |j  d S )NrM   r	   )r   r   rP   r   rQ   rR   rY   r   r   r   test_strided   s   $zTestByteBounds.test_stridedN)rG   rF   __qualname__rV   r[   r]   r^   r   r   r   r   rK      s
    rK   c                   C   s(   t td td1 sw   Y  d S )Nzno deprecation warning)r   
ValueErrorr   r   r   r   (test_assert_raises_regex_context_manager   s   ra   c                  C   s@   G dd d} G dd d}dd }||sJ || rJ d S )Nc                   @   s   e Zd ZdS )z1test_info_method_heading.<locals>.NoPublicMethodsN)rG   rF   r_   r   r   r   r   NoPublicMethods   s    rb   c                   @   s   e Zd Zdd ZdS )z3test_info_method_heading.<locals>.WithPublicMethodsc                   S   s   d S r   r   r   r   r   r   first_method   r#   z@test_info_method_heading.<locals>.WithPublicMethods.first_methodN)rG   rF   r_   rc   r   r   r   r   WithPublicMethods   s    rd   c                 S   s    t  }tj| |d d| v S )N)r   zMethods:)r   r   infor   )clsr   r   r   r   _has_method_heading   s   z5test_info_method_heading.<locals>._has_method_headingr   )rb   rd   rg   r   r   r   test_info_method_heading   s
   rh   c                  C   sD  dd } t jddt jdddidfgfgdd	id}t|}| ||d
u s(J |jd u s/J |d jd u s8J |d d jd u sCJ t jddgd
ddid}t|}| ||d
u s]J |jd u sdJ t jdddid}t|}| ||d
u s{J |jd u sJ t jdddid}t|}| ||d
u sJ |jd u sJ d S )Nc                 S   s   t j| |ddS )Nno)Zcasting)npZcan_cast)Zdt1Zdt2r   r   r   _compare_dtypes   s   z+test_drop_metadata.<locals>._compare_dtypesl1l2ZS8r+   ZtotometadataZtitiT)r   z<f8)yz<i4)alignro   Z8fZuint32)rj   dtyper   drop_metadataro   )rk   dtZdt_mr   r   r   test_drop_metadata   s8    




ru   rr   zi,i,i,if1Zf3Zf8Z10ic                 C   s<   t | | u s	J tj| ddid} t | jd u sJ d S )Nr   r	   rn   )r   rs   rj   rr   ro   )rr   r   r   r   $test_drop_metadata_identity_and_copy   s   rw   )4rA   sysZpytestr   rj   Z
numpy.corer   Znumpy.testingr   r   r   Z	numpy.libr   r   Znumpy.lib.utilslibr   ior   markZskipifflagsoptimizeversion_infor   r   r!   r"   r$   r&   Z	new_func4r(   rD   r)   Z	new_func6r,   r0   r2   r3   r4   Zparametrizer@   r9   rE   rH   rJ   rK   ra   rh   ru   rr   rw   r   r   r   r   <module>   sp    



$