
    Pi                       d Z ddlmZ ddlmZ ddlZddlZddlm	Z	 ddl
mZ ddlmZ ddlmZ erddl
ZddZej        d             Zej        d             Zej        d             Zej        d             Zej        d             Zej        d             Zej        d             Z G d dej                  Zd ZdS )aj  
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/`.

    )annotations)TYPE_CHECKINGNIntervalDtypeInterval)IntervalArray)basenintc                0   t           j                            d                              |                                           }|t           j                            d                              |           z   }d t          ||d          D             S )N   )sizec                4    g | ]\  }}t          ||          S  r   ).0leftrights      x/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/tests/extension/test_interval.py
<listcomp>zmake_data.<locals>.<listcomp>%   s6       D% 	u      T)strict)nprandomdefault_rnguniformcumsumzip)r   
left_arrayright_arrays      r   	make_datar!   "   s    &&q))11q199@@BBJry44Q77??Q?GGGK z;tDDD   r   c                     t                      S Nr   r   r   r   dtyper$   +   s    ??r   c                 :    t          t          d                    S )z+Length-10 IntervalArray for semantics test.
   )r	   r!   r   r   r   datar'   0   s     2'''r   c                 .    t          j        ddg          S )zLength 2 array with [NA, Valid]Nr      r	   from_tuplesr   r   r   data_missingr-   6   s     $dF^444r   c                 .    t          j        d           d S )NzInterval is not a numeric dtype)pytestskipr   r   r   data_for_twosr1   <   s    
K122222r   c                 .    t          j        g d          S )N)r*   r   r      r)   r+   r   r   r   data_for_sortingr6   A   s    $%=%=%=>>>r   c                 .    t          j        g d          S )N)r3   Nr)   r+   r   r   r   data_missing_for_sortingr8   F   s    $%;%;%;<<<r   c            
     F    d} d}d}t          j        ||d d | | ||g          S )Nr)   r3   r4   r+   )abcs      r   data_for_groupingr=   K   s3    AAA$aD$1a%CDDDr   c                      e Zd ZeZddZ fdZ fd	Zej	        
                    d
           fd            Zej	        
                    d           fd            Zej	                            d           fd            Zej	                            d           fd            Zej	                            d          ej	                            dddg           fd                        Zej	                            d           fd            Zej	        
                    d           fd            Z xZS )TestIntervalArrayser	pd.Seriesop_namestrreturnboolc                
    |dv S )N)minmaxr   )selfr@   rB   s      r   _supports_reductionz%TestIntervalArray._supports_reductionV   s    .((r   c                    t          j        t          d          5  t                                          |           d d d            d S # 1 swxY w Y   d S Nzlimit must be Nonematchr/   raises
ValueErrorsupertest_fillna_limit_framerI   r-   	__class__s     r   rS   z)TestIntervalArray.test_fillna_limit_frameY       ]:-ABBB 	: 	:GG++L999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:   "AAAc                    t          j        t          d          5  t                                          |           d d d            d S # 1 swxY w Y   d S rL   rO   rT   s     r   test_fillna_limit_seriesz*TestIntervalArray.test_fillna_limit_series^   rV   rW   zdRaises with incorrect message bc it disallows *all* listlikes instead of just wrong-length listlikes)reasonc                J    t                                          |           d S r#   )rR   test_fillna_length_mismatchrT   s     r   r\   z-TestIntervalArray.test_fillna_length_mismatchc   s#    
 	++L99999r   zcopy=False is not Implementedc                J    t                                          |           d S r#   )rR   test_fillna_readonlyrT   s     r   r^   z&TestIntervalArray.test_fillna_readonlyj   s!    $$\22222r   z7ignore:invalid value encountered in cast:RuntimeWarningc                J    t                                          |           d S r#   )rR   test_hash_pandas_objectrI   r'   rU   s     r   r`   z)TestIntervalArray.test_hash_pandas_objectn   s#     	''-----r   c                L    t                                          ||           d S r#   )rR   test_hash_pandas_object_works)rI   r'   as_framerU   s      r   rc   z/TestIntervalArray.test_hash_pandas_object_workst   s%     	--dH=====r   enginer<   pythonc                N    t                                          |||           d S r#   )rR   test_EA_types)rI   re   r'   requestrU   s       r   rh   zTestIntervalArray.test_EA_typesz   s'    
 	fdG44444r   c                J    t                                          |           d S r#   )rR   test_astype_strra   s     r   rk   z!TestIntervalArray.test_astype_str   s#     	%%%%%r   zpTest is invalid for IntervalDtype, needs to be adapted for this dtype with an index with index._index_as_unique.c                J    t                                          |           d S r#   )rR   8test_loc_setitem_with_expansion_preserves_ea_index_dtypera   s     r   rm   zJTestIntervalArray.test_loc_setitem_with_expansion_preserves_ea_index_dtype   s#    
 	HHNNNNNr   )r@   rA   rB   rC   rD   rE   )__name__
__module____qualname__	TypeError
divmod_excrJ   rS   rY   r/   markxfailr\   r^   filterwarningsr`   rc   parametrizerh   rk   rm   __classcell__)rU   s   @r   r?   r?   S   sM       J) ) ) ): : : : :
: : : : :
 [1   : : : :	 : [=>>3 3 3 3 ?>3 [A . . . . . [A > > > > > [A  [XX775 5 5 5 87 5 [A & & & & & [@   O O O O	 O O O O Or   r?   c                    d}t          j        t          |          5  |                     ddg           d d d            d S # 1 swxY w Y   d S )Nz=can only insert Interval objects and NA into an IntervalArrayrM   r*   )r/   rP   rq   fillna)r-   msgs     r   test_fillna_non_scalar_raisesr{      s    
IC	y	,	,	, $ $QF###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s   AA
A)r   r   )__doc__
__future__r   typingr   numpyr   r/   pandas.core.dtypes.dtypesr   pandasr   pandas.core.arraysr	   pandas.tests.extensionr
   pdr!   fixturer$   r'   r-   r1   r6   r8   r=   ExtensionTestsr?   r{   r   r   r   <module>r      s     # " " " " "                  3 3 3 3 3 3       , , , , , , ' ' ' ' ' '        ( ( (
 5 5 5
 3 3 3 ? ? ? = = = E E E9O 9O 9O 9O 9O+ 9O 9O 9Oz$ $ $ $ $r   