a
    Pf
                     @  s   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rhddl
Zd	d
 Zejdd Zejdd Zejdd Zejdd Zejdd Zejdd Zejdd ZG dd dejZd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)basec                  C  sH   d} t jdj| d }|t jdj| d }dd t||D S )Nd      )sizec                 S  s   g | ]\}}t ||qS  r   ).0leftrightr   r   ]/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/tests/extension/test_interval.py
<listcomp>%       zmake_data.<locals>.<listcomp>)nprandomZdefault_rnguniformZcumsumzip)NZ
left_arrayZright_arrayr   r   r   	make_data!   s    r   c                   C  s   t  S Nr   r   r   r   r   dtype(   s    r   c                   C  s
   t t S )z*Length-100 PeriodArray for semantics test.)r   r   r   r   r   r   data-   s    r   c                   C  s   t ddgS )zLength 2 array with [NA, Valid]Nr      r   from_tuplesr   r   r   r   data_missing3   s    r!   c                   C  s   t d d S )NzInterval is not a numeric dtype)pytestskipr   r   r   r   data_for_twos9   s    r$   c                   C  s   t g dS )N)r   r   r      r   r   r   r   r   r   data_for_sorting>   s    r(   c                   C  s   t g dS )N)r%   Nr   r   r   r   r   r   data_missing_for_sortingC   s    r)   c               
   C  s&   d} d}d}t ||d d | | ||gS )Nr   r%   r&   r   )abcr   r   r   data_for_groupingH   s    r-   c                      s@   e Zd ZeZddddddZejjdd fd	d
Z	  Z
S )TestIntervalArrayz	pd.Seriesstrbool)serop_namereturnc                 C  s   |dv S )N)minmaxr   )selfr1   r2   r   r   r   _supports_reductionS   s    z%TestIntervalArray._supports_reductionzdRaises with incorrect message bc it disallows *all* listlikes instead of just wrong-length listlikes)reasonc                   s   t  | d S r   )supertest_fillna_length_mismatch)r6   r!   	__class__r   r   r:   V   s    z-TestIntervalArray.test_fillna_length_mismatch)__name__
__module____qualname__	TypeErrorZ
divmod_excr7   r"   markZxfailr:   __classcell__r   r   r;   r   r.   P   s   r.   c                 C  sD   d}t jt|d | ddg W d    n1 s60    Y  d S )Nz=can only insert Interval objects and NA into an IntervalArray)matchr   )r"   Zraisesr@   Zfillna)r!   msgr   r   r   test_fillna_non_scalar_raises_   s    rE   )__doc__
__future__r   typingr   numpyr   r"   Zpandas.core.dtypes.dtypesr   Zpandasr   Zpandas.core.arraysr   Zpandas.tests.extensionr	   pdr   Zfixturer   r   r!   r$   r(   r)   r-   ZExtensionTestsr.   rE   r   r   r   r   <module>   s6   






