bg. dZddlZddlZddlmZmZmZddlm Z ej dej dzej dzej dzZ d diid did did did did did d id d iiid Z GddZ GddZGddZGddZGddZGddZGddZGddZGdd ZGd!d"ZGd#d$Zd%Zd&Zejd'gd(d)ZGd*d+Zejd'e d,Zd-Z ejd'd.d/e!dd0d1gd2Z"ejd'e d3Z#ejd'e d4Z$ejd5e ejd'e d6Z%dS)7z(Tests for the array padding functions. N)assert_array_equalassert_allclose assert_equal) _as_pairsuintintfloatcomplexconstant_values end_values stat_length reflect_typeeven) constantedge linear_rampmaximummeanmedianminimumreflect symmetricwrapemptyc2eZdZdZdZdZdZdZdZdS) TestAsPairsctjddggdz}ddgdggfD]"}t|d}t||#t }tt|dtj||ggdzdS)z Test casting for a single value. Nnparrayrrobjectselfexpectedxresultobjs p/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/numpy/lib/tests/test_arraypad.pytest_single_valuezTestAsPairs.test_single_value!s8aVHrM**aSA3% + +Aq"%%F  * * * *hh c2   HsCj\B& ' '     ctjddggdz}ddgddggfD]"}t|d}t||#t }ttd|gdtjd|ggdzttdgdggdtjddgddggttdg|ggdtjddg||ggdS)z-Test proper casting for two different values.rraNr r$s r*test_two_valueszTestAsPairs.test_two_values.s18aVHrM**a&Aq6(# + +Aq"%%F  * * * *hh sCj" % % HsCj\B& ' '    sQCj! $ $ Hq!fq!f% & &    usena ( ( HsCj3*- . .     r,cd}ttddd|ttddd|dS)N)NNr3r3rFas_indexT)rrr%r&s r*test_with_nonezTestAsPairs.test_with_noneGsa= dA . . .      dA - - -      r,ctjdd}tt |d|dS)z?Test if `x` already matching desired output are passed through. )r0r:N)r!arangereshaperrr6s r*test_pass_throughzTestAsPairs.test_pass_throughRsI9R==((00 h " "      r,c ttddgddtjddggdztjttddgddtjdd ggdztjd d gd ggd d gdd gd d ggd d ggd d ggdzd dggzfD]G}t jtd5t|dddddn #1swxYwYHdS)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_indexZso sCj"t 4 4 4 Hq!fX]"' 2 2 2     sDk2 5 5 5 Hq!fX]"' 2 2 2   rdbTFRGaWAwi1b'q6(Q,1b'*, 0 0Az1BCCC 0 0!R$//// 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s C,,C0 3C0 ctjtd5tdgggddddn #1swxYwYtjtd5tddgdd ggddddn #1swxYwYtjtd5tt jd dddddS#1swxYwYdS) z"Ensure faulty usage is discovered.zmore dimensions than allowedrFrrNzcould not be broadcastrCr0r.r0r)rIrJrKrr!ones)r%s r*test_exceptionszTestAsPairs.test_exceptionsis ]:-K L L L # # ugr " " " # # # # # # # # # # # # # # # ]:-E F F F + + 1v1v& * * * + + + + + + + + + + + + + + + ]:-E F F F * * bgfooq ) ) ) * * * * * * * * * * * * * * * * * *s3<AA"BB  B +#CC"CN) __name__ __module__ __qualname__r+r1r7r=rLrPr,r*rr sn       2        0 0 0*****r,rceZdZejdedZejdgddZ ejdgddZ dS)TestConditionalShortcutsmodectjdddd}d|jD}t |tj|||dS)Nxr.r:cg|]}dS)rrrT.0_s r* zHTestConditionalShortcuts.test_zero_padding_shortcuts..w...a6...r,rWr!r;r<shaperpadr%rWtestpad_amts r*test_zero_padding_shortcutsz4TestConditionalShortcuts.test_zero_padding_shortcutsts]y~~%%aA....4:...4gD!A!A!ABBBBBr,)rrrrc tjdddd}d|jD}t tj||dtj|||d dS) NrYr.rZr:cg|]}dS)rCrCrTr]s r*r`zITestConditionalShortcuts.test_shallow_statistic_range..}rar,rrbrCrWr rcrfs r*test_shallow_statistic_rangez5TestConditionalShortcuts.test_shallow_statistic_rangezsy~~%%aA....4:...26$f===6$dJJJ L L L L Lr,c tjddd}d|jD}t tj|||tj|||ddS)NrZr:cg|]}dS))rrrTr]s r*r`zFTestConditionalShortcuts.test_clip_statistic_range..rar,rbrmrcrfs r*test_clip_statistic_rangez2TestConditionalShortcuts.test_clip_statistic_ranges~y}}$$Q**..4:...26$d;;;6$dKKK M M M M Mr,N) rQrRrSrImark parametrize _all_modeskeysrirnrrrTr,r*rVrVss [VZ__%6%677CC87C  [V%N%N%NOOLLPOL  [V%N%N%NOOMMPOMMMr,rVcXeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZejdgddZejdgdejdgddZdZejdejdejdddgdZejdddgdZdS) TestStatisticctjdd}tj|ddd}tjgd}t ||dS)Ndf)r)rNr )?rrrrrrrrrrrrrrrrrrrrrrrr?@@@@@@ @"@$@&@(@*@,@.@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;astyperer"rr%r/bs r*test_check_mean_stat_lengthz)TestStatistic.test_check_mean_stat_lengthsm IcNN ! !# & & F1lF C C C H     & 1a     r,ctjd}tj|dd}tjgd}t ||dS)Nrzr|r)crrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rDr r9 r~r}rp !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abrrrrrrrrrrrrrrrrrrrrrr!r;rer"rrs r*test_check_maximum_1z"TestStatistic.test_check_maximum_1Z IcNN F1h * * H 5 5 5  & 1a     r,ctjddz}tj|dd}tjgd}t ||dS)NrzrCr|r)rzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrBrs r*test_check_maximum_2z"TestStatistic.test_check_maximum_2s_ IcNNQ  F1h * * H ? ? ?  & 1a     r,ctjddz}tj|ddd}tjgd}t ||dS)NrzrCr|rrr)rrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrzrBrs r*test_check_maximum_stat_lengthz,TestStatistic.test_check_maximum_stat_lengthsd IcNNQ  F1h r : : : H ? ? ?  & 1a     r,ctjd}tj|dd}tjgd}t ||dS)Nrzr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrrrrrrrrrrrrrrrrrrrrrBrs r*test_check_minimum_1z"TestStatistic.test_check_minimum_1sZ IcNN F1h * * H + + +  & 1a     r,ctjddz}tj|dd}tjgd}t ||dS)Nrzr0r|r)r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrzer0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0r0rBrs r*test_check_minimum_2z"TestStatistic.test_check_minimum_2s_ IcNNQ  F1h * * H + + +  & 1a     r,ctjddz}tj|ddd}tjgd}t ||dS)NrzrCr|rrr)rCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrzr:r:r:r:r:r:r:r:r:r:r:r:r:r:r:r:r:r:r:r:rBrs r*test_check_minimum_stat_lengthz,TestStatistic.test_check_minimum_stat_lengthsd IcNNQ  F1h r : : : H 5 5 5  & 1a     r,ctjdd}tj|dd}tjgd}t ||dS)Nrzr{r|rH@rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrrs r*test_check_medianzTestStatistic.test_check_median2sk IcNN ! !# & & F1h ) ) H I I I  & 1a     r,ctjgdgdgdg}tj|dd}tjgdgdgdgd gdg}t||dS) NrrCr.r.rZrDrDrr0rCr)r.r.rZr.r.rrrCr.rrZr.rZrDrZrrDrr0r)r!r"rerrs r*test_check_median_01z"TestStatistic.test_check_median_01Js HiiiIII6 7 7 F1a " " H __ __ __ __ __     1a     r,ctjgdgdgdg}tj|jddj}tjgdgdgdgd gdg}t ||dS) NrVrWrXrCr)rZr.rZr.rZrYrZr[)r!r"reTrrs r*test_check_median_02z"TestStatistic.test_check_median_02Xs HiiiIII6 7 7 F138 $ $ & H __ __ __ __ __     1a     r,ctjdd}d|d<d|d<tj|ddd }tjgd }t ||dS) Nrzr{rrCrr@r|rrrZr)rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrs r*test_check_median_stat_lengthz+TestStatistic.test_check_median_stat_lengthfs IcNN ! !# & &!" F1hf = = = H ? ? ?  & 1a     r,cgdg}tj|ddd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdg }t||dS)Nr.rZr:rZrrr0r)r.r.r.r.r.r.rZr:r:r:r:r:r:r:r:r!rer"rrs r*test_check_mean_shape_onez'TestStatistic.test_check_mean_shape_ones YYK F1ff! 4 4 4 H : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : <  " 1a     r,ctjdd}tj|dd}tjgd}t ||dS)Nrzr{r|rrRrrs r*test_check_mean_2zTestStatistic.test_check_mean_2sk IcNN ! !# & & F1h ' ' H I I I  & 1a     r,rW)rrrrctjgdtjgdtjz}tj|d|}t |d|ddS)z3 Test that appended and prepended values are equal )r0rk)rg-q=rr?rlrrkN)r!r"float64rer)r%rWr/s r*test_same_prepend_appendz&TestStatistic.test_same_prepend_appendsb H[[[ ! !BH]]]"*$M$M$M M F1fd # #QqT1R5!!!!!r,r rE)rE)rrk))rZr0)rEr))rBr0ctjdd}d}tjt |5tj|d||ddddS#1swxYwYdS)Nrpr:rZ#index can't contain negative valuesrFr0rr!r;r<rIrJrKre)r%rWr arrrGs r*test_check_negative_stat_lengthz-TestStatistic.test_check_negative_stat_lengths imm##F++5 ]:U 3 3 3 : : F34[ 9 9 9 9 : : : : : : : : : : : : : : : : : :sA++A/2A/ctjd}tj|d}tj|ddd}tjgdgdgdgdgd gd gd gd gd gd gd g }t ||dS) NrprqrNrr0rrrm) r:r:r:rZr:rrrDrr) rCrCrCrrCr0rr.rr) rrrrrr9rrrr) rrrrrrrrrr) rrrr~rrrrrr) rrrr}rrrrrrr!r;r<rer"rrs r*test_simple_stat_lengthz%TestStatistic.test_simple_stat_lengths IbMM Jq& ! ! F1&V F F F H + + + + + + + + + + + + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 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 ||dS)NrrrCr0rr)r!rer"nanr)r%rWrtr&s r*test_zero_stat_length_validz)TestStatistic.test_zero_stat_length_validsV fb"Xvt;;;8RVRRVRV<==S(#####r,rrctd}tjt|5tjddgd|ddddn #1swxYwYtjt|5tjddgd|ddddn #1swxYwYtjt|5tjddgd|ddddn #1swxYwYtjt|5tjddgd|dddddS#1swxYwYdS) Nz,stat_length of 0 yields no value for paddingrFrrrr)rCrrC)rIrJrKr!rer%rWrGs r*test_zero_stat_length_invalidz+TestStatistic.test_zero_stat_length_invalids2> ]:U 3 3 3 5 5 FB8Q! 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ]:U 3 3 3 : : FB8Q& 9 9 9 9 : : : : : : : : : : : : : : : ]:U 3 3 3 5 5 FB8Q! 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ]:U 3 3 3 : : FB8Q& 9 9 9 9 : : : : : : : : : : : : : : : : : :sGAA  A +BBB8CC#&C#D--D14D1N)rQrRrSrrCrFrHrKrNrPrTr\r_rbrgrirIrsrtrmrur{filterwarningsrrrTr,r*rxrxs/!!!0!!!0!!!0!!!0!!!0!!!0!!!0!!!0 ! ! ! ! ! !!!!4!!!,!!!0 [V&&& ""  " [V%M%M%MNN [MMM::ON: !!!* [ KLL [M [Vfh%788$$98ML $  [Vi%;<< : :=< : : :r,rxcJeZdZdZdZdZdZdZdZdZ dZ d Z d Z d S) TestConstantctjd}tj|ddd}tjgd}t ||dS)Nrzr|r)rr~r )rrrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArr~r~r~r~r~r~r~r~r~r~r~r~r~r~r~r~r~r~r~r~rBrs r*test_check_constantz TestConstant.test_check_constants_ IcNN F1h H E E E H 5 5 5  & 1a     r,ctjd}tj|dd}tjgd}t ||dS)Nrzr|rrJrBrs r*test_check_constant_zerosz&TestConstant.test_check_constant_zeros sZ IcNN F1h + + H 5 5 5  & 1a     r,c tjddd}tj|ddd}tjgdgd gd gd gd gd gdgdg}t ||dS)NrprZr:r}r皙?rWr ) rCrCrCrCrCrCrCrCrC) rCrrCr0rr.rZrCrC) rCr:rrrDrrrCrC) rCr9rrrrrrCrC) rCrrr~rrrrCrC) rCrr}rrrrrCrCr!r;r<rer"rr%rtrgr&s r*test_check_constant_floatz&TestConstant.test_check_constant_float#simm##Aq))vc6 #&(((8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3   h'''''r,c <tjddd}|tj}tj|ddd}tjgdgd gd gd gd gd gdgdg}t||dS)NrprZr:r}r}rrr) rrrrrrrrr) rrrrrrrrr) rrrrrrrrr) rrrrrrrrr) rrrrrrrrr) rrrrrrrrrr!r;r<rrlrer"r)r%rt arr_floatrgr&s r*test_check_constant_float2z'TestConstant.test_check_constant_float27simm##Aq))JJrz** vi!1 #&(((8 L L L L L L L L L L L L L L L L L L L L L L L L N   h'''''r,ctjdt}tj|ddd}tjgd}t ||dS)Nrzr?r|r)皙333333r)rrrrrrrrrrrrrrrrrrrrrrrrrrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrrrrrrrrrrrrrrrrrrrr)r!r;r rer"rrs r*test_check_constant_float3z'TestConstant.test_check_constant_float3Lsi Ic ' ' ' F1h L I I I H I I I  & 1r,c tjddd}tj|ddd}tjgdgd gd gd gd gd gdg}t ||dS)NrprZr:)rCrorrr) rrrrrrrrrr) rrrrCr0rr.rZrr) rrr:rrrDrrrr) rrr9rrrrrrr) rrrrr~rrrrr) rrrr}rrrrrrrrs r*"test_check_constant_odd_pad_amountz/TestConstant.test_check_constant_odd_pad_amountdsimm##Aq))vc)rtolatol)r!r;rrer"rrs r*test_check_simplez TestLinearRamp.test_check_simplesw IcNN ! !# & & F1h & A A A H F F F  & 14d333333r,c 8tjdddtj}tj|ddd}tjgdgd gd gd gd gd gdgdg}t||dS)Nr~r.rZ)r0r0rr\rWr ) rrrrrrrrr) rrrrrg?rrr) rrrrrrrrr) rg@rrrrrg@r) rrrrrrrrr) r@rrrrr#@r) rg@rrg!@rrg@rrrs r* test_check_2dzTestLinearRamp.test_check_2dsimm##Aq))00<<vc6 &III8 B B B B B B B B B B B B B B B B B B B B B B B B DEE h'''''r,) exceptionsc xddlm}tj|dd|ddg}tj|ddd}tj|dd |d d |d d |d d |d d |dd |dd g}t ||dS)Nr)FractionrCr0rkrNrrr9rr:rBrE) fractionsrr!r"rer)r%rrtactualr&s r*test_object_arrayz TestLinearRamp.test_object_arrays&&&&&&hAQ899V-AFFF8 Ha   Ha   Ha   HR   HR   HR   HR      VX&&&&&r,cPtjtjddddd}t |dddfd t |ddd fd t |dddfd t |d ddfd dS) z!Ensure that end values are exact.rr0rZ){rrbNrrrk)r!rerOr<r)r%r/s r*test_end_valueszTestLinearRamp.test_end_valuess F272;;&&q!,,j} M M MQqqq!tWb!!!Qqqq"uXr"""Qq!!!tWb!!!Qr111uXr"""""r,r@cbtjdg|}tj|ddd}tjgd|}t||tjdg|}tj|ddd}tjgd|}t||dS) 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"rer)r%r@r'r(r&s r*test_negative_differencez'TestLinearRamp.test_negative_differences HaS & & &1=Q???8111???VX&&& HaS & & &1=Q???8111???VX&&&&&r,N)rQrRrSrrrIrsxfailAssertionErrorrrrt_numeric_dtypesrrTr,r*rrs4440 ( ( ( [>"344''54'$### [Wo66''76'''r,rc8eZdZdZdZdZdZdZdZdZ dS) TestReflectctjd}tj|dd}tjgd}t ||dS)Nrzr|r)r}rrrrr~rrrrrrrr9rrrDrrr:rZr.rr0rCrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrAr@r?r>r=r<r;r:r9r8r7r6r5r4r3r2r1r0r/r.rBrs r*rzTestReflect.test_check_simplerDr,ctjd}tj|ddd}tjgd}t ||dS)Nrzr|roddr)irrBrArErkrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrzrMfghijklmnopqrstuvwrBrs r*test_check_odd_methodz!TestReflect.test_check_odd_methods_ IcNN F1h  > > > H ? ? ?  & 1a     r,cgdgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdgdg}t||dS)Nrdr:rrrer)rr:rrrr:rrrr:rrrr:rrZr.rZr:rZr.rZr:rZr.rZr:rZr.rZrfrs r*test_check_large_padz TestReflect.test_check_large_pad+s YY " F1fi ( ( H : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : <  $ 1a     r,cgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdg }t||dS)Nrdrerrrfrs r*test_check_shapezTestReflect.test_check_shapeBs YYK F1fi ( ( H : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : <  " 1a     r,ctjgddd}tjgd}t||dS)NrCr0rr0r)rr0rCr0rr0rCrfrs r* test_check_01zTestReflect.test_check_01XsE F999a + + H*** + +1a     r,ctjgddd}tjgd}t||dS)Nrrr) r0rr0rCr0rr0rCr0rfrs r* test_check_02zTestReflect.test_check_02]sE F999a + + H000 1 11a     r,ctjgddd}tjgd}t||dS)Nrr.r) rCr0rr0rCr0rr0rCr0rrfrs r* test_check_03zTestReflect.test_check_03bsE F999a + + H666 7 71a     r,N) rQrRrSrrrrrr r rTr,r*rrs}!!!0!!!0!!!.!!!,!!! !!! !!!!!r,rceZdZdZejdee ddhz dZ ejde dZ dS)TestEmptyArrayz > F28F##\ = = = = > > > > > > > > > > > > > > > > > >s5AA A(*BB"%B"*C;;C?C?crtjtjdd|}|jdksJdS)N)r0rr0)ryrrrb)rrr.)r!rerOrd)r%rWr(s r*test_pad_non_empty_dimensionz+TestEmptyArray.test_pad_non_empty_dimensionzs< **,>TJJJ|y((((((r,N) rQrRrS__doc__rIrsrtsortedrurvrrrTr,r*rrhsFF [ z((J+@@AA >>  > [VZ__%6%677))87)))r,rc>eZdZdZdZdZdZdZdZdZ dZ d S) TestSymmetricctjd}tj|dd}tjgd}t ||dS)Nrzr|r)rrrrr~rrrrrrrr9rrrDrrr:rZr.rr0rCrrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrrAr@r?r>r=r<r;r:r9r8r7r6r5r4r3r2r1r0r/rBrs r*rzTestSymmetric.test_check_simplesZ IcNN F1h , , H 5 5 5  & 1a     r,ctjd}tj|ddd}tjgd}t ||dS)Nrzr|rrr)rrrrrrrrrrrrrrrrrrrrrBrArErkrrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrrzrMrrrrrrrrrrrrrrrrrrBrs r*rz#TestSymmetric.test_check_odd_methods_ IcNN F1h % @ @ @ H ? ? ?  & 1a     r,cgdgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdgdg}t||dS)NrdrrerrZr:r:rZr.r.rZr:r:rZr.r.rZr:r:)rrrrr:r:rrrrr:r:rrrrfrs r*rz"TestSymmetric.test_check_large_pads YY " F1fk * * H : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : <  & 1a     r,cgdgdg}tj|ddd}tjgdgdgdgdgd gd gd gd gd gd gd gd gd gd g}t||dS)Nrdrrerrr)rArErErkrrrCr0r0rr.r.rZr:r:)rkrrrCr0r0rr.r.rZr:r:rrr)rCr0r0rr.r.rZr:r:rrrrDrr)rr.r.rZr:r:rrrrDrrrr9r9)rZr:r:rrrrDrrrr9r9rrr)rrrrDrrrr9r9rrrrrr)rDrrrr9r9rrrrrrrrrrfrs r*test_check_large_pad_oddz&TestSymmetric.test_check_large_pad_odds YY " F1fk > > > H I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I K  $ 1a     r,cgdg}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdg }t||dS)Nrdrerrrfrs r*rzTestSymmetric.test_check_shapes YYK F1fk * * H : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : <  " 1a     r,ctjgddd}tjgd}t||dS)Nrr0r)r0rCrCr0rrr0rfrs r*rzTestSymmetric.test_check_01sE F999a - - H*** + +1a     r,ctjgddd}tjgd}t||dS)Nrrr) rr0rCrCr0rrr0rCrfrs r*r zTestSymmetric.test_check_02sE F999a - - H000 1 11a     r,ctjgddd}tjgd}t||dS)Nrr:r)rCr0rrr0rCrCr0rrr0rCrCr0rrfrs r*r zTestSymmetric.test_check_03sE F999a - - HBBB C C1a     r,N) rQrRrSrrrrrrr r rTr,r*rrs!!!0!!!0!!!0!!!.!!!,!!! !!! !!!!!r,rc8eZdZdZdZdZdZdZdZdZ dS) TestWrapctjd}tj|dd}tjgd}t ||dS)Nrzr|r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrrCr0rr.rZr:rrrDrrr9rrrrrrrr~rrrrr}rrrrrprrrrrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArrrCr0rr.rZr:rrrDrrr9rrrrrrrrBrs r*rzTestWrap.test_check_simplesZ IcNN F1h ' ' H 5 5 5  & 1a     r,cbtjd}tj|d}tj|dd}tjgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdg}t ||dS)Nr9r)rr9r)rrrrDrrrrDrrrrDrrrrDrrrrDrrrrDrr)r0rrrCr0rrrCr0rrrCr0rrrCr0rrrCr0rrrCr0r)r:rr.rZr:rr.rZr:rr.rZr:rr.rZr:rr.rZr:rr.rZr:rrzrs r*rzTestWrap.test_check_large_pads IbMM Jq& ! ! F1h ' ' H...))))))...))))))...))))))...))))))...))))))...))))))...))))))...))))))...e3 /5 5 l 1a     r,ctjgddd}tjgd}t||dS)Nrrr) rCr0rrCr0rrCr0rrfrs r*rzTestWrap.test_check_01[sE F999a ( ( H000 1 11a     r,ctjgddd}tjgd}t||dS)Nrr.r) rrCr0rrCr0rrCr0rrCrfrs r*r zTestWrap.test_check_02`sE F999a ( ( H666 7 71a     r,ctjd}tj|dd}t||ddddfdS)Nra)rrZrrbr)r!rOrerrs r*test_pad_with_zerozTestWrap.test_pad_with_zeroesK GFOO F1f6 * * *1aSbSk*****r,cbtjd}tj|dd}ttj||||fdd|tjd}tj|dd}ttj||||fdd|dS) zy Check wrapping on each side individually if the wrapped area is longer than the original array. rZ)r9rrrbrN)rr9rA)r!r;rerr_rs r*test_repeated_wrappingzTestWrap.test_repeated_wrappingjs IaLL F1gF + + +25Aq!,QRR0!444 IaLL F1gF + + +25Aq!,SbS1155555r,c tjddd}tj|ddgd}tjgdgdgdgdgdgdg}t ||d S) z Assert that 'wrap' pads only with multiples of the original area if the pad width is larger than the original array. r.r0rrrCrrb)rr0rr0rr0)rCrrCrrCrNrzrs r*&test_repeated_wrapping_multiple_originz/TestWrap.test_repeated_wrapping_multiple_originws IaLL A & & F1vv&V 4 4 4 H                    !   1a     r,N) rQrRrSrrrr r(r+r.rTr,r*r"r"s~!!!0:!:!:!x!!! !!! +++ 6 6 6!!!!!r,r"ceZdZdZdZdS)TestEdgec tjd}tj|d}tj|dd}tjgdgdgdgdgdgdgdgdgdg }t ||dS Nr9r.rrwr)rrrrrCr0r0r0)rrrrr.rZrZrZ)r:r:r:r:rrrr)rDrDrDrDrrrrrzrs r*rzTestEdge.test_check_simples IbMM Jq& ! ! F1& / / H % % % % % % % % % % % % % % % ) ) ) ) ) ) ) ) ) ) ) ) +   1a     r,c tjgd}tj|dd}tjgd}t||tjgdgdg}tj|dd}tj|dd}t||tjddd d }tj|dd}tj|d d}t||dS) Nr)r}r)rCrCr0rrrrdrrr0rr.)r}r}r})r!r"rerr;r<)r%r/paddedr&s r*test_check_width_shape_1_2z#TestEdge.test_check_width_shape_1_2s HYYY  9f--8...//68,,, Hiii+ , ,9f--6!-v6668,,, IbMM ! !!Q * *9f--6!5v>>68,,,,,r,N)rQrRrSrr6rTr,r*r0r0s2!!!&-----r,r0ceZdZdZdZdS) TestEmptyctjddd}tj|ddgd}|jdksJt ||d d d d fdS) Nrr.r:rNr-rrb)rDrr0rArrkr!r;r<rerdrrs r* test_simplezTestEmpty.test_simplestimm##Aq))ff-G<<<|w&&&&S&2qt,-----r,cztjd}tj|gdd}|jdksJdS)Nrrrrbrrrs r*rz"TestEmpty.test_pad_empty_dimensionsGhy!!///g>>>|y((((((r,N)rQrRrSr;rrTr,r*r8r8s2... )))))r,r8c d}tjddd}tj|d|}tjgdgdgdgdgdgdg}t ||dS)Nc<d|d|d<d||d d<dS)NrrrCrT)vectorriaxiskwargss r* _padwithtensz6test_legacy_vector_functionality.._padwithtenss. "} ! }!# ! }~~r,r:r0r)rrrrrrr)rrrrCr0rr)rrrr.rZrrrz)rBr/rs r* test_legacy_vector_functionalityrCs$$$ ! Q""A q!\""A  % % % % % % % % % % % % % % % % % % ' Aq!r,ctjdgdd}tjgd}t||dS)NrCr0rrb)rrrCrrrf)r/rs r*test_unicode_moderEsC sAJ'''A !!Aq!r,rW)rrrrctjdd}d}tjdd}ttj||||dS)Nr3) fill_valuerw)rDrrb)r!rrre)rWr/rhrs r*test_object_inputrHsX 4(((AG 4(((Arvat444a88888r,c eZdZejdgdejdedZejdedZ ejdgdejdedZ ejdd d d e d fd de fe ddd fdgejdedZ dZejdgdejdedZd S) TestPadWidthr))r.rZr:r)rrory)r}r)rZr:))rr.rZ)rrCr0rWctjdd}d}tjt |5tj|||ddddS#1swxYwYdS)Nrprqz(operands could not be broadcast togetherrFrsr%rrWrtrGs r*test_misshaped_pad_widthz%TestPadWidth.test_misshaped_pad_widthsimm##F++: ]:U 3 3 3 ) ) F3 4 ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )A))A-0A-ctjdd}d}tjt |5tj|d|ddddS#1swxYwYdS)NrprqzDinput operand has more dimensions than allowed by the axis remappingrF))ry)r.)rZ)rrrors)r%rWrtrGs r*test_misshaped_pad_width_2z'TestPadWidth.test_misshaped_pad_width_2simm##F++ ]:U 3 3 3 H H F3@$ G G G H H H H H H H H H H H H H H H H H HrNrnctjdd}d}tjt |5tj|||ddddS#1swxYwYdS)NrprqrrrFrsrLs r*test_negative_pad_widthz$TestPadWidth.test_negative_pad_widthsimm##F++5 ]:U 3 3 3 ) ) F3 4 ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )rNzpad_width, dtype)3N)wordNr3N)g333333 @N))r0rr.rxrCrk)))grrxNcftjdd}d}|`tjt |5tj|tj|||ddddS#1swxYwYdStjt |5tj|||dddn #1swxYwYtjt |5tj|tj||ddddS#1swxYwYdS)Nrprqz%`pad_width` must be of integral type.rFr?)r!r;r<rIrJ TypeErrorrer")r%rr@rWrtrGs r* test_bad_typezTestPadWidth.test_bad_typesimm##F++7  y666 D DsBHYe<<r{s KKKKKKKKKK((((((Jvjj j#A&  !$t$ D !d#t$' &)     P*P*P*P*P*P*P*P*fMMMMMMMM,f:f:f:f:f:f:f:f:R p)p)p)p)p)p)p)p)fR'R'R'R'R'R'R'R'jk!k!k!k!k!k!k!k!\))))))))0C!C!C!C!C!C!C!C!L@!@!@!@!@!@!@!@!F$-$-$-$-$-$-$-$-N ) ) ) ) ) ) ) )( !I!I!IJJ99KJ9NCNCNCNCNCNCNCNCb!2!233 7 743 7 ;;; !WffhhdE!JKK((LK( !2!233**43*!2!23344434/22!2!233!!4332!!!r,