
    Ph                        d dl Z d dlZd dlZd dlmZmZmZ d dlm	Z	 d dl
mZ ej                  dej                   dej                  diZej                  j!                  dej"                  ej$                  ej&                  g      d	        Zej                  j!                  dej"                  ej$                  ej&                  g      d
        Zej                  j!                  dej,                  ej.                  ej0                  g      d        Zej                  j!                  dej,                  ej.                  ej0                  g      d        ZddZej                  j!                  dej"                  ej$                  ej&                  g      d        Zej                  j!                  dej,                  ej.                  ej0                  g      d        Zd Z G d de	      Zy)    N)assert_assert_equalIS_MUSL)CommaDecimalPointLocale)StringIOinfz-infnantpc           	      J   dD ]4  }t        t         | |            t        t        |            d| z         6  | d      j                  dkD  r3t        t         | d            t        t        d            d| z         yd}t        t         | d            |d| z         y)	z Check formatting.

        This is only for the str function, and only for simple types.
        The precision of np.float32 and np.longdouble aren't the same as the
        python float precision.

    r      g@xD!Failed str formatting for type %serr_msg 7yAC   1e161e+16N)r   strfloatitemsizer
   xrefs      fC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\numpy/core/tests/test_print.pytest_float_typesr      s     SAZU1X@2E	G  
$x1SD]Cf$6@2E	G SD]C@2E	G    c                     t         j                  t         j                   t         j                  fD ])  }t        t	         | |            t
        |   d| z         + y)z Check formatting of nan & inf.

        This is only for the str function, and only for simple types.
        The precision of np.float32 and np.longdouble aren't the same as the
        python float precision.

    r   r   N)npr   r	   r   r   _REF)r
   r   s     r   test_nan_inf_floatr"   %   sD     ffrvvgrvv&SAZa@2E	G 'r   c                 6   dD ]  }t        t         | |            t        t        |            d| z         t        t         | |dz              t        t        |dz              d| z         t        t         | ||dz  z               t        t        ||dz  z               d| z           | d      j                  dkD  r3t        t         | d            t        t        d            d| z         yd}t        t         | d            |d| z         y)	zCheck formatting of complex types.

        This is only for the str function, and only for simple types.
        The precision of np.float32 and np.longdouble aren't the same as the
        python float precision.

    r   r   r   y              ?r      
(1e+16+0j)N)r   r   complexr   r   s      r   test_complex_typesr'   3   s     SAZWQZ@2E	GSAbD]C"$6@2E	GSA"H&GA"H,=(>@2E	G  
$x1SD]C$6@2E	G SD]C@2E	Gr   dtypec                    i t        t        j                  d      dt        dt        j                        dt        t        j                   d      dt        dt        j                         dt        t        j                  d      dt        dt        j                        dt        t        j                   d      d	t        dt        j                         d
t        t        j                  d      dt        dt        j                        dt        t        j                   d      dt        dt        j                         dt        t        j                  d      dt        dt        j                        dt        t        j                   d      dt        dt        j                         d}|j	                         D ]   \  }}t        t         | |            |       " y)z*Check inf/nan formatting of complex types.r   z(inf+0j)infjz	(-inf+0j)z-infjr   (inf+1j)z(1+infj)	(-inf+1j)z(1-infj)z(nan+0j)nanj(nan+1j)z(1+nanj)N)r&   r    r   r	   itemsr   r   )r(   TESTScss       r   test_complex_inf_nanr3   M   s   J266F 	[ 	BFF7W	
 	J 	266J 	[ 	BFF7Z 	J 	266F 	Z 	BFF7V 	J 	266J 	Z  	BFF7Z!E$ 1Sq]A& r   c                 ^   t               }t               }t        j                  }	 |t        _        t         ||              |t        _        |rt        |       nt        |        |t        _        t	        |j                         |j                         d|z         y # |t        _        w xY w)Nzprint failed for type%sr   )r   sysstdoutprintr   getvalue)r   r
   r   filefile_tpr6   s         r   _test_redirected_printr;   g   s}    :DjGZZF	
be
#J!H
'"2"2"42R79 
s   A B B,c                 f   dD ]  }t        t        |      |         t        j                  t        j                   t        j                  fD ]  }t        t        |      | t
        |          !  | d      j                  dkD  rt        t        d      |        yd}t        t        d      | |       y)"Check formatting when using print r   r   r   r   N)r;   r   r    r   r	   r!   r   r   s      r   test_float_type_printr>   z   s     uQx,  ffrvvgrvv&uQxT!W5 ' 
$x1uT{B/uT{B4r   c                    dD ]  }t        t        |      |          | d      j                  dkD  rt        t        d      |        nd}t        t        d      | |       t        t        t        j                  d      | d       t        t        t        j                   d      | d       t        t        t        j
                   d      | d       y	)
r=   r   r   r$   r%   r   r+   r,   r.   N)r;   r&   r   r    r   r	   r   s      r   test_complex_type_printr@      s    
 wqz2.  
$x1wt}b1wt}b#672661-r:>7BFF7A.K@7BFF7A.J?r   c                     ddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j
                  fdd	t         j                  fdd
t         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                  fddt         j                   fg} | D ]>  \  }}}	 t#        |j%                  |      |j%                   ||            d|d|       @ y# t&        $ r>}t)        dd|dt+        |      dt+        |      dt-        |      d	       Y d}~d}~ww xY w)z2Test the str.format method with NumPy scalar typesz{0}TFz{0:d}   iP  l    ^e l     RU iiЊi lʈl  x'{'	 z{0:g}g      ?y      ?      ?zfailed with val z, type zformat raised exception (fmt='z', val=z, type=z, exc='z')N)r    bool_uint8uint16uint32uint64int8int16int32int64float16float32float64
longdouble	complex64
complex128clongdoubler   format
ValueErrorr   reprr   )testsfmatvalvaltypees        r   test_scalar_formatr[      s}   T288$E288$c288$eRYY'j")),*BII6dBGG$fbhh'k288,*BHH5c2::&c2::&c2::&c2==)h-h.h/!1E$ !&sG	FS)4;;ws|+D58'BD !&  	FE!49d7mSVEF F	Fs   ?7E99	G 4F;;G c                   ^    e Zd Zd Zd Zej                  j                  ed      d        Z	y)TestCommaDecimalPointLocalec                 x    t        t        t        j                  d            t        t	        d                   y N333333?)r   r   r    rM   r   selfs    r   test_locale_singlez.TestCommaDecimalPointLocale.test_locale_single   s!    SC)3uSz?;r   c                 x    t        t        t        j                  d            t        t	        d                   y r_   )r   r   r    doubler   ra   s    r   test_locale_doublez.TestCommaDecimalPointLocale.test_locale_double   s!    S3(#eCj/:r   ztest flaky on musllinux)reasonc                 x    t        t        t        j                  d            t        t	        d                   y )Nz1.2r`   )r   r   r    rO   r   ra   s    r   test_locale_longdoublez2TestCommaDecimalPointLocale.test_locale_longdouble   s$     	Su-.E#J@r   N)
__name__
__module____qualname__rc   rf   pytestmarkskipifr   ri    r   r   r]   r]      s;    <; [[8  :A:Ar   r]   )N) r5   rm   numpyr    numpy.testingr   r   r   numpy.core.tests._localesr   ior   r   r	   r!   rn   parametrizerM   re   rO   r   r"   rP   cdoublerR   r'   r3   r;   r>   r@   r[   r]   rp   r   r   <module>rw      s   
   8 8 = 
w6 

BIIr}}EFG GG* 

BIIr}}EF
G G
G bjj"..IJG KG2 2<<R^^"LM' N'29& 

BIIr}}EF5 G5 bjj"..IJ@ K@$FDA"9 Ar   