+
    xȇi                         ^ RI t^ RIt^ RIHtHtHtHt ^ RI	H
t ]P                  R 4       tR tR tR tR tR tR	 tR
 tR tR tR tR tR# )    N)	DataFrameSeriesarray
date_rangec                 (    \        R. ROR. RO/4      # )z
base dataframe for testing
ab         )         )r        z/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/series/methods/test_case_when.pydfr      s    
 c9c9566r   c                    RpVR,          p\         P                  ! \        VR7      ;_uu_ 4        V R,          P                  RR7       RRR4       R#   + '       g   i     R# ; i)z-
Raise ValueError if caselist is not a list.
z(The caselist argument should be a list; zinstead got.+matchr   caselistNr   )pytestraises	TypeError	case_whenr   msgs   & r   %test_case_when_caselist_is_not_a_listr       sH     5C?C	y	,	,
32& 
-	,	,	,s   AA%	c                    RpVR,          p\         P                  ! \        VR7      ;_uu_ 4        V R,          P                  . 4       RRR4       R#   + '       g   i     R# ; i)z.
Raise ValueError if no caselist is provided.
z(provide at least one boolean condition, z!with a corresponding replacement.r   r   N)r   r   
ValueErrorr   r   s   & r   test_case_when_no_caselistr#      sF     5C..C	z	-	-
3" 
.	-	-	-s   AA$	c           	     4   RpVR,          p\         P                  ! \        VR7      ;_uu_ 4        V R,          P                  V R,          P	                  ^4      ^V P
                  P                  ^4      3.4       RRR4       R#   + '       g   i     R# ; i)z,
Raise ValueError if no of caselist is odd.
zArgument 0 must have length 2; z2a condition and replacement; instead got length 3.r   r   N)r   r   r"   r   eqr   gtr   s   & r   test_case_when_odd_caselistr'   )   sh     ,C??C	z	-	-
3BsGJJqM1bddggaj9:; 
.	-	-	-s   ABB	c                    Rp\         P                  ! \        VR7      ;_uu_ 4        V R,          P                  V R,          P	                  ^4      ^^.3.4       RRR4       R#   + '       g   i     R# ; i)z%
Raise Error from within Series.mask
z,Failed to apply condition0 and replacement0.r   r   N)r   r   r"   r   r%   r   s   & r   $test_case_when_raise_error_from_maskr)   4   sS     9C	z	-	-
3BsGJJqMAq6234 
.	-	-	-s   4A%%A6	c                L   \        \        P                  \        P                  \        P                  .4      P                  V P                  P                  ^4      ^3.4      p\        ^\        P                  \        P                  .4      p\        P                  ! W4       R# )z$
Test output on a single condition.
Nr   npnanr   r   r%   tmassert_series_equalr   resultexpecteds   &  r   test_case_when_single_conditionr3   =   sf     RVVRVVRVV,-77"$$''!*a8IJFq"&&"&&)*H6,r   c                L   \        \        P                  \        P                  \        P                  .4      P                  V P                  P                  ^4      ^3\        . RO4      ^3.4      p\        ^^\        P                  .4      p\        P                  ! W4       R# )z:
Test output when booleans are derived from a computation
N)FTFr+   r0   s   &  r   "test_case_when_multiple_conditionsr5   F   ss     RVVRVVRVV,-77
$$''!*a6"67;<F q!RVVn%H6,r   c                r   \        \        P                  \        P                  \        P                  .4      P                  . RO^3V R,          P	                  ^4      V R,          P                  ^4      ,          . RO3.4      p\        ^^\        P                  .4      p\        P                  ! W4       R# )z(
Test output when replacement is a list
r   r	   NTFFr
   )r   r,   r-   r   r&   r%   r.   r/   r0   s   &  r   3test_case_when_multiple_conditions_replacement_listr8   Q   s     RVVRVVRVV,-77
	"RWZZ]RWZZ]%BI$NOF q!RVVn%H6,r   c           	        \        \        P                  \        P                  \        P                  .4      P                  . RO^3V R,          P	                  ^4      V R,          P                  ^4      ,          \        . RORR7      3.4      p\        ^^\        P                  .RR7      p\        P                  ! W4       R# )	z5
Test output when replacement has an extension dtype
r   r	   Int64)dtypeFloat64Nr7   r
   )	r   r,   r-   r   r&   r%   pd_arrayr.   r/   r0   s   &  r   >test_case_when_multiple_conditions_replacement_extension_dtyper>   \   s     RVVRVVRVV,-77!1%WZZ]RWZZ]*HYg,NO	
F q!RVVnI6H6,r   c                   \        \        P                  \        P                  \        P                  .4      P                  \        P                  ! . RO4      ^3V R,          P                  ^4      V R,          P                  ^4      ,          \        . RO4      3.4      p\        ^^\        P                  .4      p\        P                  ! W4       R# )z*
Test output when replacement is a Series
r   r	   Nr7   r
   )	r   r,   r-   r   r   r&   r%   r.   r/   r0   s   &  r   5test_case_when_multiple_conditions_replacement_seriesr@   j   s     RVVRVVRVV,-77XX*+Q/WZZ]RWZZ]*F9,=>	
F q!RVVn%H6,r   c                 6   \         P                  P                  ^{R7      p \        R^R7      p\	        V P                  R	R7      V. R
OR7      p\        ^VP                  RR7      P                  VP                  P                  ^ 4      VP                  3.4      pVP                  P                  VP                  P                  ^ 4      VP                  4      P                  VP                  P                  ^ 4      ^4      p\        P                  ! W44       R# )z(
Test output if index is not RangeIndex
)seedz1/1/2000)periods)sizeA)indexcolumns)rF   nameN)   r   )rE   BCD)r,   randomdefault_rngr   r   standard_normalr   rF   r   rE   r&   rJ   maskwherer.   r/   )rngdatesr   r1   r2   s        r   test_case_when_non_range_indexrT   x   s     ))

S

)Cz1-E	(?S
B ARXXC0::RTTWWQZ<N;OPFttyyRTT*00Q?H6,r   c                 
   \         P                  ! R
R^4      p \        V 4      pVP                  R R 3R R 3.R7      p\         P                  ! W ^ 8  V ^ 8  .R R .4      p\
        P                  ! V\        V4      4       R	# )z
Test output on a callable
g      @c                     V ^ 8  # r   r   r   s   &r   <lambda>)test_case_when_callable.<locals>.<lambda>   s    Qr   c                     V ) # Nr   rX   s   &r   rY   rZ      s    B3r   c                     V ^ 8  # rW   r   rX   s   &r   rY   rZ      s    ar   c                     V # r\   r   rX   s   &r   rY   rZ      s    Br   r   c                     V ) # r\   r   xs   &r   rY   rZ      s    A2r   c                     V # r\   r   r`   s   &r   rY   rZ      s    r   Ng      )r,   linspacer   r   	piecewiser.   r/   )ra   serr1   r2   s       r   test_case_when_callablerf      s    
 	D#q!A
)C]]//
  F ||AAqAv{0KLH66(#34r   )numpyr,   r   pandasr   r   r   r=   r   pandas._testing_testingr.   fixturer   r    r#   r'   r)   r3   r5   r8   r>   r@   rT   rf   r   r   r   <module>rl      si        7 7'<5------5r   