ó {G_Tc@syddlmZddlmZmZddlZddlZddlZddlmZm Z m Z m Z e dƒZ e dƒZgddgD](ZddgD]Zeeeƒ^q¡q‘Zge dfe d fe e fd e fde fde fd e fe e fe d fe dfe dfe d fe e fd e fde fde fd e fe e fe d fe dfgD]\ZZeeeƒ^q†Zgee fed fedfedfed fee fe efd efdefdefd efe efg D]\ZZeeeƒ^qZd ejfd „ƒYZd „ZedkrueƒndS(iÿÿÿÿ(t run_unittest(tparse_testfilet test_fileN(tphasetpolartrecttpitinftnangg€gffffff@gffffffÀt CMathTestscBseZgdddddddddd d d d d ddgD]Zeeeƒ^q=Zejd„ƒejd„ƒd„Zd„Zddd$d„Z d„Z d„Z d„Z d„Zd„Zd„Zd„Zd„Zd„Zd „Zd!„Zd"„Zd#„ZRS(%tacostacoshtasintasinhtatantatanhtcostcoshtexptlogtlog10tsintsinhtsqrtttanttanhcCstj|dƒS(Ng›@yy›@(tcmathR(tx((s+/usr/local/lib/python2.7/test/test_cmath.pyt7scCstjd|ƒS(Ng,@y;@y,@;À(RR(R((s+/usr/local/lib/python2.7/test/test_cmath.pyR8scCsttƒ|_dS(N(topenRt test_values(tself((s+/usr/local/lib/python2.7/test/test_cmath.pytsetUp:scCs|jjƒdS(N(Rtclose(R((s+/usr/local/lib/python2.7/test/test_cmath.pyttearDown=sgV瞯âfinite result where infinity expected: expected {!r}, got {!r}gð?s,zero has wrong sign: expected {!r}, got {!r}s({!r} and {!r} are not sufficiently close( tmathtisnantfailtformattisinftcopysigntabst OverflowErrortmax(Rtatbtrel_errtabs_errtmsgtabsolute_error((s+/usr/local/lib/python2.7/test/test_cmath.pytrAssertAlmostEqual@s*  $  c Csld}d}|jtj|ddddjtj|ƒƒ|jtj|ddddjtj|ƒƒdS(NgiW‹ ¿@g-DTû! @tplacesi R0scmath.pi is {}; should be {}scmath.e is {}; should be {}(tassertAlmostEqualRRR&te(Rt e_expectedt pi_expected((s+/usr/local/lib/python2.7/test/test_cmath.pyttest_constantsrs csÿd"‰d‰dddddtƒtg}dtfd „ƒY}d d#d „ƒY}d tfd „ƒY‰dtf‡fd†ƒY}dd$‡fd†ƒY}dtfd„ƒY}dd%d„ƒY}dtfd„ƒY}dd&d„ƒY} dtf‡‡fd†ƒY} dd'‡‡fd†ƒY} dtf‡fd†ƒY} d d(‡fd!†ƒY} x˜|jD]}|j||ˆƒƒ|ˆƒƒ|j||ˆƒƒ|ˆƒƒ|j|| ƒƒ|ˆƒƒ|j|| ƒƒ|ˆƒƒ|j|| ƒƒ|ˆƒƒ|j|| ƒƒ|ˆƒƒ|jt||ƒƒ|jt||ƒƒ|jt||ƒƒ|jt|| ƒƒx@|D]8}|jt|||ƒƒ|jt|||ƒƒqW|jˆ||ƒƒ|jˆ||ƒƒqjWdS()Ng—æ‹úz­@y7Ä‚?ô÷?g]ò‰†Ö†Às not complexilg@t MyComplexcBseZd„Zd„ZRS(cSs ||_dS(N(tvalue(RR:((s+/usr/local/lib/python2.7/test/test_cmath.pyt__init__ŽscSs|jS(N(R:(R((s+/usr/local/lib/python2.7/test/test_cmath.pyt __complex__s(t__name__t __module__R;R<(((s+/usr/local/lib/python2.7/test/test_cmath.pyR9s t MyComplexOScBseZd„Zd„ZRS(cSs ||_dS(N(R:(RR:((s+/usr/local/lib/python2.7/test/test_cmath.pyR;•scSs|jS(N(R:(R((s+/usr/local/lib/python2.7/test/test_cmath.pyR<—s(R=R>R;R<(((s+/usr/local/lib/python2.7/test/test_cmath.pyR?”s t SomeExceptioncBseZRS((R=R>(((s+/usr/local/lib/python2.7/test/test_cmath.pyR@›stMyComplexExceptioncseZ‡fd†ZRS(cs ˆ‚dS(N((R(R@(s+/usr/local/lib/python2.7/test/test_cmath.pyR<žs(R=R>R<((R@(s+/usr/local/lib/python2.7/test/test_cmath.pyRAstMyComplexExceptionOScseZ‡fd†ZRS(cs ˆ‚dS(N((R(R@(s+/usr/local/lib/python2.7/test/test_cmath.pyR<¡s(R=R>R<((R@(s+/usr/local/lib/python2.7/test/test_cmath.pyRB stNeitherComplexNorFloatcBseZRS((R=R>(((s+/usr/local/lib/python2.7/test/test_cmath.pyRC¥stNeitherComplexNorFloatOScBseZRS((R=R>(((s+/usr/local/lib/python2.7/test/test_cmath.pyRD§stMyIntcBs#eZd„Zd„Zd„ZRS(cSsdS(Ni((R((s+/usr/local/lib/python2.7/test/test_cmath.pyt__int__ªscSsdS(Nl((R((s+/usr/local/lib/python2.7/test/test_cmath.pyt__long__«scSsdS(Ni((R((s+/usr/local/lib/python2.7/test/test_cmath.pyt __index__¬s(R=R>RFRGRH(((s+/usr/local/lib/python2.7/test/test_cmath.pyRE©s  tMyIntOScBs#eZd„Zd„Zd„ZRS(cSsdS(Ni((R((s+/usr/local/lib/python2.7/test/test_cmath.pyRF®scSsdS(Nl((R((s+/usr/local/lib/python2.7/test/test_cmath.pyRG¯scSsdS(Ni((R((s+/usr/local/lib/python2.7/test/test_cmath.pyRH°s(R=R>RFRGRH(((s+/usr/local/lib/python2.7/test/test_cmath.pyRI­s  tFloatAndComplexcs&eZ‡fd†Z‡fd†ZRS(csˆS(N((R(tflt_arg(s+/usr/local/lib/python2.7/test/test_cmath.pyt __float__µscsˆS(N((R(tcx_arg(s+/usr/local/lib/python2.7/test/test_cmath.pyR<·s(R=R>RLR<((RMRK(s+/usr/local/lib/python2.7/test/test_cmath.pyRJ´stFloatAndComplexOScs&eZ‡fd†Z‡fd†ZRS(csˆS(N((R(RK(s+/usr/local/lib/python2.7/test/test_cmath.pyRLºscsˆS(N((R(RM(s+/usr/local/lib/python2.7/test/test_cmath.pyR<¼s(R=R>RLR<((RMRK(s+/usr/local/lib/python2.7/test/test_cmath.pyRN¹st JustFloatcseZ‡fd†ZRS(csˆS(N((R(RK(s+/usr/local/lib/python2.7/test/test_cmath.pyRL¿s(R=R>RL((RK(s+/usr/local/lib/python2.7/test/test_cmath.pyRO¾st JustFloatOScseZ‡fd†ZRS(csˆS(N((R(RK(s+/usr/local/lib/python2.7/test/test_cmath.pyRLÂs(R=R>RL((RK(s+/usr/local/lib/python2.7/test/test_cmath.pyRPÁsy—æ‹úz­@7Ä‚?ô÷?(((((((tNonetobjecttNotImplementedt Exceptionttest_functionst assertEqualt assertRaisest TypeError(Rt non_complexesR9R?RARBRCRDRERIRJRNRORPtft bad_complex((R@RMRKs+/usr/local/lib/python2.7/test/test_cmath.pyttest_user_objectzsB"" cCs›xM|jD]B}x9dddgD](}|j||ƒ||jƒƒƒq Wq WxD|jD]9}x0dddddgD]}|jt||ƒqvWqZWdS( Nilg@R,t long_stringt0t1jt(RURVRLRWRX(RRZtarg((s+/usr/local/lib/python2.7/test/test_cmath.pyttest_input_typeßs *cCsõddddddg}|g|D] }| ^q"ddd g}|dgg|D]}d|^qT}dg|}dg|g|D] }| ^q‰}i |d 6|d 6|d 6|d 6|d6|d6|d6|d6|d6|d6|d6|d6|d6}x|jƒD]s\}} tt|ƒ} tt|ƒ} xF| D]>} | | ƒ} |j| | ƒ| jƒ|jd| jƒq<Wq WxldddgD][}xR|D]J} tj| |ƒ} |jtj| |ƒ| jƒ|jd| jƒqŸWq’WdS(Ng{®Gáz„?gš™™™™™¹?gš™™™™™É?gà?gÍÌÌÌÌÌì?g®Gáz®ï?ggð?gð¿R R RRRRRRRRRRRg@g$@( titemstgetattrR#RR2trealRVtimagR(RRRt unit_intervaltpositivet nonnegativet real_lineRUtfntvaluestfloat_fnt complex_fntvtztbase((s+/usr/local/lib/python2.7/test/test_cmath.pyttest_cmath_matches_mathës@( %    c Cs–tjdƒjdƒs(|jdƒnd„}d„}xUttƒD]G\}}}}}}} t||ƒ} t||ƒ} |dkr•|} n$|dkrª|} ntt|ƒ} d| ksÑd | kry| | ƒ} Wnt k r÷qGqX|j d j ||||ƒƒnd | kroy| | ƒ} Wnt k rLqGqoX|j d j ||||ƒƒn| | ƒ} d | krÀtt | jƒ| jƒ} tt | jƒ| jƒ} nd| krt| jt | jƒƒ} t| jt | jƒƒ} n|dkrd}nd}dj ||||| j| j| j| jƒ}|j| j| jd|d|ƒ|j| j| jd|ƒqGWdS(NtdoubletIEEEsneeds IEEE doublecSstj|j|jƒS(saWrapped version of rect that accepts a complex number instead of two float arguments.(RRReRf(Rp((s+/usr/local/lib/python2.7/test/test_cmath.pyt rect_complexscSstt|ƒŒS(sYWrapped version of polar that returns a complex number instead of two floats.(tcomplexR(Rp((s+/usr/local/lib/python2.7/test/test_cmath.pyt polar_complex$sRRsdivide-by-zerotinvalids9ValueError not raised in test {}: {}(complex({!r}, {!r}))toverflows<OverflowError not raised in test {}: {}(complex({!r}, {!r}))signore-real-signsignore-imag-signRRgV瞯âii(R)R%(RR,R-teps((s+/usr/local/lib/python2.7/test/test_cmath.pytassertCISEqualbs<cCs|jtdƒdƒ|jtdƒd ƒ|jtdƒdtfƒ|jtdƒdtdfƒ|jtdƒdt dfƒdS( Niggð?gð¿yð?iyð¿(gg(gð?g(RŒRR(R((s+/usr/local/lib/python2.7/test/test_cmath.pyt test_polargs  cCs|jtdƒdƒ|jtdƒdƒ|jtdƒtƒ|jtdƒtƒ|jtdƒt ƒ|jtdƒtdƒ|jtdƒt dƒ|jttddƒƒdƒ|jttdd ƒƒd ƒ|jttd dƒƒtƒ|jttd d ƒƒt ƒ|jttt d ƒƒt ƒ|jttt d ƒƒt ƒ|jttt t ƒƒd tƒ|jttd t ƒƒt dƒ|jttd t ƒƒt dƒ|jttdt ƒƒt dƒ|jttd t ƒƒt dƒ|jtttt ƒƒt d ƒ|jtttd ƒƒd ƒ|jtttd ƒƒd ƒ|jtttdƒƒdƒ|jtttd ƒƒdƒ|jttttƒƒtd ƒ|jttd tƒƒtdƒ|jttdtƒƒtdƒ|jttd tƒƒtdƒ|jttd tƒƒtdƒ|jttt tƒƒdtƒ|jttt d ƒƒtƒ|jttt dƒƒtƒx*tD]"}|jtj t|ƒƒƒq×WdS(Niggð?gð¿yYóøÂn¥yð?iyð¿g€gffffffÀgè¿gffffff@igè?yð¿YóøÂn¥yð¿YóøÂn¥( R4RRRVRvtINFt complex_nanst assertTrueR#R$(RRp((s+/usr/local/lib/python2.7/test/test_cmath.pyt test_phasensB !!%%%%%%#####$   cCsTx$tD]}|jt|ƒdƒqWx$tD]}|jt|ƒtƒq.W|jtttt ƒƒtƒ|jtj tttdƒƒƒƒ|jtj tttdƒƒƒƒ|jtj tttdƒƒƒƒ|jtj tttdƒƒƒƒ|jttttƒƒtƒ|jttt tƒƒtƒ|jtj ttdtƒƒƒƒ|jtj ttdtƒƒƒƒ|jtj ttdtƒƒƒƒ|jtj ttdtƒƒƒƒ|jttttƒƒtƒ|jtj ttttƒƒƒƒt j dƒj dƒrP|j tttddƒƒndS(NggffffffÀg€gffffff@RsRtg­åU»ëè(t complex_zerosRVR)tcomplex_infinitiesRŽRvtNANRR#R$RzR{R|RWR*(RRp((s+/usr/local/lib/python2.7/test/test_cmath.pyttest_abs—s&   %%%% %%%%%cCsZd}t|j|dƒ|ks@t|j|dƒ|krV|j||fƒndS(NgH¯¼šò×z>ii(R)ReRfR%(RR,R-R‹((s+/usr/local/lib/python2.7/test/test_cmath.pyt assertCEqual³s:cCs‹|jtddƒdƒ|jtddƒdƒ|jtdt ƒdƒ|jtdtdƒd ƒ|jtdt dƒd ƒdS( Niigð?gð¿i(ii(gð?i(gð¿i(igð?(igð¿(R–RR(R((s+/usr/local/lib/python2.7/test/test_cmath.pyt test_rect¸s cCs÷|jtjdƒƒ|jtjdƒƒ|jtjtƒƒ|jtjtƒƒ|jtjttdƒƒƒ|jtjtdtƒƒƒ|jtjtttƒƒƒ|jtjtttƒƒƒ|jtjtttƒƒƒdS(Niyð?i(t assertFalseRR$RŽRR”Rv(R((s+/usr/local/lib/python2.7/test/test_cmath.pyt test_isnan¿scCs÷|jtjdƒƒ|jtjdƒƒ|jtjtƒƒ|jtjtƒƒ|jtjttdƒƒƒ|jtjtdtƒƒƒ|jtjtttƒƒƒ|jtjtttƒƒƒ|jtjtttƒƒƒdS(Niyð?i(R˜RR'R”RRŽRv(R((s+/usr/local/lib/python2.7/test/test_cmath.pyt test_isinfÊsN(R=R>tfnameRdRRUtappendR R"RQR2R8R\RbRrRŠRŒRR‘R•R–R—R™Rš(((s+/usr/local/lib/python2.7/test/test_cmath.pyR 0s.(   1  e 0 G   )    cCsttƒdS(N(RR (((s+/usr/local/lib/python2.7/test/test_cmath.pyt test_mainÖst__main__(ttest.test_supportRttest.test_mathRRtunittestRR#RRRRRzRŽR”RtyRvR’R“RtTestCaseR RR=(((s+/usr/local/lib/python2.7/test/test_cmath.pyts\ "  ;                   .           .ÿ§