o
    d                     @   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lZddlmZ ddlmZ ddlmZ ejd	d
gd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ZG dd deejZ G d d! d!eej!Z"G d"d# d#eej#Z$G d$d% d%ej%Z&G d&d' d'eej'Z(G d(d) d)eej)Z*G d*d+ d+eej+Z,G d,d- d-eej-Z.G d.d/ d/eej/Z0G d0d1 d1eej1Z2G d2d3 d3eej3Z4G d4d5 d5eej5Z6G d6d7 d7eej7Z8G d8d9 d9eej9Z:G d:d; d;eej;Z<G d<d= d=eej=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)iNaT)is_platform_windows)np_version_gte1p24)PeriodDtype)PeriodArray)baseD2D)paramsc                 C   s   t | jdS )Nfreq)r   param)request r   g/var/www/html/visualizacion-main/env/lib/python3.10/site-packages/pandas/tests/extension/test_period.pydtype   s   r   c                 C   s   t tdd| jdS )Ni  i  r   )r   nparanger   r   r   r   r   data$   s   r   c                 C   s   t tdd | jdS )Nd      r   )r   r   onesr   r   r   r   r   data_for_twos)   s   r   c                 C   s   t g d| jdS )N)      r   )r   r   r   r   r   r   data_for_sorting.      r   c                 C   s   t tdg| jdS )Nr   r   r   r   r   r   r   r   r   data_missing3   r   r    c                 C   s   t dtdg| jdS )Nr   r   r   r   r   r   r   r   data_missing_for_sorting8   s   r!   c              	   C   s.   d}t }d}d}t||||||||g| jdS )Nr   r   r   r   )r   r   r   )r   BNAACr   r   r   data_for_grouping=   s
   r&   c                   C   s   t jS N)pdNaTr   r   r   r   na_valueF   s   r*   c                   @      e Zd ZdS )BasePeriodTestsN__name__
__module____qualname__r   r   r   r   r,   K       r,   c                   @   r+   )TestPeriodDtypeNr-   r   r   r   r   r2   O   r1   r2   c                   @   r+   )TestConstructorsNr-   r   r   r   r   r3   S   r1   r3   c                   @   r+   )TestGetitemNr-   r   r   r   r   r4   W   r1   r4   c                   @   r+   )	TestIndexNr-   r   r   r   r   r5   [   r1   r5   c                       s6   e Zd Zdd Zejdddg fddZ  ZS )TestMethodsc                 C   s   d S r'   r   )selfdata_repeatedr   r   r   test_combine_add`   s   zTestMethods.test_combine_addperiods   c                    s^   t  r&tr&tjtdd t || W d    d S 1 sw   Y  d S t || d S )NF)check_stacklevel)r   r   tmassert_produces_warningRuntimeWarningsuper	test_diff)r7   r   r:   	__class__r   r   rB   d   s
   
"zTestMethods.test_diff)	r.   r/   r0   r9   pytestmarkparametrizerB   __classcell__r   r   rC   r   r6   _   s    r6   c                   @   r+   )TestInterfaceNr-   r   r   r   r   rI   m   r1   rI   c                       s\   e Zd ZddhZ fddZ fddZ fddZef fd	d
	Zdd Z	dd Z
  ZS )TestArithmeticOps__sub____rsub__c                    sD   || j v rtd|i}| j|||d d d d S t || d S )Nr$   r   exc)
implementsr(   	DataFramecheck_opnamerA   test_arith_frame_with_scalar)r7   r   all_arithmetic_operatorsdfrC   r   r   rR   t   s   
z.TestArithmeticOps.test_arith_frame_with_scalarc                    B   || j v rt|}| j|||jd d d d S t || d S Nr   rM   rO   r(   SeriesrQ   ilocrA   test_arith_series_with_scalarr7   r   rS   srC   r   r   rZ   }   s   

z/TestArithmeticOps.test_arith_series_with_scalarc                    rU   rV   rW   r[   rC   r   r   test_arith_series_with_array   s   

z.TestArithmeticOps.test_arith_series_with_arrayc                    s   t  j|||td d S )NrM   )rA   _check_divmod_op	TypeError)r7   r\   opotherrN   rC   r   r   r^      s   z"TestArithmeticOps._check_divmod_opc                 C   sJ   t |}d}tjt|d ||  W d    d S 1 sw   Y  d S )NzIunsupported operand type\(s\) for \+: \'PeriodArray\' and \'PeriodArray\')match)r(   rX   rE   raisesr_   )r7   r   r\   msgr   r   r   $test_add_series_with_extension_array   s   

"z6TestArithmeticOps.test_add_series_with_extension_arrayc                 C   s6   t |}|t ju r| }||}|tu sJ d S r'   )r(   rX   rP   to_framerK   NotImplemented)r7   r   frame_or_seriesra   resultr   r   r   6test_direct_arith_with_ndframe_returns_not_implemented   s
   


zHTestArithmeticOps.test_direct_arith_with_ndframe_returns_not_implemented)r.   r/   r0   rO   rR   rZ   r]   NotImplementedErrorr^   re   rj   rH   r   r   rC   r   rJ   q   s    		
rJ   c                   @   r+   )TestCastingNr-   r   r   r   r   rl      r1   rl   c                   @   r+   )TestComparisonOpsNr-   r   r   r   r   rm      r1   rm   c                   @   r+   )TestMissingNr-   r   r   r   r   rn      r1   rn   c                   @   r+   )TestReshapingNr-   r   r   r   r   ro      r1   ro   c                   @   r+   )TestSetitemNr-   r   r   r   r   rp      r1   rp   c                   @   r+   )TestGroupbyNr-   r   r   r   r   rq      r1   rq   c                   @   r+   )TestPrintingNr-   r   r   r   r   rr      r1   rr   c                       s.   e Zd Zejdddg fddZ  ZS )TestParsingenginecpythonc                    s   t  || d S r'   )rA   test_EA_types)r7   rt   r   rC   r   r   rw      r   zTestParsing.test_EA_types)r.   r/   r0   rE   rF   rG   rw   rH   r   r   rC   r   rs      s    rs   c                   @   r+   )Test2DCompatNr-   r   r   r   r   rx      r1   rx   )?__doc__numpyr   rE   pandas._libsr   pandas.compatr   pandas.compat.numpyr   pandas.core.dtypes.dtypesr   pandasr(   pandas._testing_testingr>   pandas.core.arraysr   pandas.tests.extensionr   fixturer   r   r   r   r    r!   r&   r*   r,   BaseDtypeTestsr2   BaseConstructorsTestsr3   BaseGetitemTestsr4   BaseIndexTestsr5   BaseMethodsTestsr6   BaseInterfaceTestsrI   BaseArithmeticOpsTestsrJ   BaseCastingTestsrl   BaseComparisonOpsTestsrm   BaseMissingTestsrn   BaseReshapingTestsro   BaseSetitemTestsrp   BaseGroupbyTestsrq   BasePrintingTestsrr   BaseParsingTestsrs   NDArrayBacked2DTestsrx   r   r   r   r   <module>   sX    







6