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DZ2D)paramsc                 C   s   t | jdS )Nfreq)r   param)request r   V/app/.heroku/python/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   npZaranger   r   r   r   r   data$   s   r   c                 C   s   t tdd | jdS )Nd      r
   )r   r   Z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   BZNAACr   r   r   data_for_grouping=   s
   r"   c                   C   s   t jS N)pdZ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   r-   O   r,   r-   c                   @   r&   )TestConstructorsNr(   r   r   r   r   r.   S   r,   r.   c                   @   r&   )TestGetitemNr(   r   r   r   r   r/   W   r,   r/   c                   @   r&   )	TestIndexNr(   r   r   r   r   r0   [   r,   r0   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   )selfZ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)Zcheck_stacklevel)r   r   tmZassert_produces_warningRuntimeWarningsuper	test_diff)r2   r   r4   	__class__r   r   r:   d   s
   
"zTestMethods.test_diff)	r)   r*   r+   r3   pytestmarkparametrizer:   __classcell__r   r   r;   r   r1   _   s    r1   c                   @   r&   )TestInterfaceNr(   r   r   r   r   rA   m   r,   rA   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_opnamer9   test_arith_frame_with_scalar)r2   r   all_arithmetic_operatorsZdfr;   r   r   rJ   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   rE   rG   r$   SeriesrI   Zilocr9   test_arith_series_with_scalarr2   r   rK   sr;   r   r   rP   }   s   

z/TestArithmeticOps.test_arith_series_with_scalarc                    rL   rM   rN   rQ   r;   r   r   test_arith_series_with_array   s   

z.TestArithmeticOps.test_arith_series_with_arrayc                    s   t  j|||td d S )NrE   )r9   _check_divmod_op	TypeError)r2   rR   opotherrF   r;   r   r   rT      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$   rO   r=   ZraisesrU   )r2   r   rR   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$   rO   rH   Zto_framerC   NotImplemented)r2   r   Zframe_or_seriesrW   resultr   r   r   6test_direct_arith_with_ndframe_returns_not_implemented   s
   


zHTestArithmeticOps.test_direct_arith_with_ndframe_returns_not_implemented)r)   r*   r+   rG   rJ   rP   rS   NotImplementedErrorrT   rZ   r]   r@   r   r   r;   r   rB   q   s    		
rB   c                   @   r&   )TestCastingNr(   r   r   r   r   r_      r,   r_   c                   @   r&   )TestComparisonOpsNr(   r   r   r   r   r`      r,   r`   c                   @   r&   )TestMissingNr(   r   r   r   r   ra      r,   ra   c                   @   r&   )TestReshapingNr(   r   r   r   r   rb      r,   rb   c                   @   r&   )TestSetitemNr(   r   r   r   r   rc      r,   rc   c                   @   r&   )TestGroupbyNr(   r   r   r   r   rd      r,   rd   c                   @   r&   )TestPrintingNr(   r   r   r   r   re      r,   re   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#   )r9   test_EA_types)r2   rg   r   r;   r   r   rj      r   zTestParsing.test_EA_types)r)   r*   r+   r=   r>   r?   rj   r@   r   r   r;   r   rf      s    rf   c                   @   r&   )Test2DCompatNr(   r   r   r   r   rk      r,   rk   )?__doc__numpyr   r=   Zpandas._libsr   Zpandas.compatr   Zpandas.compat.numpyr   Zpandas.core.dtypes.dtypesr   Zpandasr$   Zpandas._testingZ_testingr7   Zpandas.core.arraysr   Zpandas.tests.extensionr   Zfixturer   r   r   r   r   r   r"   r%   r'   ZBaseDtypeTestsr-   ZBaseConstructorsTestsr.   ZBaseGetitemTestsr/   ZBaseIndexTestsr0   ZBaseMethodsTestsr1   ZBaseInterfaceTestsrA   ZBaseArithmeticOpsTestsrB   ZBaseCastingTestsr_   ZBaseComparisonOpsTestsr`   ZBaseMissingTestsra   ZBaseReshapingTestsrb   ZBaseSetitemTestsrc   ZBaseGroupbyTestsrd   ZBasePrintingTestsre   ZBaseParsingTestsrf   ZNDArrayBacked2DTestsrk   r   r   r   r   <module>   sX    







6