
    Ph                      6   d Z ddlZddlZddlZddlmZmZ ddlmZm	Z	m
Z
mZ ddlmZmZmZ ddlmZmZ  G d d      Z G d	 d
      Z G d d      Z G d d      Z G d d      Zd Zd Z G d d      Z G d d      Z G d d      Zd Zd Zd Zd Z d Z!y)z$ Test functions for limits module.

    N)finfoiinfo)halfsingledouble
longdouble)assert_equalassert_assert_raises)_discovered_machar	_float_mac                       e Zd Zd Zy)TestPythonFloatc                 |    t        t              }t        t              }t        t        |      t        |             y N)r   floatr	   idselfftypeftype2s      jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\numpy/core/tests/test_getlimits.pytest_singletonzTestPythonFloat.test_singleton   s&    euRY6
+    N__name__
__module____qualname__r    r   r   r   r          ,r   r   c                       e Zd Zd Zy)TestHalfc                 |    t        t              }t        t              }t        t        |      t        |             y r   )r   r   r	   r   r   s      r   r   zTestHalf.test_singleton   s&    dtRY6
+r   Nr   r   r   r   r"   r"      r    r   r"   c                       e Zd Zd Zy)
TestSinglec                 |    t        t              }t        t              }t        t        |      t        |             y r   )r   r   r	   r   r   s      r   r   zTestSingle.test_singleton   &    fvRY6
+r   Nr   r   r   r   r%   r%      r    r   r%   c                       e Zd Zd Zy)
TestDoublec                 |    t        t              }t        t              }t        t        |      t        |             y r   )r   r   r	   r   r   s      r   r   zTestDouble.test_singleton!   r'   r   Nr   r   r   r   r)   r)       r    r   r)   c                       e Zd Zd Zy)TestLongdoublec                 |    t        t              }t        t              }t        t        |      t        |             y r   )r   r   r	   r   r   s      r   r   zTestLongdouble.test_singleton'   s(    j!z"RY6
+r   Nr   r   r   r   r,   r,   &   r    r   r,   c                 f    dD ],  }t        t        | |      t        ||      d|  d| d|        . y )N)bitsepsepsnegiexpmachepmaxmaxexpminminexpnegepnexpnmant	precision
resolutiontinysmallest_normalsmallest_subnormalzfinfo instances  and  differ on r	   getattr)f1f2attrs      r   assert_finfo_equalrG   ,   sA    : 	WR&D(9't5KvF	H	:r   c                 f    dD ],  }t        t        | |      t        ||      d|  d| d|        . y )N)r/   r6   r4   ziinfo instances r@   rA   rB   )i1i2rF   s      r   assert_iinfo_equalrK   5   s=    &WR&D(9't5KvF	H 'r   c                       e Zd Zd Zd Zd Zy)	TestFinfoc           
      B   t        t        g dt        j                  t        j                  t        j
                  t        j                  t        j                  g            }|D ]#  \  }}t        t        |      t        |             % t        t        t        d       y )N)rE   f4f8c8c16i4)listzipnpfloat16float32float64	complex64
complex128rG   r   r   
ValueErrorr   dtsdt1dt2s       r   
test_basiczTestFinfo.test_basic<   sk    36

BJJ

BLL'( ) HCuSz5:6  	j%.r   c                     t        j                  t        j                  d            }t        j                  t        j                  d            }||k7  sJ y )Ng      ?)rV   r   rX   rY   )r   rD   rE   s      r   test_regression_gh23108z!TestFinfo.test_regression_gh23108E   s;     XXbjjo&XXbjjo&Rxxr   c                      G d d      } |       }t        j                  |      t        j                  |j                        k(  sJ y )Nc                   4    e Zd ZdZ ej
                  d      Zy)?TestFinfo.test_regression_gh23867.<locals>.NonHashableWithDtypeNrX   )r   r   r   __hash__rV   dtyper   r   r   NonHashableWithDtyperf   M   s    HBHHY'Er   ri   )rV   r   rh   )r   ri   xs      r   test_regression_gh23867z!TestFinfo.test_regression_gh23867L   s9    	( 	( !"xx{bhhqww////r   N)r   r   r   ra   rc   rk   r   r   r   rM   rM   ;   s    /0r   rM   c                       e Zd Zd Zd Zy)	TestIinfoc                    t        t        g dt        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  g            }|D ]#  \  }}t        t        |      t        |             % t        t        t        d       y )N)rI   rJ   rS   i8u1u2u4u8rO   )rT   rU   rV   int8int16int32int64uint8uint16uint32uint64rK   r   r   r\   r]   s       r   ra   zTestIinfo.test_basicV   s    3 +77BHHbhh88RYY		299>? @ HCuSz5:6  	j%.r   c                     t         j                  d   }|D ]Q  }t        j                  d      5   |d       |d      z
  }d d d        t        t	        |      j
                         S y # 1 sw Y   +xY w)Nuintignore)overr      )rV   sctypeserrstater	   r   r4   )r   typesTmax_calculateds       r   test_unsigned_maxzTestIinfo.test_unsigned_max`   sU    

6"A(+!"1! ,q~6 ++s   A++A4	N)r   r   r   ra   r   r   r   r   rm   rm   U   s    /7r   rm   c                       e Zd Zd Zd Zy)TestReprc                 t    d}t        t        t        j                  t        j                              |       y )Nz)iinfo(min=-32768, max=32767, dtype=int16))r	   reprrV   r   ru   r   expecteds     r   test_iinfo_reprzTestRepr.test_iinfo_reprh   s#    >T"((288,-x8r   c                 t    d}t        t        t        j                  t        j                              |       y )NzMfinfo(resolution=1e-06, min=-3.4028235e+38, max=3.4028235e+38, dtype=float32))r	   r   rV   r   rX   r   s     r   test_finfo_reprzTestRepr.test_finfo_reprl   s%    8T"((2::./:r   N)r   r   r   r   r   r   r   r   r   r   g   s    9;r   r   c                     t         t        j                  t        j                  t        j                  fD ]*  } t        |       }t         | d            }t        ||       , t        t        j                  t        j                  t        j                  fD ]*  } t        |       }t         | d            }t        ||       , t        j                  t              5  t        d       d d d        t        j                  t              5  t        d       d d d        t        j                  t              5  t        t        j                  d             d d d        y # 1 sw Y   wxY w# 1 sw Y   VxY w# 1 sw Y   y xY w)N   g333333?g      $@hir   )intrV   ru   rv   rw   r   rK   r   rW   rX   rY   r   rG   pytestraisesr\   )cclass_iinfoinstance_iinfoclass_finfoinstance_finfos        r   test_instancesr   r   s     288RXXrxx0Ahqu;7	 1 RZZRZZ8Ahqv;7 9
 
z	"c
 
# 
z	"d 
# 
z	"bhhqk 
#	" 
#	" 
#	" 
#	"s$   E	E*6E6E'*E36E?c                 6   | j                   j                         D ]|  \  }}t        |t        ||             t	        |d      s)t        |j
                  t        ||      j
                         t        |j                  t        ||      j                         ~ y )Nshape)__dict__itemsr	   rC   hasattrr   rh   )
discoveredma_likekeyvalues       r   assert_ma_equalr      sp     ))//1
UUGGS125'"ggs&;&A&ABggs&;&A&AB	 2r   c                     t         j                  t        d   ft         j                  t        d   ft         j                  t        d   ffD ]  \  } }t        t        |       |        t        j                  d      5  t        t         j                        }d d d        t        j                  t         j                        j                  }j                  |j                  fdk(  r|dv rt        |t        d          y |j                  |j                  fd	k(  r|dk(  rt        |t        d
          y y y # 1 sw Y   xY w)N       @   r~   all?    @  r   r   P   p   r      )rV   rW   r   rX   rY   r   r   r   r   rh   itemsizeitr5   )r   r   ld_mabytess       r   test_known_typesr      s    JJ	"6JJ	"6JJ	"68w 	*517;8
 
	""2==1 
#HHR]]#,,E%,,;.5H3Dy}-
((ELL	!\	1erky~. 7B	1 
#	"s   >D66D?c                     t        j                  d      5  t        t         j                        } ddd       t        j                  t         j                        j
                  }t        j                  d      5 }t        j                  d        j                  | j                  fdk(  r |dv r| j                   t        |      d	k(  sZJ | j                  | j                  fd
k(  r!|dk(  r| j                   t        |      d	k(  sJ | j                   t        |      d	k(  sJ ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)z<Test that the subnormal is zero warning is not being raised.r~   r   NT)recordalwaysr   r   r   r   r   )rV   r   r   r   rh   r   warningscatch_warningssimplefilterr   r5   r?   len)r   r   ws      r   test_subnormal_warningr      s    		""2==1 
#HHR]]#,,E		 	 	-h'HHell#{2u7H$$q6Q;;hh%5%2+$$q6Q;; $$q6Q;; 
.	- 
#	" 
.	-s   D.<B)D:.D7:Ec                     t         j                  d   t         j                  d   z   D ]_  } t        j                  |       }t        |j                  dkD         t        |j
                  dk         t        |j                  dkD         a y )Nr   complexr   )rV   r   r   r
   r:   r7   r5   )r   infos     r   test_plausible_finfor      sa    G$rzz)'<<xx

Qb !a 	 =r   )"__doc__r   numpyrV   r   
numpy.corer   r   r   r   r   r   numpy.testingr	   r
   r   numpy.core.getlimitsr   r   r   r"   r%   r)   r,   rG   rK   rM   rm   r   r   r   r   r   r   r   r   r   <module>r      s       # 2 2 > > >, ,, ,, ,, ,, ,HH0 047 7$; ;2C/$,!r   