K iPddlZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z m Z mZmZGddZGddZGdd ZGd d ZGd d ZGddZGddZej.j1edGddZGddZy)N)random) IS_WASMassert_assert_array_almost_equalassert_array_equal assert_equalassert_no_warnings assert_raises assert_warnssuppress_warningsc*eZdZdZdZdZdZdZy)TestSeedctjjd}t|j ddtjjd}t|j ddy)Nrii)npr RandomStaterrandintselfss d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/random/tests/test_random.py test_scalarzTestSeed.test_scalarsN II ! !! $QYYt_c* II ! !* -QYYt_c*ctjjtd}t |j ddtjjtj d}t |j ddtjjdg}t |j ddtjjdg}t |j ddy)N ririri )rrrrangerrarangers r test_arrayzTestSeed.test_arrays II ! !%) ,QYYt_c* II ! !"))B- 0QYYt_c* II ! !1# &QYYt_c* II ! !:, /QYYt_c*rctttjjdtt tjjdy)Nr TypeErrorrrr ValueErrorrs rtest_invalid_scalarzTestSeed.test_invalid_scalar&s.i!6!6=j"))"7"7j"))"7"7*Fj"))"7"79KLj"))"7"79LMrcRtttjjtj gtj tttjjgdgtttjjgdgdgy)Ndtyper*r+))r r%rrrarrayint64r&s rtest_invalid_array_shapez!TestSeed.test_invalid_array_shape3sdj"))"7"7hhr2 4j"))"7"7)Ej"))"7"7):C:E FrN)__name__ __module__ __qualname__rrr'r-r8rrrrs+ += NFrrceZdZdZdZy) TestBinomialctjdd}dD]D}ttjd|dk(t tj|||Fy)Nr+intr/)r?r*r)rzerosrrbinomialr)rrBps r test_n_zerozTestBinomial.test_n_zero=sR%( AA FOOAq)Q. / vua8% @ Arc`tttjdtj y)Nr*)r r%rrCrnanr&s r test_p_is_nanzTestBinomial.test_p_is_nanFsj&//1bff=rN)r9r:r;rErHr<rrr>r><s A>rr>c*eZdZdZdZdZdZdZy)TestMultinomialc4tjdddgy)Nd皙?皙?r multinomialr&s r test_basiczTestMultinomial.test_basicLs3c +rc4tjdgdy)NrL)rMrNrSrSrOr&s rtest_zero_probabilityz%TestMultinomial.test_zero_probabilityOs3 9:rctdtjddcxkxrdknctjddd}ttjd|kttj|dky)Nr"r4)rrrrall)rxs rtest_int_negative_intervalz*TestMultinomial.test_int_negative_intervalRsYfnnR,1r12 NN2r1 %rQw q2vrc ddg}ttjjd|tjdj dttjjd|tjdj dttjjd|tjdj dttjjd|ddgj dttjjd|dj dttjjd|tj dj dtttjjd|tdy)NrAr*r*r+r+r+r+r+r+r+) rrrrPuint32shaper6r r$floatrrDs r test_sizezTestMultinomial.test_sizeXs( #JRYY**1a1>DDfMRYY**1a1>DDfMRYY**1a1>DDfMRYY**1a!Q8>> JRYY**1a8>> JRYY**1a&1ABHH  i!6!61Ah rc tttjjdddggtttjjddgdggtttjjddgdggdgdgggtttjjdtj ddgddggy)Nrrr*)r r%rrrPr6r&s rtest_multidimensional_pvalsz+TestMultinomial.test_multidimensional_pvalsfsj"))"7"7q!fXFj"))"7"7qcA3ZHj"))"7"7sQCjA3QRPS*=UVj"))"7"7RXX1vPQSTvFV=WXrN)r9r:r;rQrTrYrbrdr<rrrJrJKs,;  YrrJc6eZdZdZdZdZdZdZdZdZ y) TestSetStatecd|_tj|j|_|jj |_yNiI)seedrrprng get_statestater&s r setup_methodzTestSetState.setup_methodns3 &&tyy1 YY((* rc|jjd}|jj|j|jjd}t t j ||k(y)N)rjtomaxint set_staterlrrrWroldnews rrQzTestSetState.test_basicssUii  $ DJJ'ii  $scz"#rc|jjd}|jj|j|jjd}t t j ||k(yNr2size)rjstandard_normalrqrlrrrWrrs rtest_gaussian_resetz TestSetState.test_gaussian_resetys[ii''Q'/ DJJ'ii''Q'/scz"#rcT|jj|jj}|jjd}|jj||jjd}t t j ||k(yrv)rjryrkrqrrrW)rrlrsrts r test_gaussian_reset_in_media_resz-TestSetState.test_gaussian_reset_in_media_ress{ !!# ##%ii''Q'/ E"ii''Q'/scz"#rc|jdd}|jjd}|jj||jjd}|jj|j|jjd}t t j ||k(t t j ||k(y)Nr,rorw)rlrjryrqrrrW)r old_statex1x2x3s rtest_backwards_compatibilityz)TestSetState.test_backwards_compatibilitysJJsO YY & &B & / I& YY & &B & / DJJ' YY & &B & /rRx !rRx !rc<|jjddyNrA)rjnegative_binomialr&s rtest_negative_binomialz#TestSetState.test_negative_binomials ##C-rctjt5|jj ddddy#1swYyxYw)Nr<)pytestraises IndexErrorrjrqr&s rtest_set_invalid_statez#TestSetState.test_set_invalid_states5 ]]: & $ II   # $ $ $s ?AN) r9r:r;rmrQrzr|rrrr<rrrfrfms%+ $ $ $ ". $rrfc 2eZdZejj Zejejejejejejejejejg ZdZdZdZdZdZdZdZdZy ) TestRandintcFtt|jdtyNr*r/)r r$rfuncr`r&s rtest_unsupported_typez!TestRandint.test_unsupported_typesiQed:Z?d;Z@d<ZAd=ZBd>ZCd?ZDd@ZEdAZFdBZGdCZHdDZIdEZJdFZKdGZLdHZMdIZNdJZOdKZPdLZQdMZRyN)OTestRandomDistcd|_yrhrir&s rrmzTestRandomDist.setup_method1s  rctjj|jtjjdd}tjddgddgddgg}t ||d y) Nr2r+_\*?琛?<p?,o?H?Z?decimal)rrrirandr6rrrdesireds r test_randzTestRandomDist.test_rand4sh tyy!1%((02EF02EF/1CDFG "&'2>rctjj|jtjjdd}tjddgddgddgg}t ||d y) Nr2r+!rctjj|jtjjddd}tjddgddgd d gg}t ||y) Ncr2r+rwr2))rrrirr6rrs r test_randintzTestRandomDist.test_randintDsd tyy!""3"8((RG "I #J() 67+rctjj|jt5}|j t }tjj ddd}tt|dk(dddtjddgdd gd d gg}t|y#1swY4xYw) Nrrrrwr*rr2rrrr) rrrir recordDeprecationWarningrandom_integersrlenr6rrsupwrrs rtest_random_integersz#TestRandomDist.test_random_integersLs tyy!   !C -.AYY..sBV.DF CFaK  !((RG "I #J() 67+ ! !s AB66B?ct5}|jt}tjj tj djtj dj}tt|dk(dddtj dj}t|y#1swY5xYw)Nlr*) r rrrrrrrrrrrs rtest_random_integers_max_intz+TestRandomDist.test_random_integers_max_intWs   !C -.AYY..rxx}/@/@/1xx}/@/@BF CFaK  ! ((3-##VW% ! !s BCCc tj5tjdtt tt j jt jdjt tt j jt jdjt jdjdddy#1swYyxYw)Nerrorr) warningscatch_warnings simplefilterrr rrrrrr&s rtest_random_integers_deprecatedz.TestRandomDist.test_random_integers_deprecatedfs  $ $ & @  ! !'+= > ,))33((3-++ - ,))33((3-++RXXc]->-> @ @ @ @s CC##C,ctjj|jtjjd}tjddgddgddgg}t ||d y) Nrrrrrrrrr)rrrir6rrs r test_randomzTestRandomDist.test_randomtsh tyy!!!&)((02EF02EF/1CDFG "&'2>rctjj|jtjjdd}tjgd}t ||y)Nr3)r+r2r+r2rrrichoicer6rrs rtest_choice_uniform_replacez*TestRandomDist.test_choice_uniform_replace|sD tyy!!!!Q'((<(67+rctjj|jtjjddgd}tjgd}t ||y)Nr3)皙?r 皙?r rD)r*r*r+r+rrs rtest_choice_nonuniform_replacez-TestRandomDist.test_choice_nonuniform_replacesJ tyy!!!!Q*>!?((<(67+rctjj|jtjjddd}tjgd}t ||y)Nr3r2Freplace)rr*r2rrs rtest_choice_uniform_noreplacez,TestRandomDist.test_choice_uniform_noreplacesI tyy!!!!Q!6((9%67+rctjj|jtjjdddgd}tjgd}t ||y)Nr3r2F)r g333333?rAr rrD)r+r2r*rrs r test_choice_nonuniform_noreplacez/TestRandomDist.test_choice_nonuniform_noreplacesP tyy!!!!Q$8":((9%67+rctjj|jtjjgdd}tjgd}t ||y)N)abcdr3)rrrrrrs rtest_choice_nonintegerz%TestRandomDist.test_choice_nonintegersF tyy!!!"6:((/067+rc ~tjj}tt|ddtt|ddtt|ddgddggdtt|gdtt|gddddgddgg tt|ddgdgd  tt|ddgdd d g tt|ddgdd d g tt|gdddtt|gdddtt|gdddtt|gdddtt|gdddgdy)Nr"r2g@r*r+r3)r*r+r2r3g?r )r r rMg?gr r1Frr,)r")r"r*)r*rrr)rrrr r%)rrs rtest_choice_exceptionsz%TestRandomDist.test_choice_exceptionss!!j&"a0j&"a0j&Aq6Aq6*:A>j&"a0j&,d|4 6j&1a&!Gj&1a&!T{Cj&1a&!SzBj&)QFj&)RGj&)UEJj&)WeLj&)Q#y 2rc  ddg}ttjtjj ddttjtjj ddttjtjj dd|ttjtjj dd|ttjtjj ddgdttjj dgddutj ddg}tj dt }||d <ttjj |d|ud }ttjtjj d|d ttjtjj d|d ttjtjj d|d| ttjtjj d|d| ttjtjj ddg|d ttjj dg|djd k(tj ddg}tj dt }||d <ttjj ||dj|ud }gd }ttjj d|dj|ttjj d|dj|ttjj d|d|j|ttjj d|d|j|ttjj tjd|dj|ttjjd d djdttjjd dd jdttjjddd jdttjj d d jdttjj gdjdttjj ddgdjdtttjjgdy)Nr ?r+TrFrr*r/rr<)r+r2)r r r r r rMr5)r2rr3rwi)rrrr)rrisscalarrrr6emptyobjectndimitemrr_rrr r%)rrDrarrrs rtest_choice_return_shapez'TestRandomDist.test_choice_return_shapess #J BII,,Q,=>? BII,,Q,>?@ BII,,Q,BCD BII,,Q,CDE BII,,aVT,BCD   $ 6$>? HHaV hhq'A   d 3q89 BKK 0 0At 0 DEEFBKK 0 0Au 0 EFFGBKK 0 0Atq 0 IJJKBKK 0 0Au 0 JKKLBKK 0 0!QD 0 IJJK   $D 9>>!CD HHaV hhq'A   a 6;;=BC  *RYY%%aD%9??CRYY%%aE%:@@!DRYY%%aDA%>DDaHRYY%%aEQ%?EEqIRYY%%biilAt%DJJAN RYY&&q!)&<BBINRYY&&q#A&6<z-TestRandomDist.test_shuffle..srxx|rc|Sr-r<r.s rr/z-TestRandomDist.test_shuffle..sqrcftj|jtjSr-)rasarrayastyperr.s rr/z-TestRandomDist.test_shuffle..srzz!}33BGG<rcftj|jtjSr-)rr2r3float32r.s rr/z-TestRandomDist.test_shuffle..srzz!}33BJJ?rcftj|jtjSr-)rr2r3 complex64r.s rr/z-TestRandomDist.test_shuffle..srzz!}33BLLArcRtj|jtSr-)rr2r3r r.s rr/z-TestRandomDist.test_shuffle..srzz!}33F;rc0|Dcgc]}||fc}Scc}wr-r<rXis rr/z-TestRandomDist.test_shuffle..s21A22s cVtj|Dcgc]}||gc}Scc}wr-)rr2r:s rr/z-TestRandomDist.test_shuffle..s!rzz1*=aAq6*=>*=s &cDtj||gjSr-)rvstackTr.s rr/z-TestRandomDist.test_shuffle..sryy!Q022rctj|Dcgc]}||fc}dtfdtfgjtjScc}wNrr)rr2r@rrecarrayr:s rr/z-TestRandomDist.test_shuffle..sE A+>qQF+>-0#Jc +C!E!%bkk!2+>s Actj|Dcgc]}||fc}dtfdtjfgScc}wrA)rr2r rr:s rr/z-TestRandomDist.test_shuffle..s8rzz1*=aAq6*=,/=3/*J L*=s ?) r*r+r2r3r4r5r r) rr*rEr5r+r3r4rrDr2)rrrishuffler)rconvalistrrs r test_shufflezTestRandomDist.test_shuffles, <?A;2>24LM 0D IINN499 %78E II  e $F9:G vw /+ 0rctjjtjt dddzdz d}tjjtj ddzdz d}|j }|j }t dD]}tjj|tt|j|jt|j|jtjj|tt|j|jt|j|jy)N)r4r3r2r*r"2) rma masked_valuesreshaperrcopyrrFrsorteddatamask)rrra_origb_origr;s rtest_shuffle_maskedz"TestRandomDist.test_shuffle_maskeds EE   59f = AA Er J EE   "  1A 5r :r LA II  a qvvqvvg' V[[L0I)J L II  a qvvqvvg' V[[L0I)J L  Lrrcdddddddd}tjtd 5}|j|dddd djvsJy#1swYxYw) Nrr*r+r2r3r4r5)rr*r+r2r3r4r5z!you are shuffling a 'dict' objectmatchr)rwarns UserWarningrFfilename)rrvaluesrecs rtest_shuffle_untyped_warningz+TestRandomDist.test_shuffle_untyped_warningsg1qQ1; \\+9; #>A FNN6 " #A/// # #s AAuse_array_likeTFcGddtj}dtjdgtjdtjdtjdg}tj|t}|Dchc] }t |c}|r|j |}tfd|DsJ|r[t|tjjs7tjtd 5|j|dddy|j|tfd |DsJycc}w#1swYyxYw) Nc eZdZy)>TestRandomDist.test_shuffle_no_object_unpacking..MyArrN)r9r:r;r<rrMyArrrcs rrdr2rrDr/c38K|]}t|vywr-id.0r;item_idss r zBTestRandomDist.test_shuffle_no_object_unpacking..)s22a5H$2z#Shuffling a one dimensional array.*rXc38K|]}t|vywr-rfrhs rrkzBTestRandomDist.test_shuffle_no_object_unpacking..2s6Qr!u(6rl)rndarrayr6float64r rgrrW isinstancer GeneratorrrZr[rF)rrr`rditemsr#r;rjs @r test_shuffle_no_object_unpackingz/TestRandomDist.test_shuffle_no_object_unpackings BJJ  "((A3-A bjjm hhuF+#()aBqE) ((5/C2c2222 *VRYY5H5H"Ik?A $s# $ $ FNN3 6#66 66* $ $sE EE ctjj|jtjdj}tjj |t tj|gdtjj|j}|j |t tj|gdtjj|j}|j |t tj|gdy)Nr4)rr*r3r2r+)rr*r+r2r3)r3r*rr2r+) rrrirrRrFrr2r default_rng)rrrngs rtest_shuffle_memoryviewz&TestRandomDist.test_shuffle_memoryview4s tyy! IIaL   !RZZ]O4ii##DII. ARZZ]O4ii##DII. ARZZ]O4rctjd}d|j_t j t d5tjj|dddy#1swYyxYw)Nr2Fz read-onlyrX) rrBflags writeablerrr%rrF)rrs rtest_shuffle_not_writeablez)TestRandomDist.test_shuffle_not_writeableCsP HHQK! ]]:[ 9 ! II  a  ! ! !s  A++A4ctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nr rrrwgAKč?ghA?g ҇o>gάXf+q?gS1$?g'8zX ?rr)rrribetar6rrs r test_betazTestRandomDist.test_betaIsl tyy!BV4(()+BC)+BC)+BCEF "&'2>rctjj|jtjjddd}tjddgddgd d gg}t ||y) NrLgv/?rrw%+r&0.-)rrrirCr6rrs r test_binomialzTestRandomDist.test_binomialRsd tyy!##CF#;((RHHH&' 67+rctjj|jtjjdd}tjddgddgdd gg}t ||d y) NrLrrwg+Q]uO@g+Q@gY7`ZqP@ge(fG@gvtR@gEIȋR@ r)rrri chisquarer6rrs rtest_chisquarezTestRandomDist.test_chisquareZsm tyy!$$Rf$5((13GH13GH02FGIJ "&'2>rcJtjj|jtjddg}tjjj |d}tjddgddggd d gd d ggd dgddggg}t ||dy)NIrctjddg}ttjj |tj dj dttjj |tj dj dttjj |tj dj dttjj |ddgj dttjj |dj dttjj |tjdj dtttjj|tdy)Nrrr*r[r+r\r]) rr6rrrr^r_r r$r`ras rtest_dirichlet_sizez"TestRandomDist.test_dirichlet_sizens HH*,@A BRYY((BIIaL9??HRYY((BIIaL9??HRYY((BIIaL9??HRYY((QF3999ERYY((F3999ERYY((BHHV,<=CCYOi!4!4aqBrc tjddg}tttjj j |tttj ddggtttj dgdggtttj dgdggdgdgggtttj tjddgddggy)NgHzG?gؗҜr4r*)rr6r r%rrr)rrs rtest_dirichlet_bad_alphaz'TestRandomDist.test_dirichlet_bad_alphazs'8,-j"))"2"2"<"rcttjjddt t tjjdyNrscale)rrrrr r%r&s rtest_exponential_0z!TestRandomDist.test_exponential_0s4RYY***3Q7j"))"7"7sCrctjj|jtjjddd}tjddgddgd d gg}t ||d y) N Mrrwg7?g`j?g6"+?gܳ2>?gc>+Y?g_}S?rr)rrrifr6rrs rtest_fzTestRandomDist.test_fsl tyy!R&1((02EF02EF02EFHI "&'2>rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nr4r2rrwgԏGM8@gȌ<@g ":@gv#)@gZQ?@gr[@@r)rrrigammar6rrs r test_gammazTestRandomDist.test_gammasl tyy!AF3((13GH13GH13GHJK "&'2>rcttjjdddt t tjjddy)Nr)r_rr)rrrrr r%r&s r test_gamma_0zTestRandomDist.test_gamma_0s3RYY__1A_6:j"))//CHrctjj|jtjjdd}tjddgddgddgg}t ||y) N_c97ݚ?rrwrrDr4r)rrri geometricr6rrs rtest_geometriczTestRandomDist.test_geometricsb tyy!$$Zf$=((QFHG%& 67+rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nr@rlocrrxgؕ?gs0?g#0g(xg-KD?gůp`@rr)rrrigumbelr6rrs r test_gumbelzTestRandomDist.test_gumbelso tyy!!!j&!I((02EF02FG02FGIJ "&'2>rcttjjddt t tjjdyr)rrrrr r%r&s r test_gumbel_0zTestRandomDist.test_gumbel_04RYY%%A%.2j"))"2"2#>rc tjj|jtjjdddd}tjddgddgddgg}t ||tjjdddd }tjgd }t ||tjjd dd d }tjgd }t ||tjjdddd }tjgd}t ||tjjdd d d }tjgd}t ||y)Nrr4rrrwrErr2r3)r2r2r2r2rr)rrrr)rrrr)rrrihypergeometricr6rrs rtest_hypergeometricz"TestRandomDist.test_hypergeometrics? tyy!))"a&)A((RHHF$% 67+))!Q):((<(67+))"a!)<((+,67+))!Q):((<(67+))!R!)<((<(67+rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nrrrrg bO?g¸?gpJm @g{K*t @g:^w-gY~o?rr)rrrilaplacer6rrs r test_laplacezTestRandomDist.test_laplaceso tyy!""z6"J((02EF02EF13FGIJ "&'2>rcttjjddt t tjjdyr)rrrrr r%r&s rtest_laplace_0zTestRandomDist.test_laplace_0s4RYY&&Q&/3j"))"3"33?rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nrrrrg#K-z?gJ?g92@gر[@g#+^˿g-@rr)rrrilogisticr6rrs r test_logisticzTestRandomDist.test_logisticso tyy!## #F#K((02DE02EF13FGIJ "&'2>rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nrrr)meansigmarxgɁ0@go,+4FB@g)ʭ6@g5?gnxNnP@g)U@rr)rrri lognormalr6rrs rtest_lognormalzTestRandomDist.test_lognormalso tyy!$$*Cf$M((13GH13FG13GHJK "&'2>rcttjjddt t tjjdy)Nr)rr*r)rrrrr r%r&s rtest_lognormal_0zTestRandomDist.test_lognormal_0s4RYY((q(115j"))"5"5SArctjj|jtjjdd}tjddgddgddgg}t ||y)Ngƀ@?r)rDrxr+r5rr2)rrri logseriesr6rrs rtest_logserieszTestRandomDist.test_logseriessb tyy!$$z$?((QFGF$% 67+rctjj|jtjjddgdzd}tjgdgdggdgd ggd gd gg}t ||y) NrKUUUUUU?r5rrw)r3r2r4r3r+r+)r4r+rr+r+r*)r2r3r2r5rr3)r+r*r3r2r5r3)r3r3r+r4r+r2)r3r2r3r+r2r3)rrrirPr6rrs rtest_multinomialzTestRandomDist.test_multinomialsw tyy!&&rF8a..tS9((-/?@A!&'2>1v1v1v^RYY%B%BD#N 29988$'/ 1 j"))"?"?s") +hhC3(+2::>   C II ) )$ 4 >*Aq6Q; ;   s AG""G+ctjj|jtjjddd}tjddgddgd d gg}t ||y) NrLg|Pk?r)nrDrxiPiIi|ici i)rrrirr6rrs rrz%TestRandomDist.test_negative_binomial.sd tyy!,,sf6,J((S#J #J #J() 67+rc|tjj|jtjjddd}tjddgddgdd gg}t ||d tjjd d d}tjddgddgddgg}t ||d tjj|jtjjddd}tjddgddgddgg}t ||d y)Nr4r)dfnoncrxgG7@g!ܴ*@g1}z9?@g+驸0@g26E_r#@gI!1@rrrArMg?gTD?g?T?g+qnl?g~|D?g밬?rg{01#@gprs'@g~;$@g"dI @g*@g }',@)rrrinoncentral_chisquarer6rrs rtest_noncentral_chisquarez(TestRandomDist.test_noncentral_chisquare6s5 tyy!//116/J((13GH13GH02FGIJ "&'2>//2BV/L((03FG03FG.1DEGH "&'2> tyy!//116/J((.0BC/1BC/1CDFG "&'2>rctjj|jtjjdddd}tjddgdd gd d gg}t ||d y)Nr4r+r*r)dfnumdfdenrrxg^~?g/+c?g". @g@g7?gE?rr)rrri noncentral_fr6rrs rtest_noncentral_fz TestRandomDist.test_noncentral_fKsv tyy!''aqq-3(5((02EF02EF02DEGH "&'2>rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nrrrrg&&n@gOG_ @g~w@gtw]տgm&5@g$>@rr)rrrinormalr6rrs r test_normalzTestRandomDist.test_normalTso tyy!!!j&!I((02EF.0DE02EFHI "&'2>rcttjjddt t tjjdyr)rrrrr r%r&s r test_normal_0zTestRandomDist.test_normal_0\rrctjj|jtjjdd}tjddgddgdd gg}tj j ||d y) NrrrrxgW I@g Ԩy@gy]0Ag1~\Aga@gY 7A)nulp)rrriparetor6testingassert_array_almost_equal_nulprs r test_paretozTestRandomDist.test_pareto`sz tyy!!!JV!<(()+BC)+BC)+BCEF 11&'1Krctjj|jtjjdd}tjddgddgddgg}t ||y)Nrr)lamrxrr*)rrripoissonr6rrs r test_poissonzTestRandomDist.test_poissonosb tyy!""z"?((QFFF$% 67+rctjdj}d}tttj j |tttj j |gdztttj j |tttj j |gdzy)Nrr"r)rrrr r%rr)rlambiglamnegs rtest_poisson_exceptionsz&TestRandomDist.test_poisson_exceptionsws~#""j"))"3"3V<j"))"3"3fX]Cj"))"3"3V<j"))"3"3fX]Crctjj|jtjjdd}tjddgddgdd gg}t ||d y) Nrrrg;'?gܴw*?g5?gFG?gD]?g$`?rr)rrripowerr6rrs r test_powerzTestRandomDist.test_powersj tyy!:F;((02EF02EF02EFHI "&'2>rctjj|jtjjdd}tjddgddgdd gg}t ||d y) Nrr)rrxg"u+@gN$MB*@g7v8B4@g55@ge&@g~ӣZ1@rr)rrrirayleighr6rrs r test_rayleighzTestRandomDist.test_rayleighsm tyy!##"6#:((02DE13GH13GHJK "&'2>rcttjjddt t tjjdyr)rrrrr r%r&s rtest_rayleigh_0zTestRandomDist.test_rayleigh_0s4RYY''a'0!4j"))"4"4C@rctjj|jtjjd}tjddgddgddgg}t ||d y) NrrwgMoDL?g6([9grF=?gM' -gVgVA:Qy?rr)rrristandard_cauchyr6rrs rtest_standard_cauchyz#TestRandomDist.test_standard_cauchysk tyy!***7((02FG02FG13FGIJ "&'2>rctjj|jtjjd}tjddgddgddgg}t ||d y) Nrrwg܁?gc!z?g&N"@gNI@gF>?g~ME?rr)rrristandard_exponentialr6rrs rtest_standard_exponentialz(TestRandomDist.test_standard_exponentialsk tyy!//V/<((02EF/1DE/1DEGH "&'2>rctjj|jtjjdd}tjddgddgdd gg}t ||d y) Nr2r)r_rxg)@gľ@gd],q@gPk{@g9B #1@gv @rr)rrristandard_gammar6rrs rtest_standard_gammaz"TestRandomDist.test_standard_gammasm tyy!)))?((02EF02EF02CDFG "&'2>rcttjjddt t tjjdy)Nr)r_r)rrrrr r%r&s rtest_standard_gamma_0z$TestRandomDist.test_standard_gamma_0s4RYY--A-6:j"))":":#Frctjj|jtjjd}tjddgddgddgg}t ||d y) Nrrwrrrrrrrr)rrriryr6rrs rtest_standard_normalz#TestRandomDist.test_standard_normalsk tyy!***7((02EF.0CD.0CDFG "&'2>rctjj|jtjjdd}tjddgddgdd gg}t ||d y) Nrr)rrxg\VH?ghU%gH$M?gLgVqdzǿg㖀?rr)rrri standard_tr6rrs rtest_standard_tzTestRandomDist.test_standard_tsm tyy!%%&%9((02FG02FG13FGIJ "&'2>rctjj|jtjjdddd}tjddgdd gd d gg}t ||d y)Ng{Gz@g(\u$@gףp= W4@r)leftmoderightrxg:}\)@ghرTj(@gǨL30@g6ڜA0@g6sh&@g<,@rr)rrri triangularr6rrs rtest_triangularzTestRandomDist.test_triangularsv tyy!%%4e5+1&3((13FG13GH13FGIJ "&'2>rctjj|jtjjddd}tjddgddgd d gg}t ||d y) NGz?gGz%@r)lowhighrxg>#H@gu@g#@g}d]#@gN@gw )* @rr)rrriuniformr6rrs r test_uniformzTestRandomDist.test_uniformso tyy!""t%f"E((02EF02EF02EFHI "&'2>rcTtjdj}tjdj}tjj }t t|tj dt t|dtjt t|||t t|tj gdgt t|dgtjgtjj tj|d|dz y)Nr`rr*g؅W4vC)rr) rfinforrrrr OverflowErrorinf nextafter)rfminfmaxfuncs rtest_uniform_range_boundsz(TestRandomDist.test_uniform_range_boundssxx $$xx $$yy  mTBFF7A6mTABFF;mTDD9mTRVVG9qc:mTA39 bll43$+FrcGddtj}tjdj|}t t tj j||Gddtj}tjdj|}t t tj j|ddy)NceZdZdZy)GTestRandomDist.test_scalar_exception_propagation..ThrowingFloatctr-r$r&s r __float__zQTestRandomDist.test_scalar_exception_propagation..ThrowingFloat.__float__rN)r9r:r;r*r<rr ThrowingFloatr's rr,g?ceZdZdZeZy)ITestRandomDist.test_scalar_exception_propagation..ThrowingIntegerctr-r)r&s r__int__zQTestRandomDist.test_scalar_exception_propagation..ThrowingInteger.__int__r+rN)r9r:r;r0 __index__r<rrThrowingIntegerr.s  Irr2r*) rrnr6rr r$rrr)rr,throwing_floatr2 throwing_ints r!test_scalar_exception_propagationz0TestRandomDist.test_scalar_exception_propagations BJJ #++M:i!2!2N$ & bjj xx{''8 i!9!9<ANrctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nrp= ף?rmukapparxgLZI@g'N"@gkr?gk=m@gډ?g^=\?rr)rrrivonmisesr6rrs r test_vonmiseszTestRandomDist.test_vonmisesso tyy!##t4f#E((02EF02EF02EFHI "&'2>rctjj|jtjjddd}tjj tj |jy)NrSg g5_PG>i@Br8)rrrir;rrisfiniterW)rrs rtest_vonmises_smallz"TestRandomDist.test_vonmises_smallsT tyy! II  "F  ? 2;;q>--/0rctjj|jtjjddd}tjddgddgd d gg}t ||d y) Nrr7r)rrrxgZ@g- g@g8 m?gVP"?g`V?gx^&3?rr)rrriwaldr6rrs r test_waldzTestRandomDist.test_waldsl tyy!TFC((02EF02EF02EFHI "&'2>rctjj|jtjjdd}tjddgddgdd gg}t ||d y) Nrrrg@6?g]A?g(1ڥR?gU?g2_u?g^}-Q?rr)rrriweibullr6rrs r test_weibullzTestRandomDist.test_weibullsm tyy!""T"7((02EF02EF02EFHI "&'2>rc&tjj|jttjj ddtj dt ttjjdy)Nrrrr)r)rrrirrErBr r%r&s rtest_weibull_0zTestRandomDist.test_weibull_0sR tyy!RYY&&&4bhhrlCj"))"3"3s;rctjj|jtjjdd}tjddgddgddgg}t ||y) NrrrBr*r2r)rrrizipfr6rrs r test_zipfzTestRandomDist.test_zipfs_ tyy!$V4((RHFG%& 67+rN)Sr9r:r;rmrrrrrrrrr rrrrr$r'r*rIrVrmark parametrizerrrrur_rsrwr{r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrr$r5r<r@rCrFrHrMr<rrrr-s1??, , & @?, , , ,, 2&,<\< & 04 L [[X YY --/1F1F1H IK0K0 [[X BII))+RYY-B-B-DEG [[-e}=7>G70 5! ?,? ? C P?D??I,??,4?@??B, ,&P,?*??? L,D??A???G????G O0?1 ??< ,rrceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"y!)" TestBroadcastcd|_y)Ni[rr&s rrmzTestBroadcast.setup_method's  rcVtjj|jyr-)rrrir&s rsetSeedzTestBroadcast.setSeed*s tyy!rcdg}dg}tjj}tjgd}|j ||dz|}t ||d|j |||dz}t ||dy)Nrr*gl ?g_x ?g =*BN?r2rr)rrrr6rTr)rrrrrrs rrzTestBroadcast.test_uniform0s~cs))##((12 q$'!&'2> dQh'!&'2>rctdg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz||j |||dz}t ||dt t|||dzy)Nrr*r")g-r@gYl@g-`w?r2rr)rrrr6rTrr r%)rrr bad_scalerrrs rrzTestBroadcast.test_normal@scD !!((01 a'!&'2>j&#'9= UQY'!&'2>j&#y1}=rcdg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz|t t||dz||j |||dz}t ||dt t|||dzt t|||dzy) Nr*r+r"r,)gnQVf?gVKB?g v`k?r2rr)rrr}r6rTrr r%)rrrbad_abad_br}rrs rr~zTestBroadcast.test_betaSs C Cyy~~((12 a!eQ!&'2>j$ 15j$Au5 aQ!&'2>j$q1u5j$5195rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzyNr*r")g.UgZ?giPrq?gE K?r2rr)rrrr6rTrr r%)rrrXrrrs rrzTestBroadcast.test_exponentialisgD ii++ ((12 UQY'!&'2>j+y1}=rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzyr])rrrr6rTrr r%)rr_ bad_shape std_gammarrs rrz!TestBroadcast.test_standard_gammavsgD II,, ((12 519%!&'2>j)Y];rcdg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz|t t||dz||j |||dz}t ||dt t|||dzt t|||dzy) Nr*r+r"r,)g.UgZ?giPrq?gE K?r2rr)rrrr6rTrr r%)rr_rr_rXrrrs rrzTestBroadcast.test_gammasD D  ((01 uqy%(!&'2>j%Q>j%I> ueai(!&'2>j%EAI>j% A >rcdg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz|t t||dz||j |||dz}t ||dt t|||dzt t|||dzy) Nr*r+r"r,)gbyʜ?go?gT7@r2rr)rrrr6rTrr r%)rrr bad_dfnum bad_dfdenrrrs rrzTestBroadcast.test_fsD D IIKK((01 519e$!&'2>j!Y]E:j!UQY : 5%!)$!&'2>j!Y :j!UIM:rcdg}dg}dg}dg}dg}dg}tjj}tjgd}|j ||dz||} t | |d t t||dz||t t||dz||t t||dz|||j |||dz|} t | |d t t|||dz|t t|||dz|t t|||dz||j ||||dz} t | |d t t||||dzt t||||dzt t||||dzy) Nr+r2r3rr"r,)gr^G"@g/ *@gц!@rr)rrrr6rTrr r%) rrrrrcrdbad_noncnonc_frrs rrzTestBroadcast.test_noncentral_fsysC D 4''((01  5$/!&'2>j&)a-Ej&%!)YEj&%!)UHE uqy$/!&'2>j&)UQYEj&%QEj&%HE udQh/!&'2>j&)UD1HEj&%D1HEj&%1 Erc|jtjddg}tjj dddd}t ||dy)Ngaz@gn4M;%?rr+rwrr)rTrr6rrr)rrrs rtest_noncentral_f_small_dfz(TestBroadcast.test_noncentral_f_small_dfsI ((-/@AB''S!!'<!&'2>rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzy)Nr*r")g~}N??g$F?g'rS?r2rr)rrrr6rTrr r%)rrbad_dfrrrs rrzTestBroadcast.test_chisquaresgSII'' ((01 26"!&'2>j)VaZ8rcdg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz|t t||dz||j |||dz}t ||dt t|||dzt t|||dzy) Nr*r+r"r,)g w"@g2 WR@gRY@r2rr)rrrr6rTrr r%)rrrrkrfnonc_chirrs rrz'TestBroadcast.test_noncentral_chisquaresSs49911((01 "q&$'!&'2>j(FQJ=j(BFH= "dQh'!&'2>j(FD1H=j(B1 =rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzy)Nr*r")gT @g~Fl@gƚtp?r2rr)rrrr6rTrr r%)rrrktrrs rrzTestBroadcast.test_standard_tsfS II ((01 26!&'2>j!VaZ0rctdg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz||j |||dz}t ||dt t|||dzy)Nr+r*r")gW!@gOBg}?r2rr)rrr;r6rTrr r%)rr9r: bad_kappar;rrs rr<zTestBroadcast.test_vonmisessSD 99%%((12 "q&%(!&'2>j(BFI> "eai(!&'2>j(B A >rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzy)Nr*r")g&8??geFX?gՋː?r2rr)rrrr6rTrr r%)rrrZrrrs rrzTestBroadcast.test_paretosf C!!((01 A!&'2>j&%!)4rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzyr])rrrEr6rTrr r%)rrrZrErrs rrFzTestBroadcast.test_weibull&sf C))##((12 Q!&'2>j'5195rcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzy)Nr*r"rVr2rr)rrrr6rTrr r%)rrrZrrrs rrzTestBroadcast.test_power3sd C ((12 q1u!&'2>j%3rctdg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz||j |||dz}t ||dt t|||dzy)Nrr*r")g:BKc?g3k?g~q?r2rr)rrrr6rTrr r%)rrrrXrrrs rrzTestBroadcast.test_laplace@scD ))##((23 q%(!&'2>j'37I> eai(!&'2>j'3 A >rctdg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz||j |||dz}t ||dt t|||dzy)Nrr*r")g'Zy?gdSO=?g3L1?r2rr)rrrr6rTrr r%)rrrrXrrrs rrzTestBroadcast.test_gumbelSscD !!((12 a'!&'2>j&#'9= UQY'!&'2>j&#y1}=rctdg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz||j |||dz}t ||dt t|||dzy)Nrr*r")g“y?gJR?g ~&?r2rr)rrrr6rTrr r%)rrrrXrrrs rrzTestBroadcast.test_logisticfscD 99%%((23 #'5)!&'2>j(C!GY? #uqy)!&'2>j(CQ?rctdg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz||j |||dz}t ||dt t|||dzy)Nrr*r")gH"@gܮ @gvv :@r2rr)rrrr6rTrr r%)rrr bad_sigmarrrs rrzTestBroadcast.test_lognormalyssD II'' ((01 4!8U+!&'2>j)TAXyA 4+!&'2>j)T9q=Arcdg}dg}tjj}tjgd}|j ||dz}t ||dt t||dzy)Nr*r")gݱlo?g/ӂ?gz~R?r2rr)rrrr6rTrr r%)rrrXrrrs rrzTestBroadcast.test_rayleighsgD 99%%((01 %!)$!&'2>j(IM:rcdg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||dt t||dz|t t||dz||j |||dz}t ||dt t|||dzt t|||dzt t|d dt t|dd y) NrAr*rr,)g@m e?g`I߿?g|2?r2rrrS)rrrBr6rTrr r%)rrrbad_meanrXrBrrs rrCzTestBroadcast.test_waldsu3D yy~~((01 dQh&!&'2>j$1 e<j$q)< dEAI&!&'2>j$%!)<j$i!m<j$Q/j$S1rc"dg}dg}dg}dg}dg}|dz\}}tjj}tjgd} |j ||dz||} t | | dt t||dz||t t||dz||t t||dz|||j |||dz|} t | | dt t|||dz|t t|||dz|t t|||dz||j ||||dz} t | | dt t||||dzt t||||dzt t||||dzy)Nr*r2r+r3)g,P;bD@g%G@g,~S@rr)rrrr6rTrr r%) rrrr bad_left_one bad_mode_one bad_left_two bad_mode_tworrrs rrzTestBroadcast.test_triangularssss s %*QY" lYY)) ((01 D1HdE2!&'2>j*lQ.>eLj*dQh eLj*lQ.>   D$(E2!&'2>j*lD1HeLj*dL14DeLj*lL1j*lD%!)Lj*dL%!)Lj*lLai !rc dg}dg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||t t||dz|t t||dz|t t||dz||j |||dz}t ||t t|||dzt t|||dzt t|||dzy)Nr*rAr"?r*r*r*r2)rrrCr6rTrr r%) rrrDbad_n bad_p_one bad_p_twobinomrrs rrzTestBroadcast.test_binomials C ED E  ""((9% q1ua67+j%A6j%Q :j%Q : q!a%67+j%A6j%IM:j%IM:rc dg}dg}dg}dg}dg}tjj}tjgd}|j ||dz|}t ||t t||dz|t t||dz|t t||dz||j |||dz}t ||t t|||dzt t|||dzt t|||dzy)Nr*rAr"r)r*rr*r2)rrrr6rTrr r%) rrrDrrr neg_binomrrs rrz$TestBroadcast.test_negative_binomials C ED E II// ((9% 1q5!$67+j)UQY:j)QUI>j)QUI> 1a!e$67+j)UAE:j)Q A >j)Q A >rcltjjj}dg}dg}|dzg}tjj}tj gd}|j ||dz}t||tt||dztt||dzy)Nr*r"r+)r*r*rr2) rrr_poisson_lam_maxrr6rTrr r%)rmax_lamr bad_lam_one bad_lam_tworrrs rrzTestBroadcast.test_poissons))'')::cd {m ))##((9% q!67+j';?;j';?;rcdg}dg}tjj}tjgd}|j ||dz}t ||t t||dztjd5t t|tjt t|ddtjgdddy#1swYyxYw)Nr+r)r+r+r*r2r)invalid) rrrLr6rTrr r%errstaterG)rrrZrLrrs rrMzTestBroadcast.test_zipfs Cyy~~((9% a!e67+j$ 2 [[ * < *dBFF 3 *dQ266N ; < < &6, > <?,;,FB? 9>, 1?& 5 6 4?&>&@&B& ;20"!H;.?. < < 7!OF .gen_random{s|||/CHr)rrrrrs rrzTestThread.test_normalzs 0 J84rc0d}|j|dy)NcT|jtjd|d<y)NrLrr.)rronesrs rrz'TestThread.test_exp..gen_randoms"((rww{/C(DCHrrrrrs rtest_expzTestThread.test_exps E J;7rc0d}|j|dy)Nc:|jddgdzd|d<y)Nrrr5rrw.)rPrs rrz/TestThread.test_multinomial..gen_randoms#((fX\(FCHr)rr5rrrs rrzTestThread.test_multinomials G J:6rN)r9r:r;rmrrrrr<rrrr^s+,5 8 7rrc*eZdZdZdZdZdZdZy)TestSingleEltArrayInputctjdg|_tjdg|_tjdg|_d|_y)Nr+r2r3)r*)rr6argOneargTwoargThreetgtShaper&s rrmz$TestSingleEltArrayInput.setup_methods<hhsm hhsm !   rc |tjjtjjtjjtjj tjj tjjtjjtjjtjjtjjtjjtjjf }tjjtjjf}|D]U}||vr|tjdg}n||j}t!|j"|j$Wyr)rrrrrrrrErrrrLrrr6rrr_r)rfuncs probfuncsr#rs rtest_one_arg_funcsz*TestSingleEltArrayInput.test_one_arg_funcss&& (@(@$$bii&:&:!!299#4#4"))"4"4""BIINN$$bii&9&9 ;YY(("))*=*=>  3Dy 288SE?+4;;' DMM 2 3rctjjtjjtjjtjj tjj tjjtjjtjjtjjtjjtjjtjjtjjtjjf}tjjtjjf}|D]}||vrtj dg}n |j"}||j$|}t'|j(|j*||j$d|}t'|j(|j*||j$|d}t'|j(|j*y)NrAr)rrrrr}rrrr;rrrrrBrCrr6rrrr_r)rrrr#rrs rtest_two_arg_funcsz*TestSingleEltArrayInput.test_two_arg_funcssp""BII$4$4bii<<##RYY%6%6!!299#5#5$$biinn##RYY%@%@ BYY'')D)DE  3Dy 3%t{{F+C DMM 2t{{1~v.C DMM 2t{{F1I.C DMM 2 3rc ttjtjtjtj tj tjtjtjg }tjj}tjdg}tjdg}|D]}||||}t|j|j||d||}t|j|j|||d|}t|j|jy)Nr*rr/)rrrrrrrr^r7rrrr6rr_r)rrr#rrrrs rrz$TestSingleEltArrayInput.test_randintsrww"((BII299bhh ;yy  xx}hhsm 3BsD+C DMM 2s1vt2.C DMM 2sDG2.C DMM 2 3rchtjjtjjtjjg}|D]}||j |j |j}t|j|j||j d|j |j}t|j|j||j |j d|j}t|j|jy)Nr) rrrrrrrrrr_r)rrr#rs rtest_three_arg_funcsz,TestSingleEltArrayInput.test_three_arg_funcss'')=)=))+ 3Dt{{DKK?C DMM 2t{{1~t{{DMMBC DMM 2t{{DKKNDMMBC DMM 2 3rN)r9r:r;rmrrrrr<rrrrs 3&363" 3rr)rrrnumpyrr numpy.testingrrrrrr r r r rr>rJrfrrrQrNskipifrrr<rrrs     $F$FN > >YYD2$2$jH+H+Vt ,t ,nw<w