python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_cmath.cpython-312.opt-1.pyc

͑e0^ddlmZmZmZddlmZmZddlmZddlZddl	Z	ddl
Z
ddl	mZmZm
Z
mZddlZddlZedZedZdDcgc]}dD]}e||
c}}Zedfed	feefd	efdefd
efdefeefed	fedfed
fedfeefdefd
efdefd	efeefedfed
ffDcgc]\}}e||c}}Zeefedfed
fedfed	feefeefdefd
efdefd	efeeffDcgc]\}}e||c}}ZGdd
ej0ZGddej4Zedk(rej8yycc}}wcc}}wcc}}w))requires_IEEE_754cpython_only
import_helper)parse_testfile	test_fileN)phasepolarrectpiinfnan)rffffff@rffffffc
eZdZdDcgc]}tt|c}}}}Zej
dej
ddZdZdZ	dZ
		dd	Zd
ZdZ
dZd
ZdZedZdZdZedZdZdZedZdZdZdZdZdZedZedZ edZ!ycc}}}}w)
CMathTests)acosacoshasinasinhatanatanhcoscoshexploglog10sinsinhsqrttantanhc.tj|dS)Ny@cmathrxs C/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_cmath.py<lambda>zCMathTests.<lambda>;sUYYq*%=c.tjd|S)Ny,@;r%r's r)r*zCMathTests.<lambda><sUYYw%:r+c0ttd|_y)Nzutf-8)encoding)openrtest_valuesselfs r)setUpzCMathTests.setUp>s	G<r+c8|jjyN)r0closer1s r)tearDownzCMathTests.tearDownAs r+cpd}tj|stj|r+tj|rTtj|r?y||k(r9|dk7rytjd|tjd|k(ry|dz
}|j|j	||y)a#Fail unless floats x and y are identical, in the sense that:
        (1) both x and y are nans, or
        (2) both x and y are infinities, with the same sign, or
        (3) both x and y are zeros, with the same sign, or
        (4) x and y are both finite and nonzero, and x == y

        z&floats {!r} and {!r} are not identicalNr?z: zeros have different signs)mathisnancopysignfailformat)r2r(ymsgs    r)assertFloatIdenticalzCMathTests.assertFloatIdenticalDs7::a=DJJqMzz!}A
!VCxsA&$--Q*??55		#**Q"#r+c|j|j|j|j|j|jy)zFail unless complex numbers x and y have equal values and signs.

        In particular, if x and y both have real (or imaginary) part
        zero, but the zeros have different signs, this test will fail.

        N)rArealimag)r2r(r?s   r)assertComplexIdenticalz!CMathTests.assertComplexIdentical[s4	
!!!&&!&&1!!!&&!&&1r+Nctj|r:tj|ry|j|xsdj|tj|r+||k(ry|j|xsdj|||sT|sRtj
d|tj
d|k7r%|j|xsdj||	t
||z
}|t||t
|zkry|j|xsdj||y#t$rY1wxYw)aFail if the two floating-point numbers are not almost equal.

        Determine whether floating-point values a and b are equal to within
        a (small) rounding error.  The default values for rel_err and
        abs_err are chosen to be suitable for platforms where a float is
        represented by an IEEE 754 double.  They allow an error of between
        9 and 19 ulps.
        Nz{!r} should be nanz>finite result where infinity expected: expected {!r}, got {!r}r9z,zero has wrong sign: expected {!r}, got {!r}z({!r} and {!r} are not sufficiently close)	r:r;r=r>isinfr<absmax
OverflowError)r2abrel_errabs_errr@absolute_errors       r)rAssertAlmostEqualzCMathTests.rAssertAlmostEquales"::a=zz!}IIc;188;<::a=AvIIc=006q!
>}}R#t}}R';;		#2"%%+VAq\3
	 1XNWgA.>!??		#J<CCAqI	K		s'D77	EEc	d}d}|jtj|ddjtj||jtj|ddjtj|y)NgiW
@g-DT!	@	zcmath.pi is {}; should be {})placesr@zcmath.e is {}; should be {})assertAlmostEqualr&rr>e)r2
e_expectedpi_expecteds   r)test_constantszCMathTests.test_constantssp+
,uxxQ.55ehhL		Nuww
1-44UWWjI		Kr+c\|jtjjtj|jtjj
d|jtjjd|jtjj
tj|jt	jtjj|jtjj
d|jtjjd|jt	jtjj
|jt	jdtjjd|jt	jdtjj
d|jt	jdtjjd|jt	jdtjj
d|jttjd|jttjd|jttjd|jttjdy)Nrr9rinfjr
nanj)
assertEqualr&rrCr:rDrZ
assertTruer;r
r[r<reprr1s r)test_infinity_and_nan_constantsz*CMathTests.test_infinity_and_nan_constantss2-#.$((3

599>>23-#.

5::??34r599>>:B?r599>>:B?r5::??;R@r5::??;R@	
eii%0ejj)62eii%0ejj)62r+c
B
dd
dddddttg}Gdd}Gd	d
tGfdd}Gd
dt}Gdd}Gdd}G
fdd}G
fdd}|jD]}	|j	|	||	|j	|	||	|j	|	||	
|j	|	||	t||j
t|	||j
t|	||D]}
|j
t|	||
!|j
|	|y)Nyz@7Ă??g]ֆznot complex@ceZdZdZdZy).CMathTests.test_user_object.<locals>.MyComplexc||_yr5value)r2rhs  r)__init__z7CMathTests.test_user_object.<locals>.MyComplex.__init__s	"
r+c|jSr5rgr1s r)__complex__z:CMathTests.test_user_object.<locals>.MyComplex.__complex__szz!r+N)__name__
__module____qualname__rirkr+r)	MyComplexres
#
"r+rpceZdZy)2CMathTests.test_user_object.<locals>.SomeExceptionNrlrmrnror+r)
SomeExceptionrrr+rtceZdZfdZy)7CMathTests.test_user_object.<locals>.MyComplexExceptioncr5ro)r2rts r)rkzCCMathTests.test_user_object.<locals>.MyComplexException.__complex__s	##r+N)rlrmrnrk)rtsr)MyComplexExceptionrws
$r+ryceZdZy);CMathTests.test_user_object.<locals>.NeitherComplexNorFloatNrsror+r)NeitherComplexNorFloatr{rur+r|ceZdZdZdZy)*CMathTests.test_user_object.<locals>.IndexcyNror1s r)__int__z2CMathTests.test_user_object.<locals>.Index.__int__ar+cyrror1s r)	__index__z4CMathTests.test_user_object.<locals>.Index.__index__sr+N)rlrmrnrrror+r)Indexr~s')r+rceZdZdZy)*CMathTests.test_user_object.<locals>.MyIntcyrror1s r)rz2CMathTests.test_user_object.<locals>.MyInt.__int__rr+N)rlrmrnrror+r)MyIntrs'r+rc"eZdZfdZfdZy)4CMathTests.test_user_object.<locals>.FloatAndComplexcSr5ror2flt_args r)	__float__z>CMathTests.test_user_object.<locals>.FloatAndComplex.__float__r+cSr5ro)r2cx_args r)rkz@CMathTests.test_user_object.<locals>.FloatAndComplex.__complex__s
r+N)rlrmrnrrk)rrsr)FloatAndComplexrs


r+rceZdZfdZy).CMathTests.test_user_object.<locals>.JustFloatcSr5rors r)rz8CMathTests.test_user_object.<locals>.JustFloat.__float__rr+N)rlrmrnr)rsr)	JustFloatrs
r+r)objectNotImplemented	Exceptiontest_functionsr\intassertRaises	TypeError)r2
non_complexesrpryr|rrrrfbad_complexrtrrs           @@@r)test_user_objectzCMathTests.test_user_objectsw,'1b$>3
	"	"	I		$	$
	V		*	*	(	(
		
		$$	FAQy011V9=Q011V9=Qy{^QwZ8QuwZ3uw<9
i,B,DEiEG4,
H!!)Q	+0FG
H
mQ0B0DE!	Fr+c	|jD]5}dD].}|j||||j07|jD] }dD]}|jt||"y)N)rrc)rKlong_string01j)rr\rrr)r2rargs   r)test_input_typezCMathTests.test_input_types$$	=A
=  33==?);<
=	=
$$	5A:
5!!)Q4
5	5r+cgd}||Dcgc]}|c}zgdz}|dgz|Dcgc]}d|z	c}z}dg|z}dg|z|Dcgc]}|c}z}|||||||||||||d
}|jD]r\}}	tt|}
tt|}|	D]H}||}
|j	|
||
j
|j
d|
jJtdD]k}|D]d}tj||}
|j	tj|||
j
|j
d|
jfmycc}wcc}wcc}w)N)g{Gz?g?g??g?gGz?)rr9r9r)
rrrrrrrrrr r!r"r#)rrcg$@)	itemsgetattrr:r&rPrCr\rDr)r2r0r(
unit_intervalpositivenonnegative	real_linerfnvaluesfloat_fn
complex_fnvzbases               r)test_cmath_matches_mathz"CMathTests.test_cmath_matches_maths
7$;&?ar&??
"%{(C!A(CCdXoD8O8&<ar&<<	#" 
 )..0	-JBtR(H +J
-qM''QVV<  QVV,
-	-#	-D
-IIa&''D(9166B  QVV,
-	-E'@)D'=s
EE!
E&cHdh}d}tjdk(r@tjd}	tt	t
|j
d}d}d}ttD]\}}}}	}
}}t||	}
t|
|}|
|dkr||vr0|dk(r|}n|d	k(r|}ntt|}d
|vsd|vr,	||
}|jdj||||	d
|vr,	||
}|jdj||||	||
}d|vrRtt!|j"|j$}tt!|j"|j$}d|vrRt|j"t!|j$}t|j"t!|j$}|dvrd}nd}dj||||	|j"|j$|j"|j$}|j'|j"|j"|||j'|j$|j$|y#t$rY'wxYw#t$rY"wxYw#t$rY2wxYw)Ntan0064darwinr.cVtj|j|jS)zaWrapped version of rect that accepts a complex number instead of
            two float arguments.)r&r
rCrDrs r)rect_complexz5CMathTests.test_specific_values.<locals>.rect_complexEs::affaff--r+c$tt|S)zYWrapped version of polar that returns a complex number instead of
            two floats.)complexr	rs r)
polar_complexz6CMathTests.test_specific_values.<locals>.polar_complexJsE!H%%r+)
rbr
r	zdivide-by-zeroinvalidz9ValueError not raised in test {}: {}(complex({!r}, {!r}))overflowz<OverflowError not raised in test {}: {}(complex({!r}, {!r}))zignore-real-signzignore-imag-sign)rrV瞯<
z{}: {}(complex({!r}, {!r}))
Expected: complex({!r}, {!r})
Received: complex({!r}, {!r})
Received value insufficiently close to expected value.)rNr@)r@)sysplatformmac_vertuplemaprsplit
ValueErrorrrrrr&r=r>rJrHrCrDrP)r2
SKIP_ON_TIGERosx_versionversion_txtrridraraiereiflagsrexpectedfunctionactualreal_abs_err
error_messages                   r)test_specific_valueszCMathTests.test_specific_values7s#
<<8#"**,Q/K
#C[->->s-C$DE	.
	&
.<I-F=	;)BBBE"b/Cr2H&;+@&V|'w("5"-5(I,>P%c]FII88>r2r28NPU"P%c]FII88>r2r28NPc]F!U* V[[!16;;?"3x}}#5x}}E!U* c&++.>?"8==#hmm2DE%%$%I&RR]]HMM[[&++/

##HMM6;;0<,9
$
;
##HMM6;;,9
$
;y=	;

>"%s5(I4J7J4	JJ	JJ	J! J!cfd}|dd|dd|ddtf|ddtd	zf|d
dtd	zftd}|t|d|d
f|t|d|tf|td||td	zf|td||td	zf|t|||tdzf|t|||tdzf|t|||dtzdzf|t|||dtzdzftd}|t|d||f|td|||f|t||||f|t||||f|t||||f|t||||f|t||||fy)Ncb|}t||D]\}}j||yr5)ziprP)rrgotrUgfuncr2s     r)checkz%CMathTests.check_polar.<locals>.checks6s)CHc*
.1''1-
.r+r)rrra)r9rr9?ryg@rrrbr
)rfloatr)r2rrrr
s``   r)check_polarzCMathTests.check_polars	.	a
a
b2r(
b2rAv,
cBa=!El
gc1oRy)
gsdAb	*
gaoR!V}-
ga#rcAg/
gc3#rAv/
gcC4 3a.1
gsdC 3B
"34
gsdSD!Cb1#56El
gc1oSz*
gaoSz*
gc3#s,
gc3#s,
gsdC 3*-
gc3#s,
gcC4 3*-r+c.|jtyr5)rr	r1s r)
test_polarzCMathTests.test_polarsr+c\tjdfd}|j|y)N	_testcapicjd	t|jdS#jdwxYw)Nr)	set_errnor	)rrs r)polar_with_errno_setz9CMathTests.test_polar_errno.<locals>.polar_with_errno_sets:#
'Qx##A&	##A&s	
0A)r
import_moduler)r2rrs  @r)test_polar_errnozCMathTests.test_polar_errnos+"//<		'	
-.r+c
|jtdd|jtdd|jtdt|jtdt|jtdt|jtdtdz|jtd	tdz|jtt	ddd|jtt	dd
d
|jtt	d
dt|jtt	d
d
t|jtt	t
d
t|jtt	t
dt|jtt	t
t
dtz|jtt	dt
tdz|jtt	d
t
tdz|jtt	dt
tdz|jtt	d
t
tdz|jtt	t
t
tdz|jtt	t
dd
|jtt	t
d
d
|jtt	t
dd|jtt	t
d
d|jtt	t
t
tdz|jtt	d
t
tdz|jtt	dt
tdz|jtt	d
t
tdz|jtt	dt
tdz|jtt	t
t
dtz|jtt	t
d
t|jtt	t
dttD]/}|jtjt|1y)Nrrr9ryYnyYnrryrrgrrg?)
rTrrr\rINFcomplex_nansr]r:r;r2rs  r)
test_phasezCMathTests.test_phasesuQx,uRy"-uSz2.u[126u[1B37uRy"Q$/uSzB3q51	
wsC0137wsD12D9wtS12B7wtT23bS9	
uWcT4%89B3?uWcT4%89B3?uWcTC4%8958DuWTC4%89B3q5AuWTC4%89B3q5AuWS3$%782#a%@uWS3$%782#a%@uWS3$%782#a%@wsD12D9wsD12D9wsC0137wsC0137uWS#%67A>uWS#%67A>uWS#%67A>uWT3%78"Q$?uWT3%78"Q$?uWcT3%78$r'BuWcT3%78"=uWcT3%78"=	2AOODJJuQx01	2r+c
^tD]}|jt|dtD]!}|jt|t#|jttttt|jtjtttd|jtjtttd|jtjtttd|jtjtttd|jttttt|jttttt|jtjttdt|jtjttdt|jtjttdt|jtjttdt|jttttt|jtjtttty)Nrrrr)

complex_zerosr\rHcomplex_infinitiesrrNANr]r:r;rs  r)test_abszCMathTests.test_abss	*ASVS)	*$	*ASVS)	*	
WS3$/0#6

3wsD'9#:;<

3wsD'9#:;<

3wsC'8#9:;

3wsC'8#9:;WS#./5WcT3/0#6

3wtS'9#:;<

3wtS'9#:;<

3wsC'8#9:;

3wsC'8#9:;WS#./5

3wsC'8#9:;r+cN|jtttddy)NgU)rrJrHrr1s r)test_abs_overflowszCMathTests.test_abs_overflowss	
-ggw.GHr+cd}t|j|dz
|kDst|j|dz
|kDr|j||fyy)NgHz>rra)rHrCrDr=)r2rKrLepss    r)assertCEqualzCMathTests.assertCEqualsNqvv!}#s166AaD='9C'?IIq!f(@r+cD|jtddd|jtddd|jtdtd|jtdtdzd|jtdtdzdy)	Nr)rrra)r9r)rrr)rr9)rr)rr
rr1s r)	test_rectzCMathTests.test_rects|$q!*f-$q!*g.$q2#,1$q"Q$-1$q2#a%.(3r+c	tdddddtdtdg}|D]d}|D]]}t||}|jtj|tj|xrtj|_fy)Nz-infrrrrrr
)rrr\r&isfiniter:)r2	real_valsr(r?rs     r)
test_isfinitezCMathTests.test_isfinites6]D$#uU|U5\;		IA
IAqM  !2"&--"2"Gt}}Q7GI
I	Ir+c@|jtjd|jtjd|jtjt|j	tjt
|j	tjt
t
d|j	tjt
dt
|j	tjt
t
t
|j	tjt
t
t|j	tjt
tt
yNrarr)assertFalser&r;rr]rrr1s r)
test_isnanzCMathTests.test_isnanQ(R)S)*C()GCO45GAsO45GC$567GC$567GC$567r+c@|jtjd|jtjd|jtjt|j	tjt
|j	tjt
t
d|j	tjt
dt
|j	tjt
t
t
|j	tjt
tt
|j	tjt
t
tyr)rr&rGrr]rrr1s r)
test_isinfzCMathTests.test_isinf rr+cdtD]'}|jtj||)yr5)rrEr&r#rs  r)testTanhSignzCMathTests.testTanhSign+)	:A''

1
q9	:r+cdtD]'}|jtj||)yr5)rrEr&rrs  r)testAtanSignzCMathTests.testAtanSign4rr+cdtD]'}|jtj||)yr5)rrEr&rrs  r)
testAtanhSignzCMathTests.testAtanhSign9s)	;A''A:	;r+)rrN)"rlrmrnrr&rappendr3r7rArErPrXr_rrrrrrrrrrrrrr	r
rrrrr).0fnamerr&s0000r)rr4s9:#$$geU+$N
=>:;=!$.2CI#0KdK3,DFL
5.-`T;T;l.8 	/	/'2R<2II
4I	8	8::::;;I$sB:
rc<eZdZejZdZdZdZdZy)IsCloseTestscz|jt5|jdddddd|jt5|jdddddd|jt5|jdddddddy#1swYoxYw#1swYIxYw#1swYyxYw)Nrrel_tolabs_tol)r#r%)rriscloser1s r)test_reject_complex_tolerancesz+IsCloseTests.test_reject_complex_tolerancesBs


y
)	-LLRL,	-

y
)	-LLRL,	-

y
)	9LLRRL8	9	9
	-	-	-	-	9	9s#BB%:B1B"%B.1B:cXgd}|j|d|j|dy)N))??y??)r)y??)y?y?)y?y?g-q=r"gvIh%<=)assertAllCloseassertAllNotClose)r2complex_exampless  r)test_complex_valuesz IsCloseTests.test_complex_valuesLs4	
,e</?r+cgd}|j|d|j|d|jddd|jdddy)	N))yMbP?r)MbP?r)MbP?MbP?r)yMbPMbP?r)MbP?MbPr)yMbPMbPrg~jtX?r$gMb@?r1r0gMb`?r/)r*r+
assertIsCloseassertIsNotClose)r2near_zero_exampless  r)test_complex_near_zeroz#IsCloseTests.test_complex_near_zeroWs^ 	
.@17C<uElL%Hr+cB|jttdz|jtdzt|jtt|jtt|jdt|jdtdzy)Nrr)r3rr1s r)test_complex_specialz!IsCloseTests.test_complex_specialgsrc3r6*c"fc*cC4(sdC(a%aR(r+N)	rlrmrnr&r&r'r-r5r7ror+r)r r ?s!mmG9	@I )r+r __main__)test.supportrrrtest.test_mathrr	test_mathunittestr&r:rr	r
rrrrrrrrrrTestCaserr rlmain)r(r?s00r)<module>r?sGG4"((
ElEl(3I1[IAII
	c
	c
	c
	c
	c
	
s	
s

s

s

s

t

t

t	
t	
t	sd	sd	sd	d	d)1
1gam.

sd	d	d	c
	c
	c


s	
s	
s	c
	c
	c

+

$!Q1

H;""H;V.)9)).)bzHMMOEJ,
sE6E8E