
    Bwg                     L    d dl Zd dl mZmZmZ d dlmZmZmZm	Z	  G d d      Z
y)    N)fixisposinfisneginf)assert_assert_equalassert_array_equalassert_raisesc                   *    e Zd Zd Zd Zd Zd Zd Zy)TestUfunclikec                    t        j                  t         j                  t         j                   t         j                  dddg      }t        j                  |j
                  t              }t        j                  g d      }t        |      }t        ||       t        ||      }t        ||       t        ||       |j                  t         j                        }t        t              5  t        |       d d d        y # 1 sw Y   y xY w)N              @      )TFFFFF)nparrayinfnanzerosshapeboolr   r   astype
complex128r	   	TypeErrorselfaouttgtress        U/var/www/horilla/myenv/lib/python3.12/site-packages/numpy/lib/tests/test_ufunclike.pytest_isposinfzTestUfunclike.test_isposinf       HHbffrvvgrvvsC>?hhqww%hh@AqkS#q#S#S#HHR]]#9% 	QK	 	 	   +D  D	c                    t        j                  t         j                  t         j                   t         j                  dddg      }t        j                  |j
                  t              }t        j                  g d      }t        |      }t        ||       t        ||      }t        ||       t        ||       |j                  t         j                        }t        t              5  t        |       d d d        y # 1 sw Y   y xY w)Nr   r   r   )FTFFFF)r   r   r   r   r   r   r   r   r   r   r   r	   r   r   s        r    test_isneginfzTestUfunclike.test_isneginf   r"   r#   c                 X   t        j                  g dg dg      }t        j                  |j                  t              }t        j                  g dg dg      }t        |      }t        ||       t        ||      }t        ||       t        ||       t        t        d      d       y )N)      ?皙?g      ?g?)      皙g      g)r'   r'   r'   r'   )r)   r)   r)   r)   gQ	@   )r   r   r   r   floatr   r   r   s        r    test_fixzTestUfunclike.test_fix)   s    HH*,DEFhhqww&hh(*>?@!fS#!SkS#S#SY"    c                     G fddt         j                        t        j                  ddg      } |d      }t        |      }t	        |t        j                  ddg             t        t        |             t        |j                  d       |d	   }d
|_        t        |      }t        t        |             t        |j                  d
       y )Nc                   (    e Zd ZddZd fd	Zd Zy)5TestUfunclike.test_fix_with_subclass.<locals>.MyArrayNc                 `    t        j                  |d      j                  |       }||_        |S )NT)copy)r   r   viewmetadata)clsdatar5   r   s       r    __new__z=TestUfunclike.test_fix_with_subclass.<locals>.MyArray.__new__7   s)    hht$/44S9'
r.   c                 |    t        |      s|j                        }|j                  | j                  |_        |S N)
isinstancer4   r5   )r   objcontextreturn_scalarMyArrays       r    __array_wrap__zDTestUfunclike.test_fix_with_subclass.<locals>.MyArray.__array_wrap__<   s5    !#w/((7+C<<'#'==CL
r.   c                 *    t        |dd       | _        | S )Nr5   )getattrr5   )r   r<   s     r    __array_finalize__zHTestUfunclike.test_fix_with_subclass.<locals>.MyArray.__array_finalize__C   s     'Z >r.   r:   )NF)__name__
__module____qualname__r8   r@   rC   )r?   s   r    r?   r1   6   s    
r.   r?   r(   r*   foo)r5      )r   .bar)	r   ndarrayr   r   r   r   r;   r   r5   )r   r   mfm0df0dr?   s         @r    test_fix_with_subclassz$TestUfunclike.test_fix_with_subclass5   s    	bjj 	" HHc4[!A&F1bhh2w/0
1g&'QZZ' h#h
3()S\\5)r.   c                    t         j                  }t        j                  |      }t         j                  }t	        ||       t	        t        |      t        |             d}t        j                  |      }t        j                  d      }t	        ||       t	        t        |      t        |             t        j                  d      }t        j                  ||      }t        ||u        y )Ng333333r   r   )r   )
r   r   r   True_r   typer   float64r   r   )r   xactualexpectedr   s        r    test_scalarzTestUfunclike.test_scalarU   s    FFQ88VX&T&\4>2::d#VX&T&\4>2hhsms##r.   N)rD   rE   rF   r!   r%   r-   rP   rX    r.   r    r   r   	   s    
#*@r.   r   )numpyr   r   r   r   numpy.testingr   r   r   r	   r   rY   r.   r    <module>r\      s$     ) ) 
[ [r.   