a
    hG	                     @   sj   d Z ddlZddlZddlmZmZ ddlmZ ddl	m
Z
 dd ZegZejdeG d	d
 d
ZdS )z3Test of min-max 1D features of sparse array classes    N)assert_equalassert_array_equal)	coo_array)isscalarlikec                 C   s    t | tjst| r| S |  S )N)
isinstancenpZndarrayr   toarray)a r
   \/var/www/html/assistant/venv/lib/python3.9/site-packages/scipy/sparse/tests/test_minmax1d.pyr      s    r   	spcreatorc                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
Test_MinMaxMixin1Dc                 C   sR   t d}||}t| d t| d t|  d t|  d d S )N   r      )r   aranger   minmax)selfr   DXr
   r
   r   test_minmax   s    
zTest_MinMaxMixin1D.test_minmaxc              	   C   s   t d}||}dD ]D}tt|j|d|j|dd tt|j|d|j|dd qdD ]x}tjtdd |j|d W d    n1 s0    Y  tjtdd |j|d W d    q`1 s0    Y  q`d S )	N2   )r   axisT)r   Zkeepdims)   zaxis out of rangematch)	r   r   r   r   r   r   pytestraises
ValueError)r   r   r   r   r   r
   r
   r   test_minmax_axis"   s    
*z#Test_MinMaxMixin1D.test_minmax_axisc                 C   sF   t g d}||}tt |t | tt |t | d S )N)r   r      )r   arrayr   r   r   )r   r   ZdatZdatspr
   r
   r   test_numpy_minmax4   s    z$Test_MinMaxMixin1D.test_numpy_minmaxc              	   C   sZ  t g d}t g d}t g d}t g d}t g d}|||||fD ]l}||}t| t | t| t | t|jddt j|dd t|jddt j|dd qTt d}	d	D ]}
||	}tjtd
d |j|
d W d    n1 s0    Y  tjtd
d |j|
d W d    q1 sJ0    Y  qd S )N)r   r   r$      )r   r   r   r   )r   r   r   )r   r$   r'   r   )r   r$   r   r   r   r   )r   )Nr   zto an empty matrixr   )	r   r%   r   ZargmaxZargminemptyr    r!   r"   )r   r   ZD1ZD2ZD3ZD4ZD5r   ZmatZD6r   r
   r
   r   test_argmax;   s$    
,zTest_MinMaxMixin1D.test_argmaxN)__name__
__module____qualname__r   r#   r&   r*   r
   r
   r
   r   r      s   
r   )__doc__r    numpyr   Znumpy.testingr   r   Zscipy.sparser   Zscipy.sparse._sputilsr   r   Zformats_for_minmaxmarkZparametrizer   r
   r
   r
   r   <module>   s   