K i[ dZddlZddlZddlmZddlmZmZm Z ejjdejjdzejjdzejjdzZ d diid did did did did did d id d iiid Z GddZGddZGddZGddZGddZGddZGddZGddZGdd ZGd!d"ZGd#d$Zd%Zd&Zej6j9d'gd(d)ZGd*d+Zej6j9d'e j?d,Z d-Z!ej6j9d'd.d/e"dd0d1gd2Z#ej6j9d'e j?d3Z$ej6j9d'e j?d4Z%ej6j9d5e ej6j9d'e j?d6Z&y)7z(Tests for the array padding functions. N) _as_pairs)assert_allcloseassert_array_equal assert_equaluintintfloatcomplexconstant_values end_values stat_length reflect_typeeven) constantedge linear_rampmaximummeanmedianminimumreflect symmetricwrapemptyc0eZdZdZdZdZdZdZdZy) TestAsPairsctjddggdz}ddgdggfD]}t|d}t||t }tt|dtj||ggdzy)z Test casting for a single value. Nnparrayrrobjectselfexpectedxresultobjs c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/lib/tests/test_arraypad.pytest_single_valuezTestAsPairs.test_single_value s}88aVHrM*aSA3% +Aq"%F  * +h c2  HHsCj\B& ' ctjddggdz}ddgddggfD]}t|d}t||t }ttd|gdtjd|ggdzttdgdggdtjddgddggttdg|ggdtjddg||ggy)z-Test proper casting for two different values.rraNr r$s r*test_two_valueszTestAsPairs.test_two_values-s88aVHrM*a&Aq6(# +Aq"%F  * +h sCj" % HHsCj\B& '  sQCj! $ HHq!fq!f% &  usena ( HHsCj3*- . r,chd}ttddd|ttddd|y)N)NNr3r3rFas_indexT)rrr%r&s r*test_with_nonezTestAsPairs.test_with_noneFs7= dA .    dA -  r,cxtjdjd}tt |d|y)z?Test if `x` already matching desired output are passed through. )r0r:N)r!arangereshaperrr6s r*test_pass_throughzTestAsPairs.test_pass_throughQs/99R=((0 h "  r,c ttddgddtjddggdztjttddgddtjdd ggdztjd d gd ggd d gdd gd d ggd d ggd d ggdzd dggzfD]4}t j td5t|ddddd6y#1swYAxYw)z Test results if `as_index=True`.g@gffffff @rTr4rdtypeg(\@r.r0 znegative valuesmatchN)rrr!r"intppytestraises ValueError)r%r's r* test_as_indexzTestAsPairs.test_as_indexYs sCj"t 4 HHq!fX]"'' 2   sDk2 5 HHq!fX]"'' 2 rdbTFRGaWAwi1b'q6(Q,1b'*, 0Az1BC 0!R$/ 0 0 0 0 0s C""C+ ctjtd5tdgggddddtjtd5tddgdd ggddddtjtd5tt j d ddddy#1swYxYw#1swYYxYw#1swYyxYw) z"Ensure faulty usage is discovered.zmore dimensions than allowedrFrrNzcould not be broadcastrCr0r.r0r)rIrJrKrr!ones)r%s r*test_exceptionszTestAsPairs.test_exceptionshs ]]:-K L # ugr " # ]]:-E F + 1v1v& * + ]]:-E F * bggfoq ) * *  # # + + * *s#B.B: C.B7:CCN) __name__ __module__ __qualname__r+r1r7r=rLrPr,r*rrs    2    0*r,rceZdZejj dejdZejj dgddZ ejj dgddZ y)TestConditionalShortcutsmodectjdjddd}|jDcgc]}d}}t |tj |||ycc}w)Nxr.r:rrrWr!r;r<shaperpadr%rWtest_pad_amts r*test_zero_padding_shortcutsz4TestConditionalShortcuts.test_zero_padding_shortcutsssQyy~%%aA.#'::.a6..4gD!AB/s A#)rrrrc tjdjddd}|jDcgc]}d}}t tj ||dtj |||d ycc}w) NrYr.rZr:rCrCrr\rCrWr r]r`s r*test_shallow_statistic_rangez5TestConditionalShortcuts.test_shallow_statistic_rangeysdyy~%%aA.#'::.a6..266$f=66$dJ L/s A:c tjdjdd}|jDcgc]}d}}t tj |||tj |||dycc}w)NrZr:)rrr\rgr]r`s r*test_clip_statistic_rangez2TestConditionalShortcuts.test_clip_statistic_rangesbyy}$$Q*#'::.a6..266$d;66$dK M/s A9N) rQrRrSrImark parametrize _all_modeskeysrdrhrkrTr,r*rVrVrs [[VZ__%67C8C  [[V%NOLPL  [[V%NOMPMr,rVc:eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zej"j%dgddZej"j%dgdej"j%dgddZdZej"j-dej"j-dej"j%dddgdZej"j%dddgdZy) TestStatisticctjdjd}tj|ddd}tjgd}t ||y)Ndf)r)rNr )?ryryryryryryryryryryryryryryryryryryryryryryryry?@@@@@@ @"@$@&@(@*@,@.@0@1@2@3@4@5@6@7@8@9@:@;@<@=@>@?@@@@@A@A@B@B@C@C@D@D@E@E@F@F@G@G@H@H@I@I@J@J@K@K@L@L@M@M@N@N@O@O@P@@P@P@P@Q@@Q@Q@Q@R@@R@R@R@S@@S@S@S@T@@T@T@T@U@@U@U@U@V@@V@V@V@W@@W@W@W@X@@X@X@X@rrrrrrrrrrrrrrrrrrrrr!r;astyper_r"rr%r/bs r*test_check_mean_stat_lengthz)TestStatistic.test_check_mean_stat_lengthsM IIcN ! !# & FF1lF C HH  & 1a r,ctjd}tj|dd}tjgd}t ||y)Nrsrur)crrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rDr r9 rwrvrj !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abrrrrrrrrrrrrrrrrrrrrrr!r;r_r"rrs r*test_check_maximum_1z"TestStatistic.test_check_maximum_1@ IIcN FF1h * HH 5 & 1a r,ctjddz}tj|dd}tjgd}t ||y)NrsrCrur)rsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsr;rs r*test_check_maximum_2z"TestStatistic.test_check_maximum_2sE IIcNQ  FF1h * HH ? & 1a r,ctjddz}tj|ddd}tjgd}t ||y)NrsrCrurrrx)rrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrsr;rs r*test_check_maximum_stat_lengthz,TestStatistic.test_check_maximum_stat_lengthsG IIcNQ  FF1h r : HH ? & 1a r,ctjd}tj|dd}tjgd}t ||y)NrsrurrrrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrrrrrrrrrrrrrrrrrrrrr;rs r*test_check_minimum_1z"TestStatistic.test_check_minimum_1s@ IIcN FF1h * HH + & 1a r,ctjddz}tj|dd}tjgd}t ||y)Nrsr0rur)r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrser0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r;rs r*test_check_minimum_2z"TestStatistic.test_check_minimum_2sE IIcNQ  FF1h * HH + & 1a r,ctjddz}tj|ddd}tjgd}t ||y)NrsrCrurrrx)rCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrsr3r3r3r3r3r3r3r3r3r3r3r3r3r3r3r3r3r3r3r3r;rs r*test_check_minimum_stat_lengthz,TestStatistic.test_check_minimum_stat_lengthsG IIcNQ  FF1h r : HH 5 & 1a r,ctjdjd}tj|dd}tjgd}t ||y)NrsrtrurH@rLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrrs r*test_check_medianzTestStatistic.test_check_median1sL IIcN ! !# & FF1h ) HH I & 1a r,ctjgdgdgdg}tj|dd}tjgdgdgdgd gdg}t||y) NrrCr.r.rZrDrDrr0rCr)r.r.rZr.r.rrrCr.rrZr.rZrDrZrrDrr0r)r!r"r_rrs r*test_check_median_01z"TestStatistic.test_check_median_01IsW HHiI6 7 FF1a " HH         1a r,ctjgdgdgdg}tj|jddj}tjgdgdgdgd gdg}t ||y) NrOrPrQrCr)rZr.rZr.rZrRrSrT)r!r"r_Trrs r*test_check_median_02z"TestStatistic.test_check_median_02Wsa HHiI6 7 FF1338 $ & & HH         1a r,ctjdjd}d|d<d|d<tj|ddd }tjgd }t ||y) Nrsrtr|rCrr9rurrrZrx)r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|rzr|r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrs r*test_check_median_stat_lengthz+TestStatistic.test_check_median_stat_lengthes_ IIcN ! !# &!" FF1hf = HH ? & 1a r,cgdg}tj|ddd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdg }t||y)Nr.rZr:rZrrr0rx)r.r.r.r.r.r.rZr:r:r:r:r:r:r:r:r!r_r"rrs r*test_check_mean_shape_onez'TestStatistic.test_check_mean_shape_onesc K FF1ff! 4 HH : : : : : : : : : : : : : < " 1a r,ctjdjd}tj|dd}tjgd}t ||y)NrsrtrurrKrrs r*test_check_mean_2zTestStatistic.test_check_mean_2sL IIcN ! !# & FF1h ' HH I & 1a r,rW)rrrrctjgdtjgdtjz}tj|d|}t |d|dy)z3 Test that appended and prepended values are equal )r0rd)rg-q=rr?rfrrdN)r!r"float64r_r)r%rWr/s r*test_same_prepend_appendz&TestStatistic.test_same_prepend_appendsJ HH[ !BHH]"**$M M FF1fd #QqT1R5!r,r rE)rE)rrd))rZr0)rEr))rBr0ctjdjd}d}tjt |5tj |d||dddy#1swYyxYw)Nrjr:rZ#index can't contain negative valuesrFr0rxr!r;r<rIrJrKr_)r%rWr arrrGs r*test_check_negative_stat_lengthz-TestStatistic.test_check_negative_stat_lengthsV iim##F+5 ]]:U 3 : FF34[ 9 : : :s A%%A.ctjd}tj|d}tj|ddd}tjgdgdgdgdgd gd gd gd gd gd gd g }t ||y) NrjrjrNrr0rrrg) r:r:r:rZr:rrrDrr) rCrCrCrrCr0rr.rr) rrrrrr9rrrr) rrrrrrrrrr) rrrrwrrrrrr) rrrrvrrrrrrr!r;r<r_r"rrs r*test_simple_stat_lengthz%TestStatistic.test_simple_stat_lengthst IIbM JJq& ! FF1&V F HH + + + + 5 5 5 5 5 5 5 7  1a r,z)ignore:Mean of empty slice:RuntimeWarningzCignore:invalid value encountered in( scalar)? divide:RuntimeWarningrrctjddgd|d}tjtjddtjtjg}t ||y)Nr{r|rCr0rrx)r!r_r"nanr)r%rWrmr&s r*test_zero_stat_length_validz)TestStatistic.test_zero_stat_length_validsK ffb"Xvt;88RVVRRVVRVV<=S(#r,rrc`d}tjt|5tjddgd|ddddtjt|5tjddgd|ddddtjt|5tjddgd|ddddtjt|5tjddgd|ddddy#1swYxYw#1swYxYw#1swYaxYw#1swYyxYw) Nz,stat_length of 0 yields no value for paddingrFr{r|rrx)rCrrCrIrJrKr!r_r%rWrGs r*test_zero_stat_length_invalidz+TestStatistic.test_zero_stat_length_invalids> ]]:U 3 5 FFB8Q! 4 5 ]]:U 3 : FFB8Q& 9 : ]]:U 3 5 FFB8Q! 4 5 ]]:U 3 : FFB8Q& 9 : :  5 5 : : 5 5 : :s/DD DD$D  DD!$D-N)rQrRrSrr<r?rArDrGrIrMrUrXr[r`rbrIrlrmrfrnrtfilterwarningsrxr|rTr,r*rqrqs?!0!0!0!0!0!0!0!0 ! !!4!,!0 [[V& "  " [[V%MN [[M:O: !* [[ KL [[M [[Vfh%78$9M $  [[Vi%;< := :r,rqcHeZdZdZdZdZdZdZdZdZ dZ d Z d Z y ) TestConstantctjd}tj|ddd}tjgd}t ||y)Nrsrur)rrwr )rrrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwr;rs r*test_check_constantz TestConstant.test_check_constantsB IIcN FF1h H E HH 5 & 1a r,ctjd}tj|dd}tjgd}t ||y)NrsrurrCr;rs r*test_check_constant_zerosz&TestConstant.test_check_constant_zeros s@ IIcN FF1h + HH 5 & 1a r,c tjdjdd}tj|ddd}tjgdgd gd gd gd gd gdgdg}t ||y)NrjrZr:rvr皙?rWr ) rCrCrCrCrCrCrCrCrC) rCrrCr0rr.rZrCrC) rCr:rrrDrrrCrC) rCr9rrrrrrCrC) rCrrrwrrrrCrC) rCrrvrrrrrCrCr!r;r<r_r"rr%rmrar&s r*test_check_constant_floatz&TestConstant.test_check_constant_float"sliim##Aq)vvc6 #&(88 0 0 0 0 0 0 0 0 2  h'r,c 0tjdjdd}|jtj}tj |ddd}tj gdgd gd gd gd gd gdgdg}t||y)NrjrZr:rvrvrrr) rrrrrrrrr) rrzr{r|r}r~rrr) rrrrrrrrr) rrrrrrrrr) rrrrrrrrr) rrrrrrrrrr!r;r<rrer_r"r)r%rm arr_floatrar&s r*test_check_constant_float2z'TestConstant.test_check_constant_float26siim##Aq)JJrzz* vvi!1 #&(88 J J J J J J J J L  h'r,ctjdt}tj|ddd}tjgd}t ||y)Nrsr?rur)皙333333r)rrrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrrrrrrrrrrrrrrrrrrrr)r!r;r r_r"rrs r*test_check_constant_float3z'TestConstant.test_check_constant_float3KsF IIc ' FF1h L I HH I & 1r,c tjdjdd}tj|ddd}tjgdgd gd gd gd gd gdg}t ||y)NrjrZr:)rCrhrrr) rrrrrrrrrr) rrrrCr0rr.rZrr) rrr:rrrDrrrr) rrr9rrrrrrr) rrrrrwrrrrr) rrrrvrrrrrrrrs r*"test_check_constant_odd_pad_amountz/TestConstant.test_check_constant_odd_pad_amountcsgiim##Aq)vvc)rtolatol)r!r;rr_r"rrs r*test_check_simplez TestLinearRamp.test_check_simplesR IIcN ! !# & FF1h & A HH F & 14d3r,c ,tjdjddjtj}tj |ddd}tj gdgd gd gd gd gd gdgdg}t||y)Nrwr.rZ)r0r0rr[rWr ) rzrzrzrzrzrzrzrzrz) rzrzrzryr{g?r|r{rz) rzrzrzr{r|r}r~r|rz) rzg@rrrrrg@rz) rzrrrrrrrrz) rz@rrrrr#@rz) rzg@rrg!@rrg@rzrrs r* test_check_2dzTestLinearRamp.test_check_2dsxiim##Aq)00<vvc6 &I88 B B B B B B B B DE h'r,) exceptionsc >ddlm}tj|dd|ddg}tj|ddd}tj|dd |d d |d d |d d |d d |dd |dd g}t ||y)Nr)FractionrCr0rdrNrrr9rr:rBrE) fractionsrr!r"r_r)r%rrmactualr&s r*test_object_arrayz TestLinearRamp.test_object_arrays&hhAQ89V-AF88 a  a  a  R  R  R  R    VX&r,ctjtjdjdddd}t |dddfd t |ddd fd t |dddfd t |d ddfd y) z!Ensure that end values are exact.rr0rZ){rr\Nrrzrd)r!r_rOr<r)r%r/s r*test_end_valueszTestLinearRamp.test_end_valuessq FF2772;&&q!,j} MQq!tWb!Qq"uXr"Qq!tWb!Qr1uXr"r,r@c\tjdg|}tj|ddd}tjgd|}t||tjdg|}tj|ddd}tjgd|}t||y) a< Check correct behavior of unsigned dtypes if there is a negative difference between the edge to pad and `end_values`. Check both cases to be independent of implementation. Test behavior for all other dtypes in case dtype casting interferes with complex dtypes. See gh-14191. rr?rrr)rrCr0rr0rCr)rr0rCrrCr0rN)r!r"r_r)r%r@r'r(r&s r*test_negative_differencez'TestLinearRamp.test_negative_differences HHaS &1=Q?881?VX& HHaS &1=Q?881?VX&r,N)rQrRrSrrrIrlxfailAssertionErrorrrrm_numeric_dtypesrrTr,r*rrs_40 ( [[>"34'5'$# [[Wo6'7'r,rcNeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z y ) TestReflectctjd}tj|dd}tjgd}t ||y)Nrsrur)rvrrrrrwrrrrrrrr9rrrDrrr:rZr.rr0rCrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rr:r9r8r7r6r5r4r3r2r1r0r/r.r-r,r+r*r)r(r'r;rs r*rzTestReflect.test_check_simpler=r,ctjd}tj|ddd}tjgd}t ||y)Nrsruroddr)irrBrArErdrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrsrFfghijklmnopqrstuvwr;rs r*test_check_odd_methodz!TestReflect.test_check_odd_methodsB IIcN FF1h  > HH ? & 1a r,cgdgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdgdg}t||y)Nr]r:rrr^r)rr:rrrr:rrrr:rrrr:rrZr.rZr:rZr.rZr:rZr.rZr:rZr.rZr_rs r*test_check_large_padz TestReflect.test_check_large_pad*sg  " FF1fi ( HH : : : : : : : : : : : : : : < $ 1a r,cgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdg }t||y)Nr]r^rrr_rs r*test_check_shapezTestReflect.test_check_shapeAsa K FF1fi ( HH : : : : : : : : : : : : : < " 1a r,c|tjgddd}tjgd}t||y)NrCr0rr0r)rr0rCr0rr0rCr_rs r* test_check_01zTestReflect.test_check_01Ws- FF9a + HH* +1a r,c|tjgddd}tjgd}t||y)Nrrr) r0rr0rCr0rr0rCr0r_rs r* test_check_02zTestReflect.test_check_02\s- FF9a + HH0 11a r,c|tjgddd}tjgd}t||y)Nrr.r) rCr0rr0rCr0rr0rCr0rr_rs r* test_check_03zTestReflect.test_check_03as- FF9a + HH6 71a r,ctjgdddgd}tjgd}t||y)NrrCrr)r0rCr0rr0rCr0rr0rCr0rr0rCr_rs r* test_check_04zTestReflect.test_check_04fs1 FF9q"gy 1 HH? @1a r,ctjgdddgd}tjgd}t||y)NrCr0rr.rrr);r.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0rr.rr0rCr0r_rs r* test_check_05zTestReflect.test_check_05ks7 FF<"b9 5 HH ( ) 1a r,ctjgdddgd}tjgd}t||y)Nr rr0r)r0rr.r.rr0rCrCr0rr.r.rr0rCrCr0rr.r.rr_rs r* test_check_06zTestReflect.test_check_06vs7 FF<"a+ 6 HH   1a r,ctjgdddgd}tjgd}t||y)N)rCr0rr.rZr:rrr)6r.rZr:r:rZr.rr0rCrCr0rr.rZr:r:rZr.rr0rCrCr0rr.rZr:r:rZr.rr0rCrCr0rr.rZr:r:rZr.rr0rCrCr0rr.rZr:r:rZr.r_rs r* test_check_07zTestReflect.test_check_07s8 FF%Aw < HH   1a r,N)rQrRrSrrrrrrrrr r rrTr,r*rrs9!0!0!.!,! ! ! ! !! !r,rceZdZdZej j deejddhz dZ ej j dejdZ y)TestEmptyArrayz FF288F#\ = > >  % % 0 0 > >s#C,C*),C6C'*C36C?c|tjtjdd|}|jdk(sJy)N)r0rr0)rrrrr\)rrr.)r!r_rOr^)r%rWr(s r*test_pad_non_empty_dimensionz+TestEmptyArray.test_pad_non_empty_dimensions0 *,>TJ||y(((r,N) rQrRrS__doc__rIrlrmsortedrnrorrrTr,r*rrsoF [[ z(J+@@A >  > [[VZ__%67)8)r,rc<eZdZdZdZdZdZdZdZdZ dZ y ) TestSymmetricctjd}tj|dd}tjgd}t ||y)Nrsrur)rrrrrwrrrrrrrr9rrrDrrr:rZr.rr0rCrrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrr:r9r8r7r6r5r4r3r2r1r0r/r.r-r,r+r*r)r(r;rs r*rzTestSymmetric.test_check_simples@ IIcN FF1h , HH 5 & 1a r,ctjd}tj|ddd}tjgd}t ||y)Nrsrurrr)rrrrrrrrrrrrrrrrrrrrrBrArErdrrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrrsrFrrrrrrrrrrrrrrrrrr;rs r*rz#TestSymmetric.test_check_odd_methodsB IIcN FF1h % @ HH ? & 1a r,cgdgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdgdg}t||y)Nr]rr^rrZr:r:rZr.r.rZr:r:rZr.r.rZr:r:)rrrrr:r:rrrrr:r:rrrr_rs r*rz"TestSymmetric.test_check_large_padsg  " FF1fk * HH : : : : : : : : : : : : : : < & 1a r,cgdgdg}tj|ddd}tjgdgdgdgdgd gd gd gd gd gd gd gd gd gd g}t||y)Nr]rr^rrr)rArErErdrrrCr0r0rr.r.rZr:r:)rdrrrCr0r0rr.r.rZr:r:rrr)rCr0r0rr.r.rZr:r:rrrrDrr)rr.r.rZr:r:rrrrDrrrr9r9)rZr:r:rrrrDrrrr9r9rrr)rrrrDrrrr9r9rrrrrr)rDrrrr9r9rrrrrrrrrr_rs r*test_check_large_pad_oddz&TestSymmetric.test_check_large_pad_oddsj  " FF1fk > HH I I I I I I I I I I I I I I K $ 1a r,cgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdg }t||y)Nr]r^rrr_rs r*rzTestSymmetric.test_check_shapesa K FF1fk * HH : : : : : : : : : : : : : < " 1a r,c|tjgddd}tjgd}t||y)Nrr0r)r0rCrCr0rrr0r_rs r*rzTestSymmetric.test_check_01s- FF9a - HH* +1a r,c|tjgddd}tjgd}t||y)Nrrr) rr0rCrCr0rrr0rCr_rs r*rzTestSymmetric.test_check_02s- FF9a - HH0 11a r,c|tjgddd}tjgd}t||y)Nrr:r)rCr0rrr0rCrCr0rrr0rCrCr0rr_rs r*rzTestSymmetric.test_check_03#s- FF9a - HHB C1a r,N) rQrRrSrrrrrrrrrTr,r*rrs*!0!0!0!.!,! ! !r,rc6eZdZdZdZdZdZdZdZdZ y) TestWrapctjd}tj|dd}tjgd}t ||y)Nrsrur)r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrrCr0rr.rZr:rrrDrrr9rrrrrrrrwrrrrrvrrrrrjrrrrrrrrrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:rrrCr0rr.rZr:rrrDrrr9rrrrrrrr;rs r*rzTestWrap.test_check_simple*s@ IIcN FF1h ' HH 5 & 1a r,c`tjd}tj|d}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdg}t ||y)Nr9r)rr9r)rrrrDrrrrDrrrrDrrrrDrrrrDrrrrDrr)r0rrrCr0rrrCr0rrrCr0rrrCr0rrrCr0rrrCr0r)r:rr.rZr:rr.rZr:rr.rZr:rr.rZr:rr.rZr:rr.rZr:rrsrs r*rzTestWrap.test_check_large_padBs IIbM JJq& ! FF1h ' HH.)).)).)).)).)).)).)).)).e3 /5 l 1a r,c|tjgddd}tjgd}t||y)Nrrr) rCr0rrCr0rrCr0rr_rs r*rzTestWrap.test_check_01~s- FF9a ( HH0 11a r,c|tjgddd}tjgd}t||y)Nrr.r) rrCr0rrCr0rrCr0rrCr_rs r*rzTestWrap.test_check_02s- FF9a ( HH6 71a r,ctjd}tj|dd}t||ddddfy)NrZ)rrZrr\r)r!rOr_rrs r*test_pad_with_zerozTestWrap.test_pad_with_zeros; GGFO FF1f6 *1aSbSk*r,cHtjd}tj|dd}ttj||||fdd|tjd}tj|dd}ttj||||fdd|y) zy Check wrapping on each side individually if the wrapped area is longer than the original array. rZ)r9rrr\rN)rr9rA)r!r;r_rr_rs r*test_repeated_wrappingzTestWrap.test_repeated_wrappings IIaL FF1gF +255Aq!,QR0!4 IIaL FF1gF +255Aq!,Sb115r,c tjdjdd}tj|ddgd}tjgdgdgdgdgdgdg}t ||y ) z Assert that 'wrap' pads only with multiples of the original area if the pad width is larger than the original array. r.r0rrrCrr\)rr0rr0rr0)rCrrCrrCrNrsrs r*&test_repeated_wrapping_multiple_originz/TestWrap.test_repeated_wrapping_multiple_originsf IIaL A & FF1vv&V 4 HH        !  1a r,N) rQrRrSrrrrr*r-r0rTr,r*r$r$)s&!0:!x! ! + 6!r,r$ceZdZdZdZy)TestEdgec tjd}tj|d}tj|dd}tjgdgdgdgdgdgdgdgdgdg }t ||y Nr9r.rrpr)rrrrrCr0r0r0)rrrrr.rZrZrZ)r:r:r:r:rrrr)rDrDrDrDrrrrrsrs r*rzTestEdge.test_check_simplesl IIbM JJq& ! FF1& / HH % % % % % ) ) ) ) +  1a r,ctjgd}tj|dd}tjgd}t||tjgdgdg}tj|dd}tj|dd}t||tjdj dd d }tj|dd}tj|d d}t||y) Nr)rvr)rCrCr0rrrr]rrr0rr.)rvrvrv)r!r"r_rr;r<)r%r/paddedr&s r*test_check_width_shape_1_2z#TestEdge.test_check_width_shape_1_2s HHY 9f-88./68, HHi+ ,9f-66!-v668, IIbM ! !!Q *9f-66!5v>68,r,N)rQrRrSrr8rTr,r*r2r2s !&-r,r2ceZdZdZdZy) TestEmptyctjdjdd}tj|ddgd}|jdk(sJt ||d d d d fy) Nrr.r:rNr/rr\)rDrr0rArrdr!r;r<r_r^rrs r* test_simplezTestEmpty.test_simples`iim##Aq)ff-G<||w&&&S&2qt,-r,ctjd}tj|gdd}|jdk(sJy)Nrrrr\rrrs r*rz"TestEmpty.test_pad_empty_dimensions5hhy!/g>||y(((r,N)rQrRrSr=rrTr,r*r:r:s . )r,r:c d}tjdjdd}tj|d|}tjgdgdgdgdgdgdg}t ||y)Nc&d|d|dd||d dy)NrrrCrT)vectorriaxiskwargss r* _padwithtensz6test_legacy_vector_functionality.._padwithtenss$ "} ! !# ! }~r,r:r0r)rrrrrrr)rrrrCr0rr)rrrr.rZrrrs)rDr/rs r* test_legacy_vector_functionalityrEsf$ ! Q"A q!\"A  % % % % % % ' Aq!r,c|tjdgdd}tjgd}t||y)NrCr0rr\)rrrCrrr_)r/rs r*test_unicode_moderGs. sAJ'A !Aq!r,rW)rrrrctjdd}d}tjdd}ttj||||y)Nr5) fill_valuerp)rDrr\)r!rrr_)rWr/rcrs r*test_object_inputrJs@ 4(AG 4(Arvvat4a8r,c *eZdZejj dgdejj dejdZejj dejdZ ejj dgdejj dejdZ ejj dd d d e d fd de fe ddd fdgejj dejdZ dZejj dgdejj dejdZy ) TestPadWidthr))r.rZr:r)rrhrr)rvr)rZr:))rr.rZ)rrCr0rWctjdjd}d}tjt |5tj |||dddy#1swYyxYw)Nrjrjz(operands could not be broadcast togetherrFrlr%rrWrmrGs r*test_misshaped_pad_widthz%TestPadWidth.test_misshaped_pad_widthsTiim##F+: ]]:U 3 ) FF3 4 ( ) ) ) A##A,ctjdjd}d}tjt |5tj |d|dddy#1swYyxYw)NrjrjzDinput operand has more dimensions than allowed by the axis remappingrF))rr)r.)rZ)rrrhrl)r%rWrmrGs r*test_misshaped_pad_width_2z'TestPadWidth.test_misshaped_pad_width_2sYiim##F+ ]]:U 3 H FF3@$ G H H HrPrgctjdjd}d}tjt |5tj |||dddy#1swYyxYw)NrjrjrkrFrlrNs r*test_negative_pad_widthz$TestPadWidth.test_negative_pad_widthsTiim##F+5 ]]:U 3 ) FF3 4 ( ) ) )rPzpad_width, dtype)3N)wordNr3N)g333333 @N))r0rr.rqrCrd)))grrqNcPtjdjd}d}|Qtjt |5tj |tj|||dddytjt |5tj |||dddtjt |5tj |tj||dddy#1swYyxYw#1swYdxYw#1swYyxYw)Nrjrjz%`pad_width` must be of integral type.rFr?)r!r;r<rIrJ TypeErrorr_r")r%rr@rWrmrGs r* test_bad_typezTestPadWidth.test_bad_type"siim##F+7  y6 DsBHHYe cvtjddg}ttj|dgdy)NrCr0)rrrCrCrr)r!r"rr_)rms r*test_constant_zero_defaultries) ((Aq6 Crvvc1~'9:r,rCconstTFcd|d}tjt|5tjgdd|dddy#1swYyxYw)Nzmode 'z' is not supportedrFrr.r\rz)rWrGs r*test_unsupported_moderljsDTF, -E z /( y!$'(((s AActjdjddddddddf}tj|d|}|jdk(sJt |ddddf|y)Nrr.r:r0rN)rrrAr<)rWrmr(s r*test_non_contiguous_arrayrnqsl ))B-  1 %cc3Q3h /C VVC &F <<6 !! !"ad #S)r,ctjdd}tj|d|jdsJtjdd}tj|d|jdsJy) z5Test if C and F order is preserved for all pad modes.)rZrC)orderrZ C_CONTIGUOUSF F_CONTIGUOUSN)r!rOr_flags)rWr's r*test_memory_layout_persistencervysf s#A 66!Q  # #N 33 3 s#A 66!Q  # #N 33 3r,r@ctjd|}tj|d|}|j|k(sJy)N)rr0rCr?rCr\)r!rr_r@)r@rWrmr(s r*test_dtype_persistencerxs8 ((9E *C VVC &F <<5  r,)'rrInumpyr!numpy.lib._arraypad_implr numpy.testingrrr_coresctypesrrnrrVrqrrrrrr$r2r:rErGrlrmrJrLrorgrir#rlrnrvrxrTr,r*r~s.KKHHVhhuhhw  hhy!"#A&  !$t$ D !d#t$' &)    P*P*fMM,f:f:R p)p)fR'R'jO!O!d))0C!C!L@!@!F$-$-N ) )( !IJ9K9NCNCb!23 74 7 ; !WfhdE!JK(L( !23*4*!23444/2!23!43!r,