o 6a @srddlZddlZddlZddlmZmZddlmZm Z m Z m Z m Z m Z mZedejddejdgdd ejd d d gejejejd ejdgdejejddejggZegdegded dgegdgZegdgdgdgdgZegdgdgdgdgZGdddZGdd d ZGd!d"d"ZGd#d$d$ZGd%d&d&eZGd'd(d(eZGd)d*d*eZd+Zeejd,Zed-d.eD7ZGd/d0d0Z Gd1d2d2Z!Gd3d4d4Z"ej#$d5eejd6ejej%gegd7fejgd8ej&d9d:fegd7d:fejejd6gejej%ggej'd9ed;d:gd;d:ggfgdd?Z)dS)@N) _nan_mask _replace_nan)assert_ assert_equalassert_almost_equalassert_no_warnings assert_raisesassert_array_equalsuppress_warningss?&S:??ʡE? ?绸zG?L F%u?6٬?:M S㥛?z):? h"?)r r r r)rrrrr)rrr)r ?r r rr)rrrrrr)rrrrrr)rrrrrr)r r r rr)rrrrrr)rrrrrr)rrrrrrc@steZdZejejgZejejgZ ddZ ddZ ddZ ddZ d d Zd d Zd dZddZddZddZdS)TestNanFunctions_MinMaxcC*t}|jD] }||t|tqdSN_ndatcopynanfuncsrselfndatfr&C/usr/lib/python3/dist-packages/numpy/lib/tests/test_nanfunctions.py test_mutation+   z%TestNanFunctions_MinMax.test_mutationcC\td}t|j|jD]\}}dD]}|||dd}|||dd}t|j|jkqq dSNNrTaxiskeepdimsnpeyezipr!stdfuncsrndimr#matnfrfr0tgtresr&r&r' test_keepdims2 z%TestNanFunctions_MinMax.test_keepdimscC^td}t|j|jD] \}}td}||dd}||d|d}t||t||q dSNr,r.r0r0outr3r4r5r!r6zerosrr#r9r:r;resoutr<r=r&r&r'test_out:     z TestNanFunctions_MinMax.test_outcCsd}t|j|jD]<\}}|D]5}tjd|d}||ddjj}||ddjj}t||u||ddjj}||ddjj}t||uqq dS)NefdgFDGr,dtyper.rBr5r!r6r3r4rMtyperr#codesr:r;cr9r<r=r&r&r'test_dtype_from_inputCs z-TestNanFunctions_MinMax.test_dtype_from_inputcDt|j|jD]\}fddtD}|tdd}t||qdS)Ncg|]}|qSr&r&.0dr;r&r' Rz>TestNanFunctions_MinMax.test_result_values..r.rBr5r!r6_rdatrrr#r:r<r=r&rYr'test_result_valuesP   z*TestNanFunctions_MinMax.test_result_valuesc Csttjgddd}|jD]z}dD]=}tjdd-}tdtt |||d tt |dkd tt |d j tWdn1sLwYqtjdd*}tdtt |tjtt |dkd tt |d j tWdn1swYqdS) N r,r-TrecordalwaysrBr.no warning raisedrr3arraynanreshaper!warningscatch_warnings simplefilterrisnanalllen issubclasscategoryRuntimeWarningr#r9r%r0wr&r&r' test_allnansVs$   z$TestNanFunctions_MinMax.test_allnanscCsjtjt}|j}tjfD]#}||dd}|tdd}t||t|j|tt | qdS)Nr.rB) r3ma fix_invalidr_maskr nanminrrisinfany)r#r9mskr%r=r<r&r&r' test_maskedfs       z#TestNanFunctions_MinMax.test_maskedcC |jD] }t|ddkqdSNrr!rr#r%r&r&r' test_scalarp z#TestNanFunctions_MinMax.test_scalarc Cs8Gdddtj}td|}|jD]5}||dd}tt||t|jdk||dd}tt||t|jdk||}t|jdkqtj|d<|jD]}t j d d -}t d ||dd}tt||tt t | tt|dkWdn1swYt j d d F}t d ||dd}tt||tt |dot |d ot |d  tt|dkd tt|djtWdn1swYt j d d '}t d ||}t|jdkt|tjktt|dkWdn 1swYqRdS)Nc@ eZdZdS)z8TestNanFunctions_MinMax.test_subclass..MyNDArrayN__name__ __module__ __qualname__r&r&r&r' MyNDArrayurr,rrBr,r.r&Trbrdre)r3ndarrayr4viewr!r isinstanceshaperhrjrkrlr{rmrorprqrr)r#rminer%r=rtr&r&r' test_subclasstsN           z%TestNanFunctions_MinMax.test_subclasscCstjddgtjdgtjtjggtd}tt|dttj|ddddgtjdd1}td tt tj|d dddtjgt t |d kd t t |dj tWddS1sawYdS) Nrg@@rLrrBTrbrdr.re)r3rgrhobjectrryrjrkrllistrrorprqrr)r#arrrtr&r&r'test_object_arrays&  "z)TestNanFunctions_MinMax.test_object_arrayN)rrrr3rynanmaxr!minmaxr6r(r>rIrSr_rur}rrrr&r&r&r'r&s      +rc@sHeZdZejejgZddZddZddZ ddZ d d Z d d Z d S)TestNanFunctions_ArgminArgmaxcCrrrr"r&r&r'r(r)z+TestNanFunctions_ArgminArgmax.test_mutationc Cst|jtjtjgD]K\}}tD]D}t7}|td||}||}t t | t ||| t t ||d| Wdn1sOwYqq dS)Nzinvalid value encountered in) r5r!r3greaterlessrr filterrrrrmr{equal)r#r%fcmprowsupindvalr&r&r'r_s  z0TestNanFunctions_ArgminArgmax.test_result_valuescCsRttjgddd}|jD]}dD] }tt|||dqtt|tjqdS)Nrar,r-rB)r3rgrhrir!r ValueError)r#r9r%r0r&r&r'rus  z*TestNanFunctions_ArgminArgmax.test_allnanscCsZtd}|jD]"}dD] }tt|||dq dD]}|||d}t|tdqqdS)Nrr,rNrBr.r)r3rFr!rrr)r#r9r%r0r=r&r&r' test_emptys   z(TestNanFunctions_ArgminArgmax.test_emptycCr~rrrr&r&r'rrz)TestNanFunctions_ArgminArgmax.test_scalarcCsGdddtj}td|}|jD]5}||dd}tt||t|jdk||dd}tt||t|jdk||}t|jdkqdS) Nc@r)z>TestNanFunctions_ArgminArgmax.test_subclass..MyNDArrayNrr&r&r&r'rrrr,rrBrr.r&)r3rr4rr!rrr)r#rrr%r=r&r&r'rs   z+TestNanFunctions_ArgminArgmax.test_subclassN) rrrr3 nanargmin nanargmaxr!r(r_rurrrr&r&r&r'rs   rc@seZdZejejejejejej ej ej fZ e gdZddZddZddZdd Zd d Zd d ZddZddZddZddZddZddZdS)TestNanFunctions_IntTypes)']W.ccs |jD] }|j|VqdSr) int_typesr9astype)r#rMr&r&r'integer_arrayss z(TestNanFunctions_IntTypes.integer_arrayscC.t|j}|D] }tt||q dSr)r3rr9rrryr#r<r9r&r&r' test_nanmin  z%TestNanFunctions_IntTypes.test_nanmincCrr)r3rr9rrrrr&r&r' test_nanmaxrz%TestNanFunctions_IntTypes.test_nanmaxcCrr)r3argminr9rrrrr&r&r'test_nanargminrz(TestNanFunctions_IntTypes.test_nanargmincCrr)r3argmaxr9rrrrr&r&r'test_nanargmaxrz(TestNanFunctions_IntTypes.test_nanargmaxcCrr)r3sumr9rrnansumrr&r&r' test_nansum rz%TestNanFunctions_IntTypes.test_nansumcCrr)r3prodr9rrnanprodrr&r&r' test_nanprodrz&TestNanFunctions_IntTypes.test_nanprodcCrr)r3cumsumr9rr nancumsumrr&r&r'test_nancumsumrz(TestNanFunctions_IntTypes.test_nancumsumcCrr)r3cumprodr9rr nancumprodrr&r&r'test_nancumprodrz)TestNanFunctions_IntTypes.test_nancumprodcCrr)r3meanr9rrnanmeanrr&r&r' test_nanmeanrz&TestNanFunctions_IntTypes.test_nanmeancCs^t|j}|D] }tt||q tj|dd}|D] }ttj|dd|q dSNr.ddof)r3varr9rrnanvarrr&r&r' test_nanvar"s   z%TestNanFunctions_IntTypes.test_nanvarcCs`t|j}|D] }tt||q tj|jdd}|D] }ttj|dd|q!dSr)r3stdr9rrnanstdrr&r&r' test_nanstd+s   z%TestNanFunctions_IntTypes.test_nanstdN)rrrr3int8int16int32int64uint8uint16uint32uint64rrgr9rrrrrrrrrrrrr&r&r&r'rs"  rc@TeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)SharedNanFunctionsTestsMixincCrrrr"r&r&r'r(6r)z*SharedNanFunctionsTestsMixin.test_mutationcCr*r+r2r8r&r&r'r>=r?z*SharedNanFunctionsTestsMixin.test_keepdimscCr@rArErGr&r&r'rIErJz%SharedNanFunctionsTestsMixin.test_outc Cstd}d}t|j|jD]j\}}|D]c}tV}|tjtjhvr,|dvr,|tj ||t |ddj j }||t |ddj j }t ||u||t |ddj j }||t |ddj j }t ||uWdn1srwYqqdSNr,rKFDGr.)rMr0 r3r4r5r!r6r rrrComplexWarningrMrOr r#r9rQr:r;rRrr<r=r&r&r'test_dtype_from_dtypeNs"   z2SharedNanFunctionsTestsMixin.test_dtype_from_dtypec Cstd}d}t|j|jD]^\}}|D]W}tJ}|tjtjhvr,|dvr,|tj |||ddj j }|||ddj j }t ||u|||ddj j }|||ddj j }t ||uWdn1sfwYqqdSrrrr&r&r'test_dtype_from_char_s"   z1SharedNanFunctionsTestsMixin.test_dtype_from_charcCsd}t|j|jD]A\}}|D]:}tjd|d}||ddjj}||ddjj}t||ud||f||ddjj}||ddjj}t||uqq dS)NrKr,rLr.rBzres %s, tgt %srNrPr&r&r'rSpsz2SharedNanFunctionsTestsMixin.test_dtype_from_inputcrT)NcrUr&r&rVrYr&r'rZr[zCSharedNanFunctionsTestsMixin.test_result_values..r.rBr\r^r&rYr'r_}r`z/SharedNanFunctionsTestsMixin.test_result_valuescCr~rrrr&r&r'rrz(SharedNanFunctionsTestsMixin.test_scalarcCsGdddtj}td}||}|jD]O}||ddj}||dd}tt||t|j|k||ddj}||dd}tt||t|j|k||j}||}tt||t|j|kqdS)Nc@r)z=SharedNanFunctionsTestsMixin.test_subclass..MyNDArrayNrr&r&r&r'rrrr,rrBr.)r3rr4rr!rrr)r#rrgrr%expected_shaper=r&r&r'rs"      z*SharedNanFunctionsTestsMixin.test_subclassN) rrrr(r>rIrrrSr_rrr&r&r&r'r5s   rc@s4eZdZejejgZejejgZ ddZ ddZ dS)TestNanFunctions_SumProdcCstjddR}tdtjtjgddd}t|dkdtt|dkdttj}t|dkdtt|dkdtjdgdddtt|dkd WddS1s[wYdS) NTrbrdr,rBrzresult is not 0zwarning raisedzunwanted warning raised)rjrkrlr3rrhrro)r#rtr=r&r&r'rus  "z%TestNanFunctions_SumProd.test_allnanscCsttjtjgddgD]3\}}td}|gd}||dd}t||g}||dd}t|||}||dd}t||q dS)Nrr.rr,rB)r5r3rrrFrr#r% tgt_valuer9r<r=r&r&r'rs        z#TestNanFunctions_SumProd.test_emptyN) rrrr3rrr!rrr6rurr&r&r&r'rs    rc@sLeZdZejejgZejejgZ ddZ ddZ ddZ ddZ d d Zd S) TestNanFunctions_CumSumProdc Cst|jddgD]S\}}tD|tjgddd}|td}tt||d||tj}|td}tt||d||dgdddWdn1sVwYqdS)Nrr.r,rBzresult is not %s * np.ones((3))zresult is not %s * np.ones((1)))r5r!rr3rhonesr array_equal)r#r%rr=r<r&r&r'rus z(TestNanFunctions_CumSumProd.test_allnanscCst|jddgD]8\}}td}|td}||dd}t|||}||dd}t||td}||dd}t||qdS)Nrr.rrB)r5r!r3rFrrrr&r&r'rs        z&TestNanFunctions_CumSumProd.test_emptyc Cst|j|jD]$\}}td}dD]}|||dd}|||dd}t|j|jkqq|jD]8}td}tj d}tj ||j |j dk<||dd}t |j dtd D]}|||d}t |j dqXq/dS) Nr,r-rCr, r?rB)i)r5r!r6r3r4rr7rrandom RandomStaterhrandrrarange) r#r%gr9r0r<r=rXrsr&r&r'r>s$       z)TestNanFunctions_CumSumProd.test_keepdimscCsZdD](}tjt|d}tjt|d}t||tjt|d}tjt|d}t||qdS)N)rr.NrB) r3r _ndat_onesrrrr _ndat_zerosr)r#r0r<r=r&r&r'r_s  z.TestNanFunctions_CumSumProd.test_result_valuescCshtd}t|j|jD]%\}}td}dD]}|||d}||||d}t||t||qq dS)Nr,)rrrr.rBrC)r3r4r5r!r6r)r#r9r:r;rHr0r<r=r&r&r'rIs     z$TestNanFunctions_CumSumProd.test_outN)rrrr3rrr!rrr6rurr>r_rIr&r&r&r'rs    rc@s\eZdZejejejgZejej ej gZ ddZ ddZ ddZddZd d Zd d Zd S)TestNanFunctions_MeanVarStdc Cs8|jD]}tjtjtjfD] }tt|td|dq qdS)Nr.)r0rM)r!r3bool_int_object_r TypeErrorr)r#r%rMr&r&r'test_dtype_error s z,TestNanFunctions_MeanVarStd.test_dtype_errorc CsL|jD] }tjtjtjfD]}tjtjd|d}tt |td|dq qdS)NrrLr.rC) r!r3rrremptyrrrr)r#r%rMrDr&r&r'test_out_dtype_errors z0TestNanFunctions_MeanVarStd.test_out_dtype_errorcsftjtjg}tjtjg}t||D]\}dD]fddtD}|tdd}t||qqdS)Nrr.csg|]}|dqS)rr&rVrr;r&r'rZz9TestNanFunctions_MeanVarStd.test_ddof..r.r0r) r3rrrrr5r]rr)r#r!r6r:r<r=r&rr' test_ddofs   z%TestNanFunctions_MeanVarStd.test_ddofc stjtjg}tjtjg}ddtD}t||D]X\}}tdD]OtB}| t | tj fdd|D}|t dd}tt||t|rWtt|jdkn tt|jdkWdn1sjwYq qdS)NcSsg|]}t|qSr&)rorVr&r&r'rZ#r[zATestNanFunctions_MeanVarStd.test_ddof_too_big..rcsg|]}|kqSr&r&rVrr&r'rZ)r[r.r r)r3rrrrr]r5ranger rcrrrrrrrmr{rrolog) r#r!r6dsizer:r;rr<r=r&rr'test_ddof_too_big s&     z-TestNanFunctions_MeanVarStd.test_ddof_too_bigc Csttjgddd}|jD]]}dD]X}tjddH}tdtt |||d tt |dktt |d j ttt |tjtt |d ktt |d j tWdn1sgwYqqdS) Nrar,r-TrbrdrBr.rrrfrsr&r&r'ru1s  z(TestNanFunctions_MeanVarStd.test_allnansc Cstd}|jD]u}dD]<}tjdd,}tdtt|||dtt |dktt |dj t Wdn1sCwYq d D]1}tjdd!}tdt |||dtgtt |dkWdn1swwYqKqdS NrrTrbrdrBr.rr)r3rFr!rjrkrlrrmrnrorprqrrrrsr&r&r'r?s&    z&TestNanFunctions_MeanVarStd.test_emptyN)rrrr3rrrr!rrrr6rrr rrurr&r&r&r'rs  r) YMWDhmsmsusnspsfsasAllFloatcCsg|]}d|dqS)zm8[]r&)rWunitr&r&r'rZUrrZc@s|eZdZddZddZddZddZd d Zej d gd ej d e ddZ ddZ ddZddZddZdS)TestNanFunctions_MediancCs t}t|t|tdSr)rr r3 nanmedianrr#r$r&r&r'r(Zs z%TestNanFunctions_Median.test_mutationcCsntd}dD]}tj||ddd}tj||ddd}t|j|jkqtd}tjdt|j dddf}| tj }tj |t |<tb}|ttj|ddd}t|j d tj|d dd}t|j d tj|d dd}t|j d tj|ddd}t|j dtj|ddd}t|j d tj|ddd}t|j dWddS1swYdS)Nr,r-Fr0rDoverwrite_inputrrTr/r.r.r.r.rr.r.rrrr.rrr.rr,r.rrrr.rr,rr.r,r.r.rr.)r3r4medianr!rr7rrrgrrintprhtupler rrrrr#r9r0r<r=rXrtrr&r&r'r>`s0  $       "z%TestNanFunctions_Median.test_keepdimscCstjdd}tj|ddgtjdd}td}tj|dd}tj|d|d}t||t||td}tj|dd}tj|d|d}t||t||tj|d|d}t||t||dS) Nr,rrr.rBrCr&r) r3rrinsertrhrFr.r!rr#r9nan_matrHr<r=r&r&r'rI{s       z TestNanFunctions_Median.test_outcCsdD]J}tjd|}tjjd|j|jdd}tj||<d|dddf<g}|D]}tt||}| tj |ddq+t tj |d d |qdS) N)r3r&irrr)sizerT)r$rrB) r3rrandnrandintr7rhravelcompressrmappendr.r r!)r#rrXrtr<xnonanr&r&r'test_small_largesz(TestNanFunctions_Median.test_small_largecCs*ddtD}tjtdd}t||dS)NcSsg|]}t|qSr&)r3r.rVr&r&r'rZsz>TestNanFunctions_Median.test_result_values..r.rB)r]r3r!rrr#r<r=r&r&r'r_sz*TestNanFunctions_Median.test_result_valuesr0r-rMcCs$tdtj|}t{}|ttj||d}|j|jks"Jt | s+J|dur9t t |j dkn t t |j dkttj|d}t|}|j|jksZJt |saJ|durot t |j dknt t |j dkWddSWddS1swYdS)N)r,r,rBr.r,r&rr)r3fullrhrr rcrrr!rMrmrnrror rg)r#rMr0r9routputscalar output_scalarr&r&r'rus&  "z$TestNanFunctions_Median.test_allnansc Cstd}dD]=}tjdd-}tdtttj||dtt |dktt |dj t Wdn1s?wYqd D]2}tjdd"}tdt tj||dtgtt |dkWdn1stwYqGdSr)r3rFrjrkrlrrmr!rnrorprqrrrr#r9r0rtr&r&r'rs"   z"TestNanFunctions_Median.test_emptycCsttddkdSr)rr3r!)r#r&r&r'rsz#TestNanFunctions_Median.test_scalarcCsptd}ttjtj|ddttjtj|ddttjtj|ddttjtj|ddtttj|dddS)NrrBrrFrrrr.r.)r3rr AxisErrorr!rr#rXr&r&r'test_extended_axis_invalids z2TestNanFunctions_Median.test_extended_axis_invalidc Cstl}|ttjtj fD]U}t|tjgtjtjgg}ttj|dd|tjgttj|dd|tjgtt||ttjtj|gtjtj|gg}tt||ttj|ddtjtj|gttj|dd|t||g||gg}ttj|dd|tj|d| dgdtjtjdgdtjtj|ggtj d }|dkrttj|ddd d | d gtt|d nttj|dddd | dgtt|dttj|dddd|gt ddD]z}t ddD]r}ttjg||g|gd}tt||ttj|dd|ttj|ddtjg||g|ttjg|| g|gd}tt|| ttj|dd| ttj|ddtjg|| g|qqqWddS1stwYdS)NrrBr.riirrrLrg@@g@g$g"grg r) r rrrr3infrgrhrr!float32r )r#rrOaijr&r&r'test_float_specialsZ   "$$z*TestNanFunctions_Median.test_float_specialN)rrrr(r>rIr?r_pytestmark parametrize _TYPE_CODESrurrrLrTr&r&r&r'r Xs   r c@r)TestNanFunctions_PercentilecCs"t}t|dt|tdS)N)rr r3 nanpercentilerr"r&r&r'r(s z)TestNanFunctions_Percentile.test_mutationcCs~td}dD]}tj|d|ddd}tj|d|ddd}t|j|jkqtd}tjdt|j dddf}| tj }tj |t |<th}|ttj|ddd d }t|j d tj|dd d d }t|j d tj|ddd d }t|j dtj|ddd d }t|j dtj|ddd d }t|j d tj|ddd d }t|j dWddS1swYdS)Nr,r-FFr#rr%ZTr/r'rr(rr)rr*r+r,r-)r3r4 percentiler[rr7rrrgrrr/rhr0r rrrrr1r&r&r'r> s8    $       "z)TestNanFunctions_Percentile.test_keepdimscCstjdd}tj|ddgtjdd}td}tj|ddd}tj|dd|d}t||t||td}tj|ddd}tj|dd|d}t||t||tj|dd |d}t||t||dS) Nr,rrr.rB*rCr&r) r3rrr2rhrFr^r[rr3r&r&r'rI*s       z$TestNanFunctions_Percentile.test_outcCsZddtD}tjtddd}t||tddtD}tjtddd}t||dS)NcSg|]}t|dqS)r3r^rVr&r&r'rZ=rzBTestNanFunctions_Percentile.test_result_values..rar.rBcSr`)rabrbrVr&r&r'rZArrc)r]r3r[rr transposer@r&r&r'r_<s  z.TestNanFunctions_Percentile.test_result_valuesc Csttjgddd}dD]v}tjddf}tdtttj |d|d |dur9tt |d kntt |dktt |d j tttt tjd|durdtt |d kntt |d ktt |d j tWdn1swYqdS) Nrar,r-Trbrd<rBr.rrr)r3rgrhrirjrkrlrrmr[rnrorprqrrrEr&r&r'ruEs" z(TestNanFunctions_Percentile.test_allnansc Cstd}dD]>}tjdd.}tdtttj|d|dtt |dktt |d j t Wdn1s@wYqd D]3}tjdd#}tdt tj|d|dtgtt |d kWdn1svwYqHdS) NrrTrbrd(rBr.rr)r3rFrjrkrlrrmr[rnrorprqrrrrEr&r&r'rXs"   z&TestNanFunctions_Percentile.test_emptycCsHttdddtd}tj|ddd}t|dtt|dS)Nrd2rrBg@)rr3r[rrisscalar)r#rQrr&r&r'rfs   z'TestNanFunctions_Percentile.test_scalarcCsztd}ttjtj|dddttjtj|dddttjtj|dddttjtj|dddtttj|ddddS) NrrrFqr0rGrrHrI)r3rrrJr[rrKr&r&r'rLms z6TestNanFunctions_Percentile.test_extended_axis_invalidc Cs0ddg}td}tj|}td}d|dddddddf<|ddddddfd9<d D]P}d D]K}t>}|td tj||||d }tj||||d } t| j |j tj||||d }tj||||d } t| |Wdn1s~wYq8q4td } ttj| |ddj ddS)Nrjrh)rr,)r,rrrrrr,r-)FTzAll-NaN slice encounteredr/)r,rrri)r.rrB)rr,ri) r3rrhr rrrr^r[rr) r#percr9r4 large_matr0keepdimrrnan_valmegamatr&r&r'test_multiple_percentilesus6   "      z5TestNanFunctions_Percentile.test_multiple_percentilesN) rrrr(r>rIr_rurrrLrtr&r&r&r'rYs  rYc@s$eZdZddZddZddZdS)TestNanFunctions_QuantilecCstddddt}tj|dd<ttj|ddtj|d dttj|ddd tj|d dd ttj|ddd tj|d dd ttj|dgdd tj|d gdd ttj|gd dd tj|gd dd dS) Nrr,rrr.r)rnrjrm)?r?)rjK) r3rrirfloatrhr nanquantiler[)r#arr&r&r'test_regressionsz)TestNanFunctions_Quantile.test_regressioncCsHtdd}tt|ddtt|ddtt|dddS)Nrrrr.g @g?)r3rrr|)r#r=r&r&r' test_basicsz$TestNanFunctions_Quantile.test_basiccCsjtgd}|}tjtd|ddt|||}|}tjtd|ddt||dS)N)rrxrwrrgY@midpoint) interpolation)r3rgr r|rr tolist)r#p0pr&r&r'test_no_p_overwrites z-TestNanFunctions_Quantile.test_no_p_overwriteN)rrrr~rrr&r&r&r'rus ruz arr, expectedrM)FTFT)r.rrrarLTFcCsPdtj|jtjdfD]}t||d}t||t|tjur%|dus%Jq dS)NrL)rDT)r3rrrrrrOr)rexpectedrDactualr&r&r'test__nan_masks   rcCstjtjtjfD]}tjddg|d}t|d\}}|dus J||us&JqtjtjfD]Z}tjddg|d}t|d\}}|dksGJ||usMJt ||tjddtj g|d}t|d\}}t |tgd||ustJt |tgdt |d sJq-dS) z] Test that _replace_nan returns the original array if there are no NaNs, not a copy. rr.rLNrF)FFT)rr.rr) r3rrrrgrrPfloat64rnrrhrm)rMrresultmaskarr_nan result_nanmask_nanr&r&r'test__replace_nans$    r)*rjrUnumpyr3numpy.lib.nanfunctionsrr numpy.testingrrrrrr r rgrhrr]rrrrrrrrr _TIME_UNITSr typecodesrXr rYrurVrWrOr complex64rrr&r&r&r's~$      >Ki"GH. #