python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_cmath.cpython-311.opt-1.pyc

e`@ddlmZmZmZddlmZmZddlmZddlZddl	Z	ddl
Z
ddl	mZmZm
Z
mZddlZddlZedZedZddDZd	ed
fedfeefdefd
efdefd
efeefedfed
fedfed
feefd
efdefd
efdefeefed
fedffDZdeefed
fedfed
fedfeefeefd
efdefd
efdefeeffDZGddejZGddejZedkrejdSdS))requires_IEEE_754cpython_only
import_helper)parse_testfile	test_fileN)phasepolarrectpiinfnanc8g|]}dD]}t||S)complex.0xys   C/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_cmath.py
<listcomp>rs-III1[IIAIIIIrc4g|]\}}t||Srrs   rrrs01gammrrffffff@rffffffc4g|]\}}t||Srrrs   rrr%s0


$!Q1




rczeZdZddDZededdZdZdZdZ		d!dZ	d
Z
dZdZdZ
dZedZdZdZedZdZdZedZdZdZdZdZdZedZedZed ZdS)"
CMathTestsc8g|]}tt|Sr)getattrcmath)rfnames  rrzCMathTests.<listcomp>6s.$$$geU++$$$r)acosacoshasinasinhatanatanhcoscoshexploglog10sinsinhsqrttantanhc,tj|dS)Ny@r$r/rs r<lambda>zCMathTests.<lambda>;sUYq*%=%=rc,tjd|S)Ny,@;r7r8s rr9zCMathTests.<lambda><sUYw%:%:rc<ttd|_dS)Nzutf-8)encoding)openrtest_valuesselfs rsetUpzCMathTests.setUp>s	G<<<rc8|jdSN)r>closer?s rtearDownzCMathTests.tearDownAs     rcd}tj|stj|r+tj|rtj|rdSnA||kr;|dkrdStjd|tjd|krdS|dz
}||||dS)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)r@rrmsgs    rassertFloatIdenticalzCMathTests.assertFloatIdenticalDs7:a==
	6DJqMM
	6z!}}
A

!VVCxxsA&&$-Q*?*???55		#**Q""#####rc||j|j||j|jdS)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)rNrealimag)r@rrs   rassertComplexIdenticalz!CMathTests.assertComplexIdentical[s>	
!!!&!&111!!!&!&11111rV瞯<
Nctj|r@tj|rdS||pd|tj|r3||krdS||pd|||sY|sWtjd|tjd|kr+||pd||	t
||z
}|t||t
|zkrdSn#t$rYnwxYw||pd||dS)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}rGz,zero has wrong sign: expected {!r}, got {!r}z({!r} and {!r} are not sufficiently close)	rHrIrKrLisinfrJabsmax
OverflowError)r@abrel_errabs_errrMabsolute_errors       rrAssertAlmostEqualzCMathTests.rAssertAlmostEquales:a==	=z!}}
IIc;188;;<<<:a==	>AvvIIc=006q!
>
>
>	3	3}R##t}R';';;;		#2"%%+VAq\\333
	 1XXNWgA.>!?!???@			D		
		#J<CCAqII	K	K	K	K	Ks8D11
D>=D>c	d}d}|tj|ddtj||tj|ddtj|dS)NgiW
@g-DT!	@	zcmath.pi is {}; should be {})placesrMzcmath.e is {}; should be {})assertAlmostEqualr$rrLe)r@
e_expectedpi_expecteds   rtest_constantszCMathTests.test_constantss+
,uxQ.55ehLL		N	N	Nuw
1-44UWjII		K	K	K	K	Krc*|tjjtj|tjjd|tjjd|tjjtj|t	jtj	j|tj	jd|tj
jd|t	jtj
j|ttjd|ttjd|ttj	d|ttj
ddS)Nrrinfjr
nanj)assertEqualr$rrPrHrQri
assertTruerIr
rjreprr?s rtest_infinity_and_nan_constantsz*CMathTests.test_infinity_and_nan_constantssf222---#...$(333
59>22333---#...
5:?33444	
ei%000ej))6222ei%000ej))622222rc
dddddddttg}Gddt}Gd	d
}GddtGfd
dt}Gfdd}Gddt}Gdd}Gdd}Gdd}	Gfddt}
Gfdd}Gfddt}Gfdd }
|jD]c}|||||||||||
||||||||||||
|||||t||t|||t||	|t|||D]L}|t||||t|||M||||||edS)!Nyz@7Ă??g]ֆznot complex@ceZdZdZdZdS).CMathTests.test_user_object.<locals>.MyComplexc||_dSrCvaluer@rws  r__init__z7CMathTests.test_user_object.<locals>.MyComplex.__init__
"


rc|jSrCrvr?s r__complex__z:CMathTests.test_user_object.<locals>.MyComplex.__complex__
z!rN__name__
__module____qualname__ryr|rrr	MyComplexrt2
#
#
#
"
"
"
"
"rrceZdZdZdZdS)0CMathTests.test_user_object.<locals>.MyComplexOSc||_dSrCrvrxs  rryz9CMathTests.test_user_object.<locals>.MyComplexOS.__init__rzrc|jSrCrvr?s rr|z<CMathTests.test_user_object.<locals>.MyComplexOS.__complex__r}rNr~rrrMyComplexOSrrrrceZdZdS)2CMathTests.test_user_object.<locals>.SomeExceptionNrrrrrr
SomeExceptionrDrrceZdZfdZdS)7CMathTests.test_user_object.<locals>.MyComplexExceptioncrCrr@rs rr|zCCMathTests.test_user_object.<locals>.MyComplexException.__complex__	##rNrrrr|rsrMyComplexExceptionr.
$
$
$
$
$
$
$rrceZdZfdZdS)9CMathTests.test_user_object.<locals>.MyComplexExceptionOScrCrrs rr|zECMathTests.test_user_object.<locals>.MyComplexExceptionOS.__complex__rrNrrsrMyComplexExceptionOSrrrrceZdZdS);CMathTests.test_user_object.<locals>.NeitherComplexNorFloatNrrrrNeitherComplexNorFloatrrrrceZdZdS)=CMathTests.test_user_object.<locals>.NeitherComplexNorFloatOSNrrrrNeitherComplexNorFloatOSrrrrceZdZdZdZdS)*CMathTests.test_user_object.<locals>.IndexcdSNrr?s r__int__z2CMathTests.test_user_object.<locals>.Index.__int__aarcdSrrr?s r	__index__z4CMathTests.test_user_object.<locals>.Index.__index__srN)rrrrrrrrIndexrs"''')))))rrceZdZdZdS)*CMathTests.test_user_object.<locals>.MyIntcdSrrr?s rrz2CMathTests.test_user_object.<locals>.MyInt.__int__rrN)rrrrrrrMyIntrs'''''rrc$eZdZfdZfdZdS)4CMathTests.test_user_object.<locals>.FloatAndComplexcSrCrr@flt_args r	__float__z>CMathTests.test_user_object.<locals>.FloatAndComplex.__float__rcSrCrr@cx_args rr|z@CMathTests.test_user_object.<locals>.FloatAndComplex.__complex__
rNrrrrr|rrsrFloatAndComplexrG











rrc$eZdZfdZfdZdS)6CMathTests.test_user_object.<locals>.FloatAndComplexOScSrCrrs rrz@CMathTests.test_user_object.<locals>.FloatAndComplexOS.__float__rrcSrCrrs rr|zBCMathTests.test_user_object.<locals>.FloatAndComplexOS.__complex__rrNrrsrFloatAndComplexOSrrrrceZdZfdZdS).CMathTests.test_user_object.<locals>.JustFloatcSrCrrs rrz8CMathTests.test_user_object.<locals>.JustFloat.__float__rrNrrrrrsr	JustFloatr.






rrceZdZfdZdS)0CMathTests.test_user_object.<locals>.JustFloatOScSrCrrs rrz:CMathTests.test_user_object.<locals>.JustFloatOS.__float__rrNrrsrJustFloatOSrrrr)objectNotImplemented	Exceptiontest_functionsrkintassertRaises	TypeError)r@
non_complexesrrrrrrrrrrrrfbad_complexrrrs                @@@rtest_user_objectzCMathTests.test_user_objects,'1b$>3
	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"					I				$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$
					V												*	*	*	*	*	*	*	*	(	(	(	(	(	(	(	(
								f			
											
																				$	H	HAQQyy001111V99===QQ{{62233QQvYY???QQ001111V99===QQ002233QQvYY???QQyy{{^^QQwZZ888QQ{{}}--qqzz:::QQuuwwZZ3uuww<<999
i,B,B,D,DEEEiEEGG444i,D,D,F,FGGG,
J
J!!)Q		+0F0FGGG!!)QK0H0HIIIImQ0B0B0D0DEEEmQ0D0D0F0FGGGG1	H	Hrc	|jD]A}dD]<}|||||=B|jD]#}dD]}|t||$dS)N)rrr)rZlong_string01j)rrkrrr)r@rargs   rtest_input_typezCMathTests.test_input_types$	=	=A
=
=  33==??););<<<<
=$	5	5A:
5
5!!)Q4444
5	5	5rcgd}|d|Dzgdz}|dgzd|Dz}dg|z}dg|zd|Dz}|||||||||||||d
}|D]~\}}tt|}	tt|}
|D]L}|
|}||	||j|d|jMd	D]e}
|D]`}tj||
}|tj||
|j|d|jafdS)
N)g{Gz?g?g??g?gGz?cg|]}|Srrrrs  rrz6CMathTests.test_cmath_matches_math.<locals>.<listcomp>&s&?&?&?ar&?&?&?r)rrGrGcg|]}d|zS)rGrrs  rrz6CMathTests.test_cmath_matches_math.<locals>.<listcomp>*s(C(C(C!A(C(C(Crrcg|]}|Srrrs  rrz6CMathTests.test_cmath_matches_math.<locals>.<listcomp>.s&<&<&<ar&<&<&<r)
r&r(r*r,r-r.r/r0r1r2r3r4r5)rrrg$@)	itemsr#rHr$r_rPrkrQr/)r@r>
unit_intervalpositivenonnegative	real_linerfnvaluesfloat_fn
complex_fnvzbases              rtest_cmath_matches_mathz"CMathTests.test_cmath_matches_maths
766$&?&?;&?&?&??MM
"%(C(C{(C(C(CCdXoD8O&<&<8&<&<&<<	#" 
 
 )..00	-	-JBtR((H ++J
-
-JqMM''QV<<<  QV,,,,
-#	-	-D
-
-Ia&&''D(9(916BBB  QV,,,,
-	-	-rcxdh}d}tjdkr`tjd}	tt	t
|d}n#t$rYnwxYwd}d}ttD](\}}}}	}
}}t||	}
t|
|}||dkr||vr8|dkr|}n|d	kr|}ntt|}d
|vsd|vrH	||
}|
d||||	n#t$rYwxYwd
|vrH	||
}|
d||||	n#t$rYwxYw||
}d|vrNtt!|j|j}tt!|j|j}d|vrNt|jt!|j}t|jt!|j}|dvrd}nd}d||||	|j|j|j|j}||j|j||||j|j|*dS)Ntan0064darwinr.c@tj|j|jS)zaWrapped version of rect that accepts a complex number instead of
            two float arguments.)r$r
rPrQrs rrect_complexz5CMathTests.test_specific_values.<locals>.rect_complex\s:afaf---rc.tt|S)zYWrapped version of polar that returns a complex number instead of
            two floats.)rr	rs r
polar_complexz6CMathTests.test_specific_values.<locals>.polar_complexasE!HH%%r)
rqr
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)r/r0rSrTz{}: {}(complex({!r}, {!r}))
Expected: complex({!r}, {!r})
Received: complex({!r}, {!r})
Received value insufficiently close to expected value.)r]rM)rM)sysplatformmac_vertuplemaprsplit
ValueErrorrrrr#r$rKrLrYrWrPrQr_)r@
SKIP_ON_TIGERosx_versionversion_txtrridraraiereiflagsrexpectedfunctionactualreal_abs_err
error_messages                   rtest_specific_valueszCMathTests.test_specific_valuesNsq#
<8##"*,,Q/K
#C[->->s-C-C$D$DEE



	.	.	.
	&	&	&
.<I-F-F=	;=	;)BBBE"b//Cr2H&;+@+@&&V||'w("5"--5((I,>,>P%Xc]]FII88>r2r28N8NPPPP"HU""P%Xc]]FII88>r2r28N8NPPPP%HXc]]F!U** V[!1!16;??"3x}#5#5x}EE!U** c&+.>.>??"8=#hm2D2DEE%%%$%I&RR]HM[&+//

##HM6;0<,9
$
;
;
;
##HM6;,9
$
;
;
;
;y=	;=	;s55A&&
A32A38D//
D<;D<E;;
FFcfd}|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||||fdS)Ncv|}t||D]\}}||dSrC)zipr_)rrgotrdgfuncr@s     rcheckz%CMathTests.check_polar.<locals>.checksP$s))CHc**
.
.1''1----
.
.rr)rrrp)rGrrG?ryg@rrrqr
)rfloatr)r@rrrr
s``   rcheck_polarzCMathTests.check_polars	.	.	.	.	.	.	a
a
b2r(
b2rAv,
cBa=!!!Ell
gc1ooRy)))
gsdAb	***
gaooR!V}---
ga#rcAg///
gc3#rAv///
gcC4  3a.111
gsdC  3B
"3444
gsdSD!!Cb1#5666Ell
gc1ooSz***
gaooSz***
gc3#s,,,
gc3#s,,,
gsdC  3*---
gc3#s,,,
gcC4  3*-----rc:|tdSrC)r#r	r?s r
test_polarzCMathTests.test_polarsrcdtjdfd}||dS)N	_testcapicd	t|dS#dwxYw)Nr)	set_errnor	)rr's rpolar_with_errno_setz9CMathTests.test_polar_errno.<locals>.polar_with_errno_setsV###
'Qxx##A&&&&	##A&&&&s	<A)r
import_moduler#)r@r+r's  @rtest_polar_errnozCMathTests.test_polar_errnosK"/<<		'	'	'	'	'	
-.....rc
|tdd|tdd|tdt|tdt|tdt|tdtdz|td	tdz|tt	ddd|tt	dd
d
|tt	d
dt|tt	d
d
t|tt	t
d
t|tt	t
dt|tt	t
t
dtz|tt	dt
tdz|tt	d
t
tdz|tt	dt
tdz|tt	d
t
tdz|tt	t
t
tdz|tt	t
dd
|tt	t
d
d
|tt	t
dd|tt	t
d
d|tt	t
t
tdz|tt	d
t
tdz|tt	dt
tdz|tt	d
t
tdz|tt	dt
tdz|tt	t
t
dtz|tt	t
d
t|tt	t
dttD]6}|tj	t|7dS)NrrrGryYnyYnrryrrgrr g?)
rcrrrkrINFcomplex_nansrlrHrIr@rs  r
test_phasezCMathTests.test_phases2uQxx,,,uRyy"---uSzz2...u[112666u[11B3777uRyy"Q$///uSzzB3q5111	
wsC00113777wsD1122D999wtS1122B777wtT2233bS999	
uWcT4%8%899B3???uWcT4%8%899B3???uWcTC4%8%89958DDDuWTC4%8%899B3q5AAAuWTC4%8%899B3q5AAAuWS3$%7%7882#a%@@@uWS3$%7%7882#a%@@@uWS3$%7%7882#a%@@@wsD1122D999wsD1122D999wsC00113777wsC00113777uWS#%6%677A>>>uWS#%6%677A>>>uWS#%6%677A>>>uWT3%7%788"Q$???uWT3%7%788"Q$???uWcT3%7%788$r'BBBuWcT3%7%788"===uWcT3%7%788"===	2	2AOODJuQxx001111	2	2rc
tD]%}|t|d&tD]*}|t|t+|ttttt|tj	tttd|tj	tttd|tj	tttd|tj	tttd|ttttt|ttttt|tj	ttdt|tj	ttdt|tj	ttdt|tj	ttdt|ttttt|tj	ttttdS)Nrrrr)

complex_zerosrkrWcomplex_infinitiesr/rNANrlrHrIr1s  rtest_abszCMathTests.test_abss	*	*ASVVS))))$	*	*ASVVS))))	
WS3$//00#666
3wsD'9'9#:#:;;<<<
3wsD'9'9#:#:;;<<<
3wsC'8'8#9#9::;;;
3wsC'8'8#9#9::;;;WS#..//555WcT3//00#666
3wtS'9'9#:#:;;<<<
3wtS'9'9#:#:;;<<<
3wsC'8'8#9#9::;;;
3wsC'8'8#9#9::;;;WS#..//555
3wsC'8'8#9#9::;;;;;rcd|tttdddS)NgU)rrYrWrr?s rtest_abs_overflowszCMathTests.test_abs_overflowss,	
-ggw.G.GHHHHHrcd}t|j|dz
|ks!t|j|dz
|kr|||fdSdS)NgHz>rrp)rWrPrQrK)r@rZr[epss    rassertCEqualzCMathTests.assertCEqualseqv!}##s16AaD='9'9C'?'?IIq!f(@'?rc|tddd|tddd|tdtd|tdtdzd|tdtdzddS)	Nr)rrrp)rGr)rrr)rrG)rr)r<r
rr?s r	test_rectzCMathTests.test_rects$q!**f---$q!**g...$q2#,,111$q"Q$--111$q2#a%..(33333rc	6tdddddtdtdg}|D]e}|D]`}t||}|tj|tj|otj|afdS)Nz-infrrrrrr
)r"rrkr$isfiniterH)r@	real_valsrrrs     r
test_isfinitezCMathTests.test_isfinite#s6]]D$#uU||U5\\;		I	IA
I
IAqMM  !2!2"&-"2"2"Gt}Q7G7GIIII
I	I	Irc|tjd|tjd|tjt|tjt
|tjt
t
d|tjt
dt
|tjt
t
t
|tjt
t
t|tjt
tt
dSNrprr)assertFalser$rIr/rlr6rr?s r
test_isnanzCMathTests.test_isnan,4Q(((R)))S))***C(()))GCOO44555GAsOO44555GC$5$566777GC$5$566777GC$5$56677777rc|tjd|tjd|tjt|tjt
|tjt
t
d|tjt
dt
|tjt
t
t
|tjt
tt
|tjt
t
tdSrD)rEr$rVr6rlr/rr?s r
test_isinfzCMathTests.test_isinf7rGrcjtD]*}|tj||+dSrC)r4rRr$r5r1s  rtestTanhSignzCMathTests.testTanhSignB<	:	:A''
1

q9999	:	:rcjtD]*}|tj||+dSrC)r4rRr$r*r1s  rtestAtanSignzCMathTests.testAtanSignKrLrcjtD]*}|tj||+dSrC)r4rRr$r+r1s  r
testAtanhSignzCMathTests.testAtanhSignPs<	;	;A''A::::	;	;r)rSrTN) rrrrappendrArErNrRr_rgrnrrrrrr#r%rr-r2r7r9r<r>rBrFrIrKrNrPrrrr!r!4sT$$:#$$$N
==>>>::;;;===!!!$$$.222CI#0K0K0K0KdKKK333"`H`H`HD
5
5
5.-.-.-`T;T;T;l...8   	/	/\	/'2'2'2R<<<2III
444III	8	8	8	8	8	8::::::;;;;;rr!c.eZdZejZdZdZdZdS)IsCloseTestsc|t5|ddddddn#1swxYwY|t5|ddddddn#1swxYwY|t5|ddddddddS#1swxYwYdS)Nrrel_tolabs_tol)rVrX)rriscloser?s rtest_reject_complex_tolerancesz+IsCloseTests.test_reject_complex_tolerancesYs


y
)
)	-	-LLRL,,,	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

y
)
)	-	-LLRL,,,	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

y
)
)	9	9LLRRL888	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9s5AAA%B

BB/CCCcjgd}||d||ddS)N))??y??)r\y??)y?y?)y?y?g-q=rUgvIh%<=)assertAllCloseassertAllNotClose)r@complex_exampless  rtest_complex_valuesz IsCloseTests.test_complex_valuescsP	
,e<<</?????rcgd}||d||d|ddd|ddddS)	N))yMbP?r)MbP?r)MbP?MbP?r)yMbPMbP?r)MbP?MbPr)yMbPMbPrg~jtX?rWgMb@?rdrcgMb`?rb)r]r^
assertIsCloseassertIsNotClose)r@near_zero_exampless  rtest_complex_near_zeroz#IsCloseTests.test_complex_near_zerons   	
.@@@17CCC<uEEElL%HHHHHrN)rrrr$rYrZr`rhrrrrSrSVsPmG999	@	@	@IIIIIrrS__main__)test.supportrrrtest.test_mathrr	test_mathunittestr$rHrr	r
rrrr"r/r6r4r5r0TestCaser!rSrmainrrr<module>rpsGGGGGGGGGG44444444""""""((((((((((((



eElleEllIIIII
	c
	c
	c
	c
	c
	
s	
s

s

s

s

t

t

t	
t	
t	sd	sd	sd	d	d)1
,

	sd	d	d	c
	c
	c


s	
s	
s	c
	c
	c

+



_;_;_;_;_;"_;_;_;D&I&I&I&I&I9)&I&I&IRzHMOOOOOr