zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
U
O±dMã@südZddlZddlZddlmZmZddlmZmZm    Z    m
Z
ddl m Z m Z mZddlmZmZGdd„dƒZGd    d
„d
ƒZGd d „d ƒZGd d„dƒZGdd„dƒZGdd„dƒZGdd„dƒZGdd„dƒZdd„Zdd„Zdd„Zdd„Zdd „ZdS)!z$ Test functions for limits module.
 
éN)ÚfinfoÚiinfo)ÚhalfÚsingleÚdoubleÚ
longdouble)Ú assert_equalÚassert_Ú assert_raises)Ú_discovered_macharÚ    _float_mac@seZdZdd„ZdS)ÚTestPythonFloatcCs&ttƒ}ttƒ}tt|ƒt|ƒƒdS©N)rÚfloatrÚid©ÚselfÚftypeZftype2©rúVd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/core/tests/test_getlimits.pyÚtest_singletonszTestPythonFloat.test_singletonN©Ú__name__Ú
__module__Ú __qualname__rrrrrr sr c@seZdZdd„ZdS)ÚTestHalfcCs&ttƒ}ttƒ}tt|ƒt|ƒƒdSr)rrrrrrrrrszTestHalf.test_singletonNrrrrrrsrc@seZdZdd„ZdS)Ú
TestSinglecCs&ttƒ}ttƒ}tt|ƒt|ƒƒdSr)rrrrrrrrrszTestSingle.test_singletonNrrrrrrsrc@seZdZdd„ZdS)Ú
TestDoublecCs&ttƒ}ttƒ}tt|ƒt|ƒƒdSr)rrrrrrrrr szTestDouble.test_singletonNrrrrrrsrc@seZdZdd„ZdS)ÚTestLongdoublecCs&ttƒ}ttƒ}tt|ƒt|ƒƒdSr)rrrrrrrrr&szTestLongdouble.test_singletonNrrrrrr%src@seZdZdd„ZdS)Ú    TestFinfocCstttdddddgtjtjtjtjtjgƒƒ}|D]2\}}dD]$}tt    t
|ƒ|ƒt    t
|ƒ|ƒ|ƒq<q0t t t
dƒdS)NÚf2Úf4Zf8Zc8Zc16)ÚbitsZepsZepsnegZiexpZmachepÚmaxÚmaxexpÚminÚminexpZnegepZnexpÚnmantZ    precisionÚ
resolutionZtinyZsmallest_normalÚsmallest_subnormalÚi4) ÚlistÚzipÚnpÚfloat16Úfloat32Úfloat64Z    complex64Z
complex128rÚgetattrrr
Ú
ValueError©rZdtsZdt1Zdt2ÚattrrrrÚ
test_basic,sÿÿ  ÿzTestFinfo.test_basicN)rrrr5rrrrr+src@seZdZdd„Zdd„ZdS)Ú    TestIinfoc Cs†ttddddddddgtjtjtjtjtjtjtj    tj
gƒƒ}|D]2\}}d    D]$}t t t |ƒ|ƒt t |ƒ|ƒ|ƒqNqBttt d
ƒdS) NÚi1Úi2r*Úi8Úu1Úu2Zu4Úu8)r"r%r#r!)r+r,r-Zint8Úint16Úint32Úint64Zuint8Zuint16Zuint32Zuint64rr1rr
r2r3rrrr5:s( ÿÿþ  ÿzTestIinfo.test_basicc
CsPtjd}|D]<}tjdd|dƒ|dƒ}W5QRXtt|ƒj|ƒqdS)NZuintÚignore)Zoverré)r-ÚsctypesÚerrstaterrr#)rÚtypesÚTZmax_calculatedrrrÚtest_unsigned_maxEs
 
zTestIinfo.test_unsigned_maxN)rrrr5rFrrrrr69s r6c@seZdZdd„Zdd„ZdS)ÚTestReprcCsd}ttt tj¡ƒ|ƒdS)Nz)iinfo(min=-32768, max=32767, dtype=int16))rÚreprr-rr=©rÚexpectedrrrÚtest_iinfo_reprMszTestRepr.test_iinfo_reprcCsd}ttt tj¡ƒ|ƒdS)NzMfinfo(resolution=1e-06, min=-3.4028235e+38, max=3.4028235e+38, dtype=float32))rrHr-rr/rIrrrÚtest_finfo_reprQszTestRepr.test_finfo_reprN)rrrrKrLrrrrrGLsrGcCstdƒtdƒdS)Né
g@)rrrrrrÚtest_instancesWsrNcCsZ|j ¡D]J\}}t|t||ƒƒt|dƒr
t|jt||ƒjƒt|jt||ƒjƒq
dS)NÚshape)Ú__dict__Úitemsrr1ÚhasattrrOÚdtype)Z
discoveredÚma_likeÚkeyÚvaluerrrÚassert_ma_equal\s
 
rWc    CsÂtjtdftjtdftjtdffD]\}}tt|ƒ|ƒq(tjddttjƒ}W5QRXt     tj¡j
}|j |j fdkr˜|dkr˜t|tdƒn&|j |j fd    kr¾|dkr¾t|td
ƒdS) Néé é@r@©Úall©é?é@©é rXéP©épr_é€) r-r.r r/r0rWr rCrrSÚitemsizeÚitr$)rrTÚld_maÚbytesrrrÚtest_known_typeses   þ rjc    CsÌtjddttjƒ}W5QRXt tj¡j}tjdd†}t d¡|j    |j
fdkrx|dkrx|j t |ƒdks¾t ‚nF|j    |j
fd    kr¨|d
kr¨|j t |ƒdks¾t ‚n|j t |ƒdks¾t ‚W5QRXd S) z<Test that the subnormal is zero warning is not being raised.r@r[T)ÚrecordÚalwaysr]r`rrcrXN)r-rCr rrSrfÚwarningsÚcatch_warningsÚ simplefilterrgr$r)ÚlenÚAssertionError)rhriÚwrrrÚtest_subnormal_warningws
rscCsRtjdtjdD]8}t |¡}t|jdkƒt|jdkƒt|jdkƒqdS)NrÚcomplexrAéÿÿÿÿ)r-rBrr    r'r&r$)rÚinforrrÚtest_plausible_finfos
 
rw)Ú__doc__rmÚnumpyr-Z
numpy.corerrrrrrZ numpy.testingrr    r
Znumpy.core.getlimitsr r r rrrrrr6rGrNrWrjrsrwrrrrÚ<module>s&