+
    xȇi>                        R t ^ RIt^ RIt^ RIHt ^ RIt^ RIH	t
 ^ RIHt ^ RIHt ^ RIHt ]
P"                  tRR R llt]P(                  ! RR	.R
7      R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P(                  R 4       t]P>                  PA                  R4      t! ! R R]PD                  4      t# ! R R]PH                  4      t%R# )a  
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.

The tests in this file are inherited from the BaseExtensionTests, and only
minimal tweaks should be applied to get the tests passing (by overwriting a
parent method).

Additional tests should either be added to one of the BaseExtensionTests
classes (if they are relevant for the extension interface for all dtypes), or
be added to the array-specific tests in `pandas/tests/arrays/`.

Note: we do not bother with base.BaseIndexTests because NumpyExtensionArray
will never be held in an Index.
N)NumpyEADtype)is_object_dtype)NumpyExtensionArray)basec                0    V ^8  d   QhR\         R\         /# )   attrobj)str)formats   "q/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/extension/test_numpy.py__annotate__r   !   s     3 3S 3C 3    c                ~   V R8X  d   \        VRR4      p\        VRR4      p\        V\        4      '       d3   \        V\        4      '       g   VP                  VP                  4      pMG\        V\        4      '       d2   \        V\        4      '       g   VP                  VP                  4      p\        WW#4       R# )z]
patch tm.assert_attr_equal so NumpyEADtype("object") is closed enough to
np.dtype("object")
dtypeN)getattr
isinstancer   astypenumpy_dtypeorig_assert_attr_equal)r   leftrightr	   lattrrattrs   &&&&  r   _assert_attr_equalr   !   s    
 wgt,w-e\**:e\3R3R;;u001D|,,Z|5T5TLL!2!23E4u2r   floatobject)paramsc                 T    \        \        P                  ! V P                  4      4      # N)r   npr   param)requests   &r   r   r   1   s    /00r   c              #     "   V P                  4       ;_uu_ 4       pVP                  \        RR4       VP                  \        P                  R\
        4       Rx  RRR4       R#   + '       g   i     R# ; i5i)a  
A monkeypatch to tells pandas to let us in.

By default, passing a NumpyExtensionArray to an index / series / frame
constructor will unbox that NumpyExtensionArray to an ndarray, and treat
it as a non-EA column. We don't want people using EAs without
reason.

The mechanism for this is a check against ABCNumpyExtensionArray
in each constructor.

But, for testing, we need to allow them in pandas. So we patch
the _typ of NumpyExtensionArray, so that we evade the ABCNumpyExtensionArray
check.
_typ	extensionassert_attr_equalN)contextsetattrr   tm	assertersr   )monkeypatchms   & r   allow_in_pandasr-   6   sP     " 
				!			%v{;			",, 35GH 
			s   A:AA&
A:&A7	1	A:c                     VP                   R 8X  d;   \        P                  ! \        ^
4       Uu. uF  q"3NK  	  up4      P                  pM#\
        P                  ! ^^VP                  R7      p\        V4      # u upi )r   r   )	r   pdSeriesrange_valuesr    arange_dtyper   )r-   r   iarrs   &&  r   datar8   M   s]    H$iiuRy1y!y12::ii2U\\2s## 2s   A:c                     VP                   R 8X  d6   \        \        P                  ! \        P                  R.\
        R7      4      # \        \        P                  ! \        P                  R.4      4      # )r   r/   g      ?   r   r   r    arraynanr   r-   r   s   &&r   data_missingr@   V   sJ    H$"288RVVTN&#IJJrxx677r   c                      R  p V # )c                 j    \         P                  ! V 4      ;'       d    \         P                  ! V4      # r   )r    isnan)abs   &&r   cmpna_cmp.<locals>.cmp_   s     xx{**rxx{*r    )rF   s    r   na_cmprI   ]   s    + Jr   c                    VP                   R8X  d/   \        \        P                  ! . RO\        R7      R,          4      # \        \        P                  ! . RO4      4      # )z]Length-3 array with a known sort order.

This should be three items [B, C, A] with
A < B < C
r   r/   :r;   NN)rH   r      r:   )r;   r       )r   r   r    r=   r   r?   s   &&r   data_for_sortingrO   e   sE     H$ #288,B&#QRT#UVVrxx	233r   c                    VP                   R8X  d7   \        \        P                  ! R\        P                  R.\
        R7      4      # \        \        P                  ! ^\        P                  ^ .4      4      # )zjLength-3 array with a known sort order.

This should be three items [B, NA, A] with
A < B and NA missing.
r   r/   r:   )rN   r<   r?   s   &&r   data_missing_for_sortingrQ   s   sQ     H$"288T2664,@#OPPrxxBFFA788r   c                    VP                   R8X  d   RRRrCpM\        P                  ! ^4      w  r#p\        \        P                  ! W3\        P
                  \        P
                  W"W4.VP                   R7      4      # )zData for factorization, grouping, and unique tests.

Expected to be like [B, B, NA, NA, A, A, B, C]

Where A < B < C and NA is missing
r   r/   r:   rK   rL   )r   r    r4   r   r=   r>   )r-   r   rD   rE   cs   &&   r   data_for_groupingrT      sd     H$daa))A,a
!a35;L;LM r   c                     V P                   R 8X  d   \        P                  ! V  R24       \        P                  ! ^
4      ^,          p\
        P                  ! WR7      # )Oz is not a numeric dtyper/   )kindpytestskipr    onesr   _from_sequence)r   r7   s   & r   data_for_twosr\      sD    zzSug456
''"+/C--c??r   c                z    V R8X  d4   \         P                  P                  RR7      pVP                  V4       R# R# )ax  
Tests for NumpyExtensionArray with nested data. Users typically won't create
these objects via `pd.array`, but they can show up through `.array`
on a Series with nested data. Many of the base tests fail, as they aren't
appropriate for nested data.

This fixture allows these tests to be skipped when used as a usefixtures
marker to either an individual test or a test class.
r   zFails for object dtypereasonN)rX   markxfailapplymarker)r   r"   r`   s   && r   skip_numpy_objectrc      s7     {{  (@ AD! r   rc   c            
         a a ] tR t^t o]P
                  P                  RR7      R 4       t]V 3R l4       t	V 3R lt
V 3R lt]V 3R l4       t]V 3R l4       t]V 3R	 l4       t]V 3R
 l4       t]V 3R l4       t]V 3R l4       t]V 3R l4       t]P
                  P'                  RR7      V 3R l4       tV 3R lt]V 3R l4       tRtRtRtRtV 3R ltR tV 3R ltV 3R ltV 3R ltV3R lR lt V3R lR lt!]P
                  P                  R4      ]P
                  PE                  RRR.4      R  4       4       t#]V 3R! l4       t$]V 3R" l4       t%]V 3R# l4       t&]V 3R$ l4       t']V 3R% l4       t(]]P
                  PE                  R&R'R.4      V 3R( l4       4       t)]V 3R) l4       t*]]P
                  PE                  R*]+PX                  ! . R?O4      ]-PX                  ! . R?OR+R,7      .R-R..R/7      V 3R0 l4       4       t.]]P
                  PE                  R1. R@O]-PX                  ! . R@OR2R,7      ]+PX                  ! . R@O4      .. RAOR/7      V 3R3 l4       4       t/]V 3R4 l4       t0]V 3R5 l4       t1R6 t2]P
                  P'                  R7R7      V 3R8 l4       t3]]P
                  PE                  R9R:R;.4      V 3R< l4       4       t4V 3R= lt5R>t6Vt7V ;t8# )BTestNumpyExtensionArrayzWe don't register our dtyper^   c                    R # r   rH   )selfr8   s   &&r   test_from_dtype'TestNumpyExtensionArray.test_from_dtype        	r   c                &   < \         SV `  W4       R # r   )super)test_series_constructor_scalar_with_index)rg   r8   r   	__class__s   &&&r   rm   ATestNumpyExtensionArray.test_series_constructor_scalar_with_index   s     	9$Fr   c                   < VP                   P                  R 8X  dG   VP                  \        P                  P                  RVP                   P                   2R7      4       \        SV `  V4       R# )r   z:NumpyExtensionArray expectedly clashes with a NumPy name: r^   N)r   r   rb   rX   r`   ra   rl   test_check_dtype)rg   r8   r"   using_infer_stringrn   s   &&&&r   rq   (TestNumpyExtensionArray.test_check_dtype   sc    ::!!X-!!##'::#9#9":< "  	 &r   c                r   < VP                   R 8X  d   \        V4      '       g   Q hR# \        SV `  V4       R# )r   N)r   r   rl   test_is_not_object_type)rg   r   r"   rn   s   &&&r   ru   /TestNumpyExtensionArray.test_is_not_object_type   s1    ( #5))))G+E2r   c                &   < \         SV `  V4       R # r   )rl   test_getitem_scalarrg   r8   rn   s   &&r   rx   +TestNumpyExtensionArray.test_getitem_scalar   s     	#D)r   c                &   < \         SV `  V4       R # r   )rl   test_shift_fill_valuery   s   &&r   r|   -TestNumpyExtensionArray.test_shift_fill_value   s     	%d+r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_limit_framerg   r@   rn   s   &&r   r   /TestNumpyExtensionArray.test_fillna_limit_frame   s     	'5r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_limit_seriesr   s   &&r   r   0TestNumpyExtensionArray.test_fillna_limit_series   s     	(6r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_copy_framer   s   &&r   r   .TestNumpyExtensionArray.test_fillna_copy_frame   s     	&|4r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_copy_seriesr   s   &&r   r   /TestNumpyExtensionArray.test_fillna_copy_series   s     	'5r   c                &   < \         SV `  W4       R # r   )rl   test_searchsorted)rg   rO   	as_seriesrn   s   &&&r   r   )TestNumpyExtensionArray.test_searchsorted   s    
 	!"2>r   z*NumpyExtensionArray.diff may fail on dtypec                "   < \         SV `  W4      # r   )rl   	test_diff)rg   r8   periodsrn   s   &&&r   r   !TestNumpyExtensionArray.test_diff   s    w //r   c                   < VP                   P                  \        8X  d2   \        P                  P                  R R7      pVP                  V4       \        SV `!  V4       R# )z$Dimension mismatch in np.concatenater^   N)	r   r   r   rX   r`   ra   rb   rl   test_insertrg   r8   r"   r`   rn   s   &&& r   r   #TestNumpyExtensionArray.test_insert   sH    ::!!V+;;$$,R$SD%D!r   c                &   < \         SV `  W4       R # r   )rl   test_insert_invalidrg   r8   invalid_scalarrn   s   &&&r   r   +TestNumpyExtensionArray.test_insert_invalid   s     	#D9r   Nc                x   < R pVP                   P                  R8X  d   \        pW n        \        SV `  V4       R # NrV   )r   rW   	TypeError
divmod_excrl   test_divmod)rg   r8   r   rn   s   && r   r   #TestNumpyExtensionArray.test_divmod  s/    
::??c!"J$D!r   c                    \         P                  ! V4      pR pVP                  P                  R8X  d   \        pW0n        V P                  V\        V4       R # r   )r0   r1   r   rW   r   r   _check_divmod_opdivmod)rg   r8   serexcs   &&  r   test_divmod_series_array0TestNumpyExtensionArray.test_divmod_series_array  s@    iio::??c!C!Oc640r   c                  < TpR pVP                   P                  \        8X  dI   VR9   d<   \        P                  P                  RR7      pVP                  P                  V4       \        pWPn	        \        SV `-  W4       R # Nz9the Series.combine step raises but not the Series method.r^   )__mul____rmul__)r   r   r   rX   r`   ra   node
add_markerr   series_scalar_excrl   test_arith_series_with_scalar)rg   r8   all_arithmetic_operatorsr"   opnamer   r`   rn   s   &&&&   r   r   5TestNumpyExtensionArray.test_arith_series_with_scalar  sr    ) ::!!V+00{{((V )  ''- )!2-dMr   c                   < TpR pVP                   P                  \        8X  d   VR9  d   \        pW@n        \
        SV `  W4       R # )N)__add____radd__)r   r   r   r   series_array_excrl   test_arith_series_with_array)rg   r8   r   r   r   rn   s   &&&  r   r   4TestNumpyExtensionArray.test_arith_series_with_array   sA    )::!!V+>U0U( 0,TLr   c                  < TpR pVP                   P                  \        8X  dI   VR9   d<   \        P                  P                  RR7      pVP                  P                  V4       \        pWPn	        \        SV `-  W4       R # r   )r   r   r   rX   r`   ra   r   r   r   frame_scalar_excrl   test_arith_frame_with_scalar)rg   r8   r   r"   r   r   r`   rn   s   &&&&   r   r   4TestNumpyExtensionArray.test_arith_frame_with_scalar(  sr    )::!!V+00{{((V )  ''-( 0,TLr   c                @   < V ^8  d   QhRS[ P                  RS[RS[/# )r   r   op_namereturnr0   r1   r
   bool)r   __classdict__s   "r   r   $TestNumpyExtensionArray.__annotate__5  s&      ryy 3 4 r   c                F    VP                   P                  R 8X  d   VR9   # R# )rV   T)summinmaxanyall)r   rW   )rg   r   r   s   &&&r   _supports_reduction+TestNumpyExtensionArray._supports_reduction5  s!    99>>S AAAr   c                @   < V ^8  d   QhRS[ P                  RS[RS[/# )r   r   r   skipnar   )r   r   s   "r   r   r   :  s&     1 1		 1C 1 1r   c                    \        W4      pVP                  P                  pVP                  V4      p\        Wb4      pVR 8X  d   V! 4       pV! 4       p	MV! VR7      pV! VR7      p	\        P
                  ! W4       R# )count)r   N)r   r   r   r   r)   assert_almost_equal)
rg   r   r   r   res_op	cmp_dtypealtexp_opresultexpecteds
   &&&&      r   check_reduce$TestNumpyExtensionArray.check_reduce:  sm    & II))	jj#&gXFxH6*FV,H
v0r   zTODO: tests not written yetr   TFc                    R # r   rH   )rg   r8   all_numeric_reductionsr   s   &&&&r   test_reduce_frame)TestNumpyExtensionArray.test_reduce_frameJ  rj   r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_seriesr   s   &&r   r   *TestNumpyExtensionArray.test_fillna_seriesO  s     	"<0r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_framer   s   &&r   r   )TestNumpyExtensionArray.test_fillna_frameT  s     	!,/r   c                &   < \         SV `  V4       R # r   )rl   test_fillna_readonlyr   s   &&r   r   ,TestNumpyExtensionArray.test_fillna_readonlyY  s     	$\2r   c                &   < \         SV `  W4       R # r   )rl   test_setitem_invalidr   s   &&&r   r   ,TestNumpyExtensionArray.test_setitem_invalid^  s     	$T:r   c                &   < \         SV `  W4       R # r   )rl    test_setitem_sequence_broadcastsrg   r8   box_in_seriesrn   s   &&&r   r   8TestNumpyExtensionArray.test_setitem_sequence_broadcastsc  s     	0Er   setterlocc                &   < \         SV `  W4       R # r   )rl   test_setitem_mask_broadcast)rg   r8   r   rn   s   &&&r   r   3TestNumpyExtensionArray.test_setitem_mask_broadcasti  s    
 	+D9r   c                &   < \         SV `  V4       R # r   )rl   &test_setitem_scalar_key_sequence_raisery   s   &&r   r   >TestNumpyExtensionArray.test_setitem_scalar_key_sequence_raisep  s     	6t<r   maskbooleanr/   numpy-arrayzboolean-array)idsc                (   < \         SV `  WV4       R # r   )rl   test_setitem_mask)rg   r8   r   r   rn   s   &&&&r   r   )TestNumpyExtensionArray.test_setitem_maskx  s     	!$m<r   idxInt64c                (   < \         SV `  WV4       R # r   )rl   test_setitem_integer_array)rg   r8   r   r   rn   s   &&&&r   r  2TestNumpyExtensionArray.test_setitem_integer_array  s     	*4mDr   c                &   < \         SV `  W4       R # r   )rl   test_setitem_slicer   s   &&&r   r  *TestNumpyExtensionArray.test_setitem_slice  s    "47r   c                &   < \         SV `  V4       R # r   )rl   test_setitem_loc_iloc_slicery   s   &&r   r  3TestNumpyExtensionArray.test_setitem_loc_iloc_slice  s    +D1r   c                   \         P                  ! R \         P                  ! V4      /4      ;r4\         P                  ! VP                  R7      pV! V4      pVR ,          VP                  VR 3&   VP
                  P                  \        8w  dM   \        V\        4      '       d   V\        R4      8w  d'   \         P                  ! R VP                  4       /4      p\        P                  ! WTRR7       R# )r8   )indexNF)check_column_type)r0   	DataFramer1   r
  r   r   r   r   r   sliceto_numpyr)   assert_frame_equal)rg   r8   full_indexerdfr   r   keys   &&&    r   ,test_setitem_with_expansion_dataframe_columnDTestNumpyExtensionArray.test_setitem_with_expansion_dataframe_column  s    fbiio%>??BHH- 2"$V*

3; ::!!V+c5))SE$K-?<<(AB
f%Hr   zNumpyEADtype is unpackedc                &   < \         SV `  V4       R # r   )rl   #test_index_from_listlike_with_dtypery   s   &&r   r  ;TestNumpyExtensionArray.test_index_from_listlike_with_dtype  s    3D9r   enginerS   pythonc                (   < \         SV `  WV4       R # r   )rl   test_EA_types)rg   r  r8   r"   rn   s   &&&&r   r  %TestNumpyExtensionArray.test_EA_types  s     	fG4r   c                   < \        VR,          \        4      '       d2   \        P                  P	                  RR7      pVP                  V4       \        SV `  V4       R# )r;   zUnpacks tupler^   N)r   tuplerX   r`   ra   rb   rl   8test_loc_setitem_with_expansion_preserves_ea_index_dtyper   s   &&& r   r   PTestNumpyExtensionArray.test_loc_setitem_with_expansion_preserves_ea_index_dtype  sF    d2h&&;;$$O$<D%HNr   )r   r   r   r   )TTTFF)rN   r;   r   )listzinteger-arrayr   )9__name__
__module____qualname____firstlineno__rX   r`   rY   rh   skip_nestedrm   rq   ru   rx   r|   r   r   r   r   r   ra   r   r   r   r   r   r   r   r   r   r   r   r   r   r   parametrizer   r   r   r   r   r   r   r   r    r=   r0   r   r  r  r  r  r  r  r   __static_attributes____classdictcell____classcell__)rn   r   s   @@r   re   re      s    [[:; < G G'3 * * , , 6 6
 7 7
 5 5 6 6 ? ? [[JK0 L0" : : J"1NMM 
1 1  [[34[[Xe}5 6 5 1 1 0 0 3 3 ; ; F F
 [[Xt}5: 6 :
 = = [[HH56HH5YG	
 O,  = = [[	BHHYg68KL4  
E E 8 8 2 2I" [[89: :: [[XX75 8 5O Or   re   c                       ] tR tRtRtR# )Test2DCompati  rH   N)r#  r$  r%  r&  r)  rH   r   r   r-  r-    s    r   r-  )
Attributes)&__doc__numpyr    rX   pandas.core.dtypes.dtypesr   pandasr0   pandas._testing_testingr)   pandas.api.typesr   pandas.core.arrays.numpy_r   pandas.tests.extensionr   r&   r   r   fixturer   r-   r8   r@   rI   rO   rQ   rT   r\   rc   r`   usefixturesr'  ExtensionTestsre   NDArrayBacked2DTestsr-  rH   r   r   <module>r<     sq  $   2   , 9 '-- 3  *+1 ,1  , $ $ 8 8   
4 
4 9 9    @ @ " " kk%%&9:HOd11 HOV	4,, 	r   