+
    xȇiT                     T    R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt	 R t
 ! R R4      tR# )z
Note: for naming purposes, most tests are title with as e.g. "test_nlargest_foo"
but are implicitly also testing nsmallest_foo.
N)Seriesc                     \        WR 7      p\        W24      ! ^4      pVR8X  d   \        ^4      M\        ^^ R4      pVP                  V,          p\        P
                  ! WF4       R# )dtype	nsmallestN)r   getattrrangeloctmassert_series_equal)valsr   methodserresultexpected_idxrexpecteds   &&&    y/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/series/methods/test_nlargest.pyassert_check_nselect_boundaryr      sQ    

#CS!!$F &+ 5E!H5Ar?Mww}%H6,    c                     a  ] tR t^t o ]P
                  P                  R]! . R+ORR7      ]! . R,ORR7      ]! . R,ORR7      ]! ]! R4      4      ]! ]! R4      RR7      .4      ]P
                  P                  RRR	.4      ]P
                  P                  R
. R-O4      R 4       4       4       t	]P
                  P                  R]
P                  ! . R.O4      ]
P                  ! . R.ORR7      ]
P                  ! . R/O4      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      ]P                  ! . R0ORR7      .4      R 4       tR t]P
                  P                  R]! ^^4      4      R 4       tR tR t]P
                  P                  RR R!.4      R" 4       tR# t]P
                  P                  R$RR%.R.3. R1OR.3.4      R& 4       tR' tR( tR)tV tR*# )2TestSeriesNLargestNSmallestrobjectr   
complex128abcdecategoryr   nlargestr   argc                    VP                   pR V 2p\        P                  ! \        VR7      ;_uu_ 4        \	        W4      ! V4       RRR4       R#   + '       g   i     R# ; i)z3Cannot use method 'n(largest|smallest)' with dtype matchN)r   pytestraises	TypeErrorr   )selfr   r   r   dtmsgs   &&&&  r   test_nlargest_error/TestSeriesNLargestNSmallest.test_nlargest_error   sF     WWCB4H]]9C00As# 1000s   AA#	dataT)utcint8int16int32int64uint8uint16uint32uint64float32float64c                r   \        V4      p\        P                  ! VP                  ^4      VP                  ^^.,          4       \        P                  ! VP                  ^RR7      VP                  ^^.,          4       VP                  R,          p\        P                  ! VP                  ^ 4      V4       \        P                  ! VP                  R4      V4       \        P                  ! VP                  ^ 4      V4       \        P                  ! VP                  R4      V4       \        P                  ! VP                  \        V4      4      VP                  4       4       \        P                  ! VP                  \        V4      ^,           4      VP                  4       4       \        P                  ! VP                  \        V4      4      VP                  . RO,          4       \        P                  ! VP                  \        V4      ^,           4      VP                  . RO,          4       R# )   lastkeep:    r;   NNr   )   r;         r7   )r   r   r   r   ilocr   lensort_values)r%   r*   r   emptys   &&  r   test_nsmallest_nlargest3TestSeriesNLargestNSmallest.test_nsmallest_nlargest,   si   * Tl
s}}Q/1a&1AB
s}}QV}<chh1v>NO
s}}Q/7
s}}R0%8
s||A6
s||B/7
s}}SX68IJ
s}}SX\:COO<MN
s||CH5sxx7PQ
s||CHqL9388O;TUr   c                H   \        R \        P                  ^^^.4      pVP                  4       pVP                  . RO,          p\
        P                  ! W#4       VP                  4       pVP                  . R	O,          p\
        P                  ! W#4       Rp\        P                  ! \        VR7      ;_uu_ 4        VP                  RR7       RRR4       \        P                  ! \        VR7      ;_uu_ 4        VP                  RR7       RRR4       \        ^.^,          . R
OR7      p\        ^.^,          . ROR7      p\        ^.^,          . ROR7      pVP                  ^4      p\
        P                  ! W%4       VP                  ^RR7      p\
        P                  ! W&4       VP                  ^4      p\
        P                  ! W%4       VP                  ^RR7      p\
        P                  ! W&4       R#   + '       g   i     EL7; i  + '       g   i     EL; i)      @z#keep must be either "first", "last"r    invalidr9   Nindexr8   )r<   r;   r>   r7   r=   )r7   r>   r;   r<   r=   )r=   r7   r>   r<      )r=   r7   r>   )rJ   r<   r>   )r   npnanr   r?   r   r   r   r"   r#   
ValueError)r%   r   r   r   r'   expected_firstexpected_lasts   &      r   test_nlargest_misc.TestSeriesNLargestNSmallest.test_nlargest_miscQ   s{   c2661a+,88O,
v088O,
v03]]:S11MMyM) 2]]:S11LLiL( 2 aS1WO4ay9sQwi8q!
v6qv.
v5a
v6af-
v5) 211111s   ;G<:H<H	H!	nc                D   \        . RO. ROR7      pVP                  V4      pVP                  RR7      P                  V4      p\        P
                  ! W44       VP                  V4      pVP                  4       P                  V4      p\        P
                  ! W44       R# )r=   rH   F)	ascendingN)r=   r<   r>   r7   )r;   r;   r=   r=   )r   r   rA   headr   r   r   )r%   rR   r   r   r   s   &&   r   test_nlargest_n+TestSeriesNLargestNSmallest.test_nlargest_nq   sy     \6a??U?388;
v0q!??$))!,
v0r   c                    \         P                  ! V4      pVP                  VP                  rTWD^,           V^,
          V.p\	        WbV4       R# r=   NrK   iinfominmaxr   )r%   nselect_methodany_int_numpy_dtype
dtype_infomin_valmax_valr   s   &&&    r   test_nlargest_boundary_integer:TestSeriesNLargestNSmallest.test_nlargest_boundary_integer}   s>    XX12
%>>:>>1gk7;%dPr   c                    \         P                  ! V4      pVP                  VP                  rT\         P                  ! WE.^ VR7      w  rgWFWu.p\        WV4       R# )r;   r   N)rK   finfor\   r]   	nextafterr   )	r%   r^   float_numpy_dtyper`   ra   rb   min_2ndmax_2ndr   s	   &&&      r   test_nlargest_boundary_float8TestSeriesNLargestNSmallest.test_nlargest_boundary_float   sM    XX/0
%>>:>><<(:AEVW'3%d~Nr   r   zdatetime64[ns]ztimedelta64[ns]c                    \         P                  ! R 4      pVP                  VP                  rTV^,           V^,           V^,
          WT.p\	        WbV4       R# )r/   NrZ   )r%   r^   r   r`   ra   rb   r   s   &&&    r   #test_nlargest_boundary_datetimelike?TestSeriesNLargestNSmallest.test_nlargest_boundary_datetimelike   sE    
 XXg&
%>>:>>!Wq['A+wH%d>Br   c                    \        . RO4      pVP                  ^RR7      p\        . RO4      p\        P                  ! W#4       VP	                  ^RR7      p\        . RO. ROR7      p\        P                  ! W#4       R# )	
   allr9   rH   N)rq   	         ru   ru   ru      )rq   rs   rt   ru   ru   ru   ru   )rv   ru   ru   ru   ru   )ru   r>   r<   rJ   rv   )r   r   r   r   r   )r%   r   r   r   s   &   r   %test_nlargest_duplicate_keep_all_tiesATestSeriesNLargestNSmallest.test_nlargest_duplicate_keep_all_ties   sd    ./ae,01
v0qu-/A
v0r   zdata,expectedFc                    \        V4      pVP                  ^4      p\        V4      p\        P                  ! WB4       R# rY   )r   r   r   r   )r%   r*   r   r   r   s   &&&  r   test_nlargest_boolean1TestSeriesNLargestNSmallest.test_nlargest_boolean   s2    
 Tla(#
v0r   c                x   TpVP                  R 4      '       d2   \        P                  P                  ^4      P	                  ^^
^
4      pM.\        P                  P                  ^4      P                  ^
4      pVP                  VP                  4       RR7      p\        W2RR7      p\        P                  V^&   VP                  ^4      p\        \        P                  ! V^4      VP                  P                  ^4      R7      P                  ^4      P                  V4      p\        P                  ! WV4       R# )UIntF)copyT)r   r~   rH   N)
startswithrK   randomdefault_rngintegersstandard_normalastypelowerr   pdNAr   deleterI   r   r   )r%   any_numeric_ea_dtyper   arrr   r   r   s   &&     r   test_nlargest_nullable2TestSeriesNLargestNSmallest.test_nlargest_nullable   s    $F##))''*33Ar2>C))''*::2>CjjUj3SD1Aa 299S!$CII,<,<Q,?@Xa[VE] 	
 	v0r   c                   \        . RO4      pVP                  ^RR7      p\        . RO4      p\        P                  ! W#4       \        . RO4      pVP                  ^RR7      p\        . RO4      p\        P                  ! W#4       R# )r=   Nrr   r9   )r=   r7   r>   r>   r>   N)g      ?g       @rF   rF   rF   )r=   r7   NNN)r   r   r   r   )r%   sr   r   s   &   r   #test_nsmallest_nan_when_keep_is_all?TestSeriesNLargestNSmallest.test_nsmallest_nan_when_keep_is_all   sn    ()QU+34
v0+,QU+23
v0r    N)rF   r7   r=   r7   5)rF   r7   r=   r7   rJ   )r7   rJ   r;   r   )200320022001r   2005)3D2D1Dr   5D)r>   r7   r=   r7   rJ   )TFTT)__name__
__module____qualname____firstlineno__r"   markparametrizer   listr(   r   to_datetimeto_timedeltarK   arrayrC   rP   r	   rV   rc   rk   rn   rw   rz   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      sH    [[&h7$H5 $L94=!4=
3	
 [[X
K'@A[[UM2$ 3 B$ [[NNCDNNCNOO:;HH_F3HH_G4HH_G4HH_G4HH_G4HH_H5HH_H5HH_H5HH_I6HH_I6	
$V%$V&6@ [[S%1+.	1 /	1QO [[W'79J&KLC MC	1 [[D%=4&14MPTv3VW111*
1 
1r   r   )__doc__numpyrK   r"   pandasr   r   pandas._testing_testingr   r   r   r   r   r   <module>r      s,   
     -s1 s1r   