o
    1ήc                  	   @  s   d Z ddlmZ ddlZddlZddlmZ ddlZddlZ	ddl
mZ G dd dZG dd	 d	Zejjejd
k ddejde	je	je	je	je	jgG dd dZejjejd
kdddddZdS )z
This file tests the generic aspects of ArrayMethod.  At the time of writing
this is private API, but when added, public API may be added here.
    )annotationsN)Any)_get_castingimplc                   @  sd   e Zd ZeeedeedZej	
dddddeddffedd	ffgd
d Zd	S )TestResolveDescriptorsdfargsTN)NNN)NNTNc                 C  s<   t t | jj|  W d    d S 1 sw   Y  d S r
   )pytestraises	TypeErrormethod_resolve_descriptors)selfr    r   H/tmp/pip-target-vg8gfxp4/lib/python/numpy/core/tests/test_arraymethod.pytest_invalid_arguments   s   	"z-TestResolveDescriptors.test_invalid_arguments)__name__
__module____qualname__get_castingimpltypenpdtyper   r   markparametrizer   r   r   r   r   r      s    r   c                   @  s   e Zd ZeeedeedZej	
ddgdefdefdefdefed	ed	ffefejd	d
dejd	ddffefejdddejdddffefejd	ddejdddffefejdddejdddffefg	dd ZdS )TestSimpleStridedCallr   r   r   errorr	   )r
   r   r      z>d)r   z<f)   r"      s    x00 x00 x00 x00 x00 x00s    x00 x00 x00c                 C  s<   t | | jj|  W d    d S 1 sw   Y  d S r
   )r   r   r   _simple_strided_call)r   r   r    r   r   r   r   -   s   "z,TestSimpleStridedCall.test_invalid_argumentsN)r   r   r   r   r   r   r   r   r   r   r   r   arangeones
ValueError
frombufferr   r   r   r   r   r   &   s0    r   )r!   	   zRequires python 3.9)reasonclsc                   @  s2   e Zd ZdddZejdeddd
dZdS )TestClassGetItemr+   type[np.ndarray]returnNonec                 C  s.   |t t f }t|tjsJ |j|u sJ dS )z!Test `ndarray.__class_getitem__`.N)r   
isinstancetypesGenericAlias
__origin__)r   r+   aliasr   r   r   test_class_getitemH   s   z#TestClassGetItem.test_class_getitemarg_lenr#   intc                 C  sv   t f| }|dv r|| sJ d S d|dkrdnd d}tjt|d ||  W d    d S 1 s4w   Y  d S )N)   r"   zToo r   fewmanyz
 argumentsmatch)r   r   r   r   )r   r+   r6   arg_tupr<   r   r   r   test_subscript_tupN   s   

"z#TestClassGetItem.test_subscript_tupN)r+   r-   r.   r/   )r+   r-   r6   r7   r.   r/   )	r   r   r   r5   r   r   r   ranger>   r   r   r   r   r,   C   s    
r,   zRequires python 3.8r.   r/   c                  C  sF   d} t jt| d tjttf  W d    d S 1 sw   Y  d S )Nz(Type subscription requires python >= 3.9r;   )r   r   r   r   ndarrayr   r;   r   r   r   test_class_getitem_38Y   s   "rA   )r.   r/   )__doc__
__future__r   sysr1   typingr   r   numpyr   numpy.core._multiarray_umathr   r   r   r   r   skipifversion_infor   r@   recarray	chararraymatrixmemmapr,   rA   r   r   r   r   <module>   s"    