U _@s(ddlZddlmZddlZddlZddlZddlZejjZ de Z e dZ dZ dZ ddde e d?ddgZd Zede D]Zeeded>Zqz[ed d eDd d eD7ZejjZejjZejjZejjZdedeedZd dZddZGdddejZ e!dkr$e"dS)N)supportFlUU*UU*l*UU*UU cCsg|] }|qSr.0xrr&/usr/lib64/python3.8/test/test_long.py sr cCsg|] }| qSrrr rrr r scCstjjd}tjj|}d|>}ddddddddg}|dkr@dS|dkrTt|  S||}|dkrr|| >n||?t|d|>@B}|||d@7}|||k|krtd|d dkr|d dtjjkst|d|tjj kstt t ||S) z9 Correctly-rounded integer-to-float conversion. rrrz%integer too large to convert to floatr) sys float_infomant_digmax_exp int_to_float bit_lengthbool OverflowErrorAssertionErrormaxmathldexpfloat)nZ PRECISIONZ SHIFT_MAXZQ_MAXZROUND_HALF_TO_EVEN_CORRECTIONshiftqrrr r's     ,$rcCs ||Adk}t|t|}}|s*td|t|kr>td||}|dkrf|d||ks|dkr|d| |kr|d7}t|tt}|t| d>|t|d>}}t||\}}d||ksd||kr|ddkr|d7}t ||}|r| S|S)z-Correctly-rounded true division for integers.rzdivision by zeroz)int/int too large to represent as a floatrr) absZeroDivisionErrorDBL_MIN_OVERFLOWrrr DBL_MIN_EXP DBL_MANT_DIGdivmodrr)abnegativedexpr!rresultrrr truedivUs   2 $ r/c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZejdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0ZdYd2d3Zejd4d5Zd6d7Zd8d9Z ej!d:d;Z"ej!ej#e$j%d<d=d>d?d@dAZ&dBdCZ'ej!ej#e$j%dDdEd>d?dFdGZ(dHdIZ)dJdKZ*dLdMZ+dNdOZ,dPdQZ-dRdSZ.dTdUZ/dVdWZ0dXS)ZLongTestcCs||d|t}|td}d}d}tttddB}||kr|d?d}t|||}|d|koxtkn||}||>}|d@r|d|>dB}tttd}q@|||ko|kntdkr| }|S)Nrrr?)Z assertGreaterSHIFTintrandommin assertTrue)selfndigitsZnbits_hiZnbits_loanswerZnbitsr-bitsrrr getran{s&    zLongTest.getrancCs<d}t|D]}|t>tdtB}q tdkr8| }|S)Nrr1)ranger2r4randintMASK)r8r9irrr getran2s   zLongTest.getran2c Cs|j}|j||dt||\}}||||}}||||}} ||| d|||d|||d|||||d|dkr|d|ko|kndn |||kodkndW5QRXdS)Nr yzmultiplication does not commutez(divmod returns different quotient than /z#divmod returns different mod than %zx != q*y + r after divmodrzbad mod from divmod) assertEqualsubTestr'r6) r7r rBeqr!r-Zq2Zr2ZpabZpbarrr check_divisions   "zLongTest.check_divisioncCsttdtdttttd}|td|D]2}||}|D]}||pXd}|||qHq6|dd|dd|dd |d d |d d |dd|dd|dd|dd|dd|dd|dddS)Nrl!Us/w3alZW3al+Q@{dB]OlNlOOlNlteo%gqCgxd}|D]h}||krjq\|j||dFd|>d}||}d||>d|>d|>d}|||W5QRXq\qHdS)Nr dcSsg|] }|tqSr)r2)r digitrrr r sz+LongTest.test_karatsuba..)abitsbbits)rIr<rKextendrDrC) r7rMr:rUr(rVr)r rBrrr test_karatsubas*   zLongTest.test_karatsubac Cs|j}|j|d||d@d||dB|||dA|||d@|||dBd||dA|||||||@||||B||||Ad|||@d|||Bd|||Ad|| d||| |dW5QRXtdtD]}d|}|j|||dn|||>|?||||||?|||||>||| @||?|>||| @||d@W5QRXq dS)N)r rrrr)r rp2)rCrDr<r2)r7r rErrYrrr check_bitop_identities_1s2z!LongTest.check_bitop_identities_1c Cs|j}|j||d|||@||@|||B||B|||A||A|||A|A||||@||B|||B||@|||A||B||@@|||A||@||@B|||A||B||B@W5QRXdS)NrArCrD)r7r rBrErrr check_bitop_identities_2sz!LongTest.check_bitop_identities_2c Cs|j}|j|||d|||@|@|||@@|||B|B|||BB|||A|A|||AA||||B@||@||@B||||@B||B||B@W5QRXdS)N)r rBzr[)r7r rBr]rErrr check_bitop_identities_3sz!LongTest.check_bitop_identities_3c CstD]}||qtdtd}|D]T}||}|||D]6}||}|||||||||dqBq&dS)Nrr)specialrZr<rJr;r\r^)r7r rMrNrOrBrrr test_bitop_identitiess     zLongTest.test_bitop_identitiescCsg}d}|dkrd| }}|r>t||\}}|t|q||pNdg}dd|ddddd|dd d |DS) Nrr-Z0bZ0o0x)rrRcss|]}d|VqdS)Z0123456789abcdefNrr r?rrr 1sz'LongTest.slow_format..)r'rLr3reversejoin)r7r baserMsignr-rrr slow_format%s   zLongTest.slow_formatc CsdtfdtfdtfdtfdtffD]n\}}||}|j||jd|||}|||W5QRX|j|d|t |d|W5QRXq"dS)NrrdrRre)r mapper)gotr) binoctstrreprhexrD__name__rlrCr3)r7r rjrmrnexpectedrrr check_format_13s* zLongTest.check_format_1cCsNtD]}||qtdD],}tdtdD]}||}||q.qdS)NrRr)r_rvr<rJr;)r7r r?rNrrr test_format<s    zLongTest.test_formatc Cs$ddddfg}|D]l\}}dD]^}dD]T}|||}|}|dkrR|tk rR| }z|t||Wq(tk rzYq(Xq(q q|ttd|ttd |ttd |ttd |ttd d |ttdd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|td dd|ttd!d|ttd"dd#d$d%d&d'd(d)d*d+d,dd,d g }|D]} |ttd-| q|ttd.dS)/N)Z100000000000000000000l Fx:^VZe10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000rRrS)rb+ra)rb  z raZ123LZ123lZ0Lz-37LZ0x32LreZ1L+Z000rZ0o123SZ0x123i#Z0b100rz 0O123 z 0X123 z 0B100 0z+0z-0Z00Z08z-012395isilllrZ42uこんにちは) ValueErrorrCr3 assertRaises) r7ZLLsvrkprefixssZvvZ invalid_basesrjrrr test_longDsb    zLongTest.test_longcCsBGddd}|tt|Gddd}|t|ddS)Nc@seZdZddZdS)z*LongTest.test_conversion..JustLongcSsdSN*rr7rrr __long__sz3LongTest.test_conversion..JustLong.__long__N)rt __module__ __qualname__rrrrr JustLongsrc@seZdZddZddZdS)z+LongTest.test_conversion..LongTrunccSsdSrrrrrr rsz4LongTest.test_conversion..LongTrunc.__long__cSsdS)Nrrrrr __trunc__sz5LongTest.test_conversion..LongTrunc.__trunc__N)rtrrrrrrrr LongTruncsrr)r TypeErrorr3rC)r7rrrrr test_conversion}szLongTest.test_conversioncCslz t|}Wntk r$d}YnXz t|}Wntk rJd}YnXd|||}||||dS)NoverflowzAError in conversion of integer {} to float. Got {}, expected {}.)rrrformatrC)r7ractualrumsgrrr check_float_conversions    zLongTest.check_float_conversionc Csddddddddd d d d g }|D](}|t|||t| | q d D]B\}}tdD]0}|ttd|d|d|d|q^qNdD]B\}}tdD]0}|ttd|d |d|d |qqtt}dt}||d}|t|t|t|dt|t|dt|tt||td|t |tt| |tt|d|tt||tt|d|ttd|d|ttd||tt||tdD]b}d|dd}d|d}|tt||d|d}d|d}|tt||q|d||d|d||d|d||dd|dd|||g }||tddD].}tddD]}| d|d|qq|D]} | | | | qdS)Nrrrlllllllll)rr)rrrHrrrrQr)rrrdr))rrr)rrrrr)rrdr)rdrd) rd)rRrd) )rr) r)rGre)rrerSlrd5) rCrr<r3DBL_MAX DBL_MAX_EXPrrrWrLr) r7Z exact_valuesr rBpZ int_dbl_maxZ top_powerZhalfwayZ test_valuesvaluerrr test_float_conversions|   0  0        zLongTest.test_float_conversioncCsrdD]}|tt||qd}dd>}| }|||td}dD]}|tt||qB|t|t|ddS)N)gr?@AX123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345ri0u)hugemhugeshuger)$ float(huge) float(mhuge)z complex(huge)zcomplex(mhuge)zcomplex(huge, 1)zcomplex(mhuge, 1)zcomplex(1, huge)zcomplex(1, mhuge)z 1. + hugez huge + 1.z 1. + mhugez mhuge + 1.z 1. - hugez huge - 1.z 1. - mhugez mhuge - 1.z 1. * hugez huge * 1.z 1. * mhugez mhuge * 1.z 1. // hugez huge // 1.z 1. // mhugez mhuge // 1.z 1. / hugez huge / 1.z 1. / mhugez mhuge / 1.z 1. ** hugez huge ** 1.z 1. ** mhugez mhuge ** 1.zmath.sin(huge)zmath.sin(mhuge)zmath.sqrt(huge)zmath.sqrt(mhuge)z(float(shuge) should not equal int(shuge))rCrr3rrrevalZassertNotEqual)r7r rrr namespacetestrrr test_float_overflowszLongTest.test_float_overflowcCsttj}ttddddgD]@}d|}t|}|||||}t|}|||q"dd> ddfD]$}|ttj||ttj|qtdS)NrRrS'rrr) rlog10erIr<ZassertAlmostEquallogrr)r7ZLOG10Er,rrrurZbadrrr test_logss    zLongTest.test_logsc s|j}Gfdddddddddd g}d D]B}||d|d ||d |dt|d t|t|d gq.|dd d tjttjgtd }|dd d d d>|d ||d g|dd|D|D]}|}|D]}|}||k||k}|j|||d||k||k} ||| |||k|dk|||k|dk|||k|dk|||k|dk|||k|dk|||k|dkW5QRXqqdS)NcsHeZdZddZfddZddZddZd d Zd d Zd dZ dS)z)LongTest.test_mixed_compares..Ratc Ss,t|tr||_d|_nt|trtt|\}}|dksZd|krTdksZntd}d}|rt ||}t|}||?dkst||>|B}||8}d|krdksnt||8}qb|dkr||>}d}n|}d| >}|dkr| }||_||_t|t||ks(tn t d|dS)Nrrr1rrzcan't deal with %r) isinstancer3rr+rrfrexpr"rrr) r7rfrZCHUNKtoprTrr+rrr __init__s6   "    z2LongTest.test_mixed_compares..Rat.__init__cs<t|s|}|j|j|j|j}}||k||kS)N)rrr+)r7otherr rBRatrr _cmp__Fs z0LongTest.test_mixed_compares..Rat._cmp__cSs||dkSNrrr7rrrr __eq__Ksz0LongTest.test_mixed_compares..Rat.__eq__cSs||dkSrrrrrr __ge__Msz0LongTest.test_mixed_compares..Rat.__ge__cSs||dkSrrrrrr __gt__Osz0LongTest.test_mixed_compares..Rat.__gt__cSs||dkSrrrrrr __le__Qsz0LongTest.test_mixed_compares..Rat.__le__cSs||dkSrrrrrr __lt__Ssz0LongTest.test_mixed_compares..Rat.__lt__N) rtrrrrrrrrrrrrr rs( rrgMbP?gGz?rg?g@xDgZbti)gBgCg@Cg333333?rri NcSsg|] }| qSrrr rrr r asz0LongTest.test_mixed_compares..)r rBRcmp)rCrWr3rmaxsizerrD) r7rEZcasestr ZRxrBZRyrZxycmprrr test_mixed_comparess69  $ zLongTest.test_mixed_comparescCs|tddd|tddd|tddd|tddd|tdd d |td d d |tdd d|td d d|tddd|td dd|tddd|td dd|tddd|td dd |tddd|tddd|tddd|tddd|tddd|tddd|tddd|tddd|td dd |td dd |ttd!d"dd!|ttd!d"dd#|ttd!d" dd$|ttd!d" dd%|ttd&d'|td&d(d)|td&d*d+|tdd,d|td d,d |tdd,d-|tdd,d.|tdd/d-|tdd/d.|tdd0d1|tdd0d.|tdd2d3|tdd2d.|ttd&d4|td&d5d6|tdd7d8|td d7d9|tdd7d:|tdd7d;|tdd<d:|tdd<d;|tdd=d>|tdd=d;|tdd?d@|tdd?d;|ttd&dA|tdBdCdD|ttddE|ttddF|ttddG|ttddH|tdItddJ|tdItddK|tdItddL|tdItddM|tdNtddO|tdPtddQdRdSttdTtdUdDdVdSttdWtdXdDD]j}|dYkr|ttdZ||ttd||ttd ||ttd[d\||ttd[d\ |qd]D].}d^D]"}|t||tt||qXqPdS)_Ni[r+Z 123456789,z 123,456,789_Z 123_456_789rra1rz-1z-3z 1z -1z+3z +1z 3ryz 1rHr 3XiZ4d2i.z-4d2Z8xz 4d2z -4d2bereZBEz-bez-BEIz,xZ_xZ 4996_02d2Z_XZ 4996_02D2oZ2322z-2322z-oz oz 2322z+oz+2322z,oZ_oZ 111_4540_1322r)Z11z-11Z 10011010010z -10011010010z-bz bz 10011010010z+bz +10011010010z,b90Z_bZ11_0000_0011_1001z1.3Z_cz,cz+czCannot specify bothz_,z,_z_,dz,_dzCannot specify ',' with 's'z,szCannot specify '_' with 's'Z_scSsg|] }t|qSrchrr rrr r sz+LongTest.test__format__..r(r]cSsg|] }t|qSrrr rrr r sAZzbcdoxXeEfFgGn%rrrSzeEfFgG%)rrrrSri.i) rCrr3rrZassertRaisesRegexr<ordr)r7 format_specrrrr test__format__qs   zLongTest.test__format__cCs:|tttd|tttd|tttddS)Ninfz-infnan)rrr3rrrrrr test_nan_infszLongTest.test_nan_infc Cs|tdd}W5QRX|dd|dd|dd|dd|dd|dd|dd|dddS)NrrrHrrrr#rCr7rrrr test_mod_divisions        zLongTest.test_mod_divisioncCsdd>}| }|||d|||d|||d|||d|d|d|d|d|d|d|d|d|d||d?|d|d||d?|d|d||d?|d|d||d?|d|||d>d |d ||d ||d }d D]}|tt||q4d D]"}t||}||dd|qPdD]}|tt||qxdS)Nri@rrrigԄ@gԄr1i@B)rr)rrzhuge / 1zhuge / 2z huge / -1z huge / -2z mhuge / 100z mhuge / 200)z1 / hugez2 / hugez -1 / hugez -2 / hugez 100 / mhugez 200 / mhugezexpected underflow to 0 from %r)zhuge / 0z mhuge / 0)rCrrrr#)r7rrrrZ underflowr.Zzerorrr test_true_divisions4  zLongTest.test_true_divisionc Cs|tdd}W5QRX|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dddS)NrrrrHrrrrrrr test_floordivs            zLongTest.test_floordivTc Cs|r"tt|t|dtkr"dSztt||}Wn.tk rLd}Yntk rbd}YnXzt||}Wn.tk rd}Yntk rd}YnX|||d||||dS)zVerify that the result of a/b is correctly rounded, by comparing it with a pure Python implementation of correctly rounded division. b should be nonzero.rNrZ zerodivisionz7Incorrectly rounded division {}/{}: expected {}, got {}) rr"r&rrr/rr#rCr)r7r(r)Z skip_smallrurnrrr check_truedivs(    zLongTest.check_truedivcCs|dd|dd|dd|dd|dd|ddtd|dd dtt|ddd d |d d d ddtttttf}|D]p}t|d|dD]X}|ddt|dddt| d|ddt|dddt| dqqddd ddd d ddddddd f D]B}tddD]0}||t||||t|| qLq>tdD]6}|dtddddd|dtdq|dd|d d!td"D]6}|d|dd||d|d|dqddd#d d$d%dd&dd d ddddddd fD]0}tddD]}|dt|||qVqHtd'd(D]}||dd)qd*dd dd"fD]n}td"D]^}td|}t|d|d} ||| || | ||| || | qqtd+D]r} td"} tdd"} td| } tdd| }|| ||| | || ||| | q&dS),N{ri8rHrige~rriNFrSíl90rQri0&iCrrrii)2rRi lE,J_lJbrrrdre ii4ld( r) rrr&r%r<rr$r4 randrange)r7basesrjr,mrr?Mr(r)rZa_bitsZb_bitsr rBrrr $test_correctly_rounded_true_division8s     *. "            z-LongTest.test_correctly_rounded_true_divisionc Cs|tdd>W5QRX|tddd> >W5QRX|tdd?W5QRX|tddd> ?W5QRXdS)Nrrrr)rrrrrr test_negative_shift_counts    z"LongTest.test_negative_shift_countc Csr|dd|dd|tdd>W5QRX|ddd>>d|tddd> >W5QRXdS)Nrrrr)rCrrrrrr test_lshift_of_zeros    zLongTest.test_lshift_of_zerocCs,|dtj>d|dtjd>ddS)NrrrCrrrrrr test_huge_lshift_of_zerosz!LongTest.test_huge_lshift_of_zerorg?F)Zmemusedry_runcCs$|dtjd>dd>tj>dS)Nrrr)r7sizerrr test_huge_lshiftszLongTest.test_huge_lshiftcCs,|ddd>?d|ddd>?ddS)Nrrrrir)rCrrrr test_huge_rshiftszLongTest.test_huge_rshiftg?cCsJdd>dtj>}||tjd?dd>d||tjd?ddS)Nrr rirQrr)rrrC)r7rrrrr test_huge_rshift_of_hugesz!LongTest.test_huge_rshift_of_hugecCstddD]}|||d|||d|||d|||d|||d@|||dB|||dA||||||d||tt||||d>d?t|q d}|||d|d|ddS)Nrirrrrl)r<assertIsr3rq)r7r?rrr test_small_intsszLongTest.test_small_intsc Csd}tddD]}|}||tt|d|dkrl|d|dt|kobd|knn ||d|dkr||dt t t|t d|q|dd|dd|dd|dd|d dd D]}d|}||d||d|||||d|| |d||d|d|| d|dqdS) Ng|=iiz-0brrrrr) rrHrrerr!?@) r<rrClenrolstripr6r"rfloorr)r7Ztinyr kr?r(rrr test_bit_lengths00   zLongTest.test_bit_lengthcCsddddddddddddddddddddd}tdddD]H}|D]:\}}t||d}||}||||t|tqFq:|tdd d |td d d |td d d |tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tdd d|tddd|tddd|td dd!|td d d"|td dd#|td d$d%|td d&d'|td d(d)|td d*d+|td d,d-|td d.d/|td d0d1|td d2d|td d3d|td d4dtddD]@}td|d5d}d|d6}||||t|tqtd7D]H}tdD]8} td8d9} t| |}||| |t|tqqd:d;ddddfD]} |td?| d?qVtdD]6} td8d9} t| }||| |t|tqxd@} | D]} | t tdA| qdS)BNrrRr)rrrrHrrQrrrdrrRrrrrGrreriirijri8ikriiir1r3rSrri,iԡriiil!l !l~!l!rl !rl`!il!rl'!ilz+ilv|orl,GxiiiiFirQirrrrrri{)ZbrianryrH) r<itemsroundrCr typer3r4rrr)r7Z test_dictoffsetrrrnruexpectrr?r Zhuge_nZ bad_exponentsrrrr test_rounds            zLongTest.test_roundcsd0fdd }dddddd d d d d dddddddd}||dddddddddd dddd dd ddddd}||d ddddd ddddd!d"d#d$ }||dddddd dddd dd"d%d$ }||d ddjtd&jd'dddjtd&jd'dddjtd&jd'd ddjtd&jd'd ddjtd(jd)dddjtd(jd)d ddd*d*dd+d'd,dd-d*d,dd.d(jd,dddd/td'jd*ddS)1NFc sn|D]`\}}z |jt|||d|Wqtk rf}ztd||||W5d}~XYqXqdS)Nsignedz7failed to convert {0} with byteorder={1} and signed={2})r rCto_bytesr Exceptionrrtests byteorderr'rruerrrrr check>s z%LongTest.test_to_bytes..checks)rrrrbigTr&little) rrrArrErFrGrIrFrrrrrQsss)F)rrr(rC)r7r.tests1tests2tests3tests4rrr test_to_bytes=s   zLongTest.test_to_bytesc sd3fdd }dddddddddd d d d d dddddddd}||ddddddddddddd d d d d dddddddd}||ddddddd dddddddd }||ddddddd dddddddd }||dddGd d!d!t}t|d"d||d#ddt|jd"ddd||jd#ddddt|d"d||d#ddt|jd"ddd||jd#ddddtjdddgddddtjd$ddddtjtd%ddddtjtd%ddddtjtd&d%ddddtjtd%ddddt tjdgdt tjdgd't tjdgd(t tjd)dt tjd*dt tjddt tjdddt |jd)dt |jd*dt |jddt tjdddGd+d,d,t}|d#d}t|||d-Gd.d/d/t} | d#d}t|| |dt |d0d1d2dS)4NFc sj|D]\\}}ztj|||d|Wqtk rb}ztd||||W5d}~XYqXqdS)Nr&z9failed to convert {0} with byteorder={1!r} and signed={2})r rCr3 from_bytesr)rrr*rrr r.s z'LongTest.test_from_bytes..checkrrrr?rr@rArBrCrDrErFrGrHrIrJrK)r[r/r0rOr1rVr2r3r4r5r6r7r8r9r:r;rUr<r=r>rLTr&)r[r/rbr0rOr1rVr2r3r;r5rMrNr9r8rOr4rPrQrRrSrTrrXrY) r[r/r0r5r3r1r:r;rUrVrW) r[r/r0r5r3r1rOr4rPrVrZc@s eZdZdS)z'LongTest.test_from_bytes..myintNrtrrrrrr myintsrdr/r0)rErrr=Bzbigzlittlerbc@seZdZddZdS)z(LongTest.test_from_bytes..myint2cSst||dS)Nr)r3__new__)clsrrrr rg&sz0LongTest.test_from_bytes..myint2.__new__Nrtrrrgrrrr myint2%srjrc@seZdZddZdS)z(LongTest.test_from_bytes..myint3cSs d|_dS)Nbar)foo)r7rrrr r.sz1LongTest.test_from_bytes..myint3.__init__N)rtrrrrrrr myint3-srmrlZnonerk)F) r3r r"rarC bytearrayarray memoryviewrrrgetattr) r7r.r\r]r^r_rdrjr?rmrrr test_from_bytess&         zLongTest.test_from_bytescsFGdddtfddtdD}tt|D]}||dq0dS)Nc@seZdZdddZdS)z.IntegerrcSst||}d|_|S)Nrl)r3rgrl)rhrr7rrr rg;s zDLongTest.test_access_to_nonexistent_digit_0..Integer.__new__N)rrirrrr Integer:srscsg|] }dqS)rrrfrsrr r @sz?LongTest.test_access_to_nonexistent_digit_0..rr)r3r<maprC)r7Zintegersrrrtr "test_access_to_nonexistent_digit_06sz+LongTest.test_access_to_nonexistent_digit_0cCs@dD]6}dD],}|t||>t|t||?tq qdS)N)TF)rr)rCr"r3)r7rr rrr test_shift_boolDszLongTest.test_shift_boolc CsGdddt}ddddtjddd|d g}|D]H}|\}}|||ft|df|t|t|t|tq2dS) Nc@s eZdZdS)z-LongTest.test_as_integer_ratio..myintNrcrrrr rdLsrdrRrrrTFr)r3rras_integer_ratiorCr")r7rdr+r numerator denominatorrrr test_as_integer_ratioKs zLongTest.test_as_integer_ratioN)T)1rtrrr;r@rFrPrXrZr\r^r`rlrvrwrrrrZrequires_IEEE_754rrrrrrrrrrrrrZ cpython_onlyrZ bigmemtestrrr r r rrr%r`rrrvrwr{rrrr r0ss`'    9 E\a"  [     "Jcr0__main__)#Zunittestrrrr4rroint_infobits_per_digitr2ZBASEr>rKrJr_rYr<r?rLrrrrrmin_expr%rr&r$rr/ZTestCaser0rtmainrrrr sH   .l