o
    ҷh                     @   s   d 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 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/`.

    N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   W/var/www/html/venv/lib/python3.10/site-packages/pandas/tests/extension/test_interval.py
<listcomp>   s    zmake_data.<locals>.<listcomp>)nprandomdefault_rnguniformcumsumzip)N
left_array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_missing,   s   r"   c                   C   s   t d d S )NzNot a numeric dtype)pytestskipr   r   r   r   data_for_twos2      r%   c                   C      t g dS )N)r   r	   r	      r   r    r   r   r   r   data_for_sorting7   r&   r+   c                   C   r'   )N)r(   Nr   r    r   r   r   r   data_missing_for_sorting<   r&   r,   c               
   C   s&   d} d}d}t ||d d | | ||gS )Nr   r(   r)   r    )abcr   r   r   data_for_groupingA   s   r0   c                       sx   e Zd ZeZdedefddZej	j
dd fddZej	d	d
dg fddZej	j
dd fddZ  ZS )TestIntervalArrayop_namereturnc                 C   s   |dv S )N)minmaxr   )selfobjr2   r   r   r   _supports_reductionL   s   z%TestIntervalArray._supports_reductionzdRaises with incorrect message bc it disallows *all* listlikes instead of just wrong-length listlikes)reasonc                       t  | d S r   )supertest_fillna_length_mismatch)r6   r"   	__class__r   r   r<   O   s   z-TestIntervalArray.test_fillna_length_mismatchenginer/   pythonc                    sF   d}t jt|d t || W d    d S 1 sw   Y  d S )Nz,.*must implement _from_sequence_of_strings.*match)r#   raisesNotImplementedErrorr;   test_EA_types)r6   r?   r   expected_msgr=   r   r   rE   V   s   "zTestIntervalArray.test_EA_typeszCLooks like the test (incorrectly) implicitly assumes int/bool dtypec                    r:   r   )r;   test_invert)r6   r   r=   r   r   rG   \   s   zTestIntervalArray.test_invert)__name__
__module____qualname__	TypeError
divmod_excstrboolr8   r#   markxfailr<   parametrizerE   rG   __classcell__r   r   r=   r   r1   I   s    r1   c                 C   sF   d}t jt|d | ddg W d    d S 1 sw   Y  d S )Nz=can only insert Interval objects and NA into an IntervalArrayrA   r   )r#   rC   rK   fillna)r"   msgr   r   r   test_fillna_non_scalar_raisesd   s   "rU   )__doc__numpyr   r#   pandas.core.dtypes.dtypesr   pandasr   pandas.core.arraysr   pandas.tests.extensionr   r   fixturer   r   r"   r%   r+   r,   r0   ExtensionTestsr1   rU   r   r   r   r   <module>   s0    






