B
    Y0d                 @   s  d Z ddlZddl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 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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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(Z)G d+d, d,eej*Z+G d-d. d.eej,Z-G d/d0 d0eej.Z/G d1d2 d2eej0Z1G d3d4 d4eej2Z3G d5d6 d6eej4Z5dS )7aj  
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)PeriodDtype)PeriodArray)basec               C   s
   t ddS )ND)freq)r    r   r   T/var/www/html/venv/lib/python3.7/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 dddg| jdS )Ni  i  i  )r   )r   r   )r
   r   r   r	   data_for_sorting+   s    r   c             C   s   t tdg| jdS )Ni  )r   )r   r   r   )r
   r   r   r	   data_missing0   s    r   c             C   s   t dtdg| jdS )Ni  i  )r   )r   r   r   )r
   r   r   r	   data_missing_for_sorting5   s    r   c          	   C   s.   d}t }d}d}t||||||||g| jdS )Ni  i  i  )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_valueC   s    r   c               @   s   e Zd ZdS )BasePeriodTestsN)__name__
__module____qualname__r   r   r   r	   r   H   s   r   c               @   s   e Zd ZdS )TestPeriodDtypeN)r   r   r   r   r   r   r	   r   L   s   r   c               @   s   e Zd ZdS )TestConstructorsN)r   r   r   r   r   r   r	   r   P   s   r   c               @   s   e Zd ZdS )TestGetitemN)r   r   r   r   r   r   r	   r   T   s   r   c               @   s   e Zd Zdd ZdS )TestMethodsc             C   s   d S )Nr   )selfZdata_repeatedr   r   r	   test_combine_addY   s    zTestMethods.test_combine_addN)r   r   r   r"   r   r   r   r	   r    X   s   r    c               @   s   e Zd ZdS )TestInterfaceN)r   r   r   r   r   r   r	   r#   ^   s   r#   c                   sr   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	e
jdejejgdd Z  ZS )TestArithmeticOps__sub____rsub__c                sB   || j kr0td|i}| j|||d d d nt || d S )Nr   r   )exc)
implementsr   	DataFramecheck_opnamesupertest_arith_frame_with_scalar)r!   r   all_arithmetic_operatorsZdf)	__class__r   r	   r,   f   s    
z.TestArithmeticOps.test_arith_frame_with_scalarc                s@   || j kr.t|}| j|||jd d d nt || d S )Nr   )r'   )r(   r   Seriesr*   ilocr+   test_arith_series_with_scalar)r!   r   r-   s)r.   r   r	   r1   o   s    

z/TestArithmeticOps.test_arith_series_with_scalarc                s@   || j kr.t|}| j|||jd d d nt || d S )Nr   )r'   )r(   r   r/   r*   r0   r+   r1   )r!   r   r-   r2   )r.   r   r	   test_arith_series_with_arrayx   s    

z.TestArithmeticOps.test_arith_series_with_arrayc                s   t  j|||td d S )N)r'   )r+   _check_divmod_op	TypeError)r!   r2   opotherr'   )r.   r   r	   r4      s    z"TestArithmeticOps._check_divmod_opc          	   C   s4   t |}d}tjt|d ||  W d Q R X d S )NzIunsupported operand type\(s\) for \+: \'PeriodArray\' and \'PeriodArray\')match)r   r/   pytestZraisesr5   )r!   r   r2   msgr   r   r	   $test_add_series_with_extension_array   s    
z6TestArithmeticOps.test_add_series_with_extension_arrayboxc             C   s6   t |}|t jkr| }||}|tks2td S )N)r   r/   r)   Zto_framer%   NotImplementedAssertionError)r!   r   r<   r7   resultr   r   r	   6test_direct_arith_with_ndframe_returns_not_implemented   s
    


zHTestArithmeticOps.test_direct_arith_with_ndframe_returns_not_implemented)r   r   r   r(   r,   r1   r3   NotImplementedErrorr4   r;   r9   markparametrizer   r/   r)   r@   __classcell__r   r   )r.   r	   r$   c   s   		
r$   c               @   s   e Zd ZdS )TestCastingN)r   r   r   r   r   r   r	   rE      s   rE   c               @   s   e Zd Zdd ZdS )TestComparisonOpsc             C   s   d S )Nr   )r!   r2   r   Zop_namer7   r   r   r	   _compare_other   s    z TestComparisonOps._compare_otherN)r   r   r   rG   r   r   r   r	   rF      s   rF   c               @   s   e Zd ZdS )TestMissingN)r   r   r   r   r   r   r	   rH      s   rH   c               @   s   e Zd ZdS )TestReshapingN)r   r   r   r   r   r   r	   rI      s   rI   c               @   s   e Zd ZdS )TestSetitemN)r   r   r   r   r   r   r	   rJ      s   rJ   c               @   s   e Zd ZdS )TestGroupbyN)r   r   r   r   r   r   r	   rK      s   rK   c               @   s   e Zd ZdS )TestPrintingN)r   r   r   r   r   r   r	   rL      s   rL   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 )N)r+   test_EA_types)r!   rN   r   )r.   r   r	   rQ      s    zTestParsing.test_EA_types)r   r   r   r9   rB   rC   rQ   rD   r   r   )r.   r	   rM      s   rM   c               @   s   e Zd ZdS )Test2DCompatN)r   r   r   r   r   r   r	   rR      s   rR   )6__doc__numpyr   r9   Zpandas._libsr   Zpandas.core.dtypes.dtypesr   Zpandasr   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BaseMethodsTestsr    ZBaseInterfaceTestsr#   ZBaseArithmeticOpsTestsr$   ZBaseCastingTestsrE   ZBaseComparisonOpsTestsrF   ZBaseMissingTestsrH   ZBaseReshapingTestsrI   ZBaseSetitemTestsrJ   ZBaseGroupbyTestsrK   ZBasePrintingTestsrL   ZBaseParsingTestsrM   ZDim2CompatTestsrR   r   r   r   r	   <module>   s>   	5