
    o[we                        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mZ ddlmZ ddlmZ  ej        d	d
g          d             Zej        d             Zej        d             Zej        d             Zej        d             Zej        d             Z G d d          Z G d deej                  Z G d deej                  Z G d deej                  Z  G d dej!                  Z" G d deej#                  Z$ G d deej%                  Z& G d  d!eej'                  Z( G d" d#eej)                  Z* G d$ d%eej+                  Z, G d& d'eej-                  Z. G d( d)eej/                  Z0 G d* d+eej1                  Z2 G d, d-eej3                  Z4 G d. d/eej5                  Z6 G d0 d1eej7                  Z8 G d2 d3eej9                  Z:dS )4aj  
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                 ,    t          | j                  S )N)freq)r   param)requests    Blib/python3.11/site-packages/pandas/tests/extension/test_period.pydtyper      s    GM****    c                 J    t          t          j        dd          |           S )Ni  i  r   )r   nparanger   s    r   datar   #   s!    ryt,,E::::r   c                 (    t          g d|           S )N)      r   r   r   s    r   data_for_sortingr   (   s    )))7777r   c                 2    t          t          dg|           S )Nr   r   r   r   r   s    r   data_missingr    -   s    d|51111r   c                 4    t          dt          dg|           S )Nr   r   r   r   r   s    r   data_missing_for_sortingr"   2   s    dD)7777r   c           
      N    d}t           }d}d}t          ||||||||g|           S )Nr   r   r   r   )r   r   )r   BNAACs        r   data_for_groupingr(   7   s:    A	BAA1b"aAq1????r   c                       e Zd ZdS )BasePeriodTestsN__name__
__module____qualname__ r   r   r*   r*   @           Dr   r*   c                       e Zd ZdS )TestPeriodDtypeNr+   r/   r   r   r2   r2   D   r0   r   r2   c                       e Zd ZdS )TestConstructorsNr+   r/   r   r   r4   r4   H   r0   r   r4   c                       e Zd ZdS )TestGetitemNr+   r/   r   r   r6   r6   L   r0   r   r6   c                       e Zd ZdS )	TestIndexNr+   r/   r   r   r8   r8   P   r0   r   r8   c                        e Zd Zej                            dddg           fd            Zej                            dddg          d             Z xZS )	TestMethodsperiods   c                 &   t                      r_t          rXt          j        t          d          5  t                                          ||           d d d            d S # 1 swxY w Y   d S t                                          ||           d S )NF)check_stacklevel)r   r   tmassert_produces_warningRuntimeWarningsuper	test_diff)selfr   r;   	__class__s      r   rD   zTestMethods.test_diffU   s       	-%7 	-+NUSSS 1 1!!$0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 GGdG,,,,,s   #A""A&)A&	na_actionNignorec                 `    |                     d |          }t          j        ||           d S )Nc                     | S )Nr/   )xs    r   <lambda>z&TestMethods.test_map.<locals>.<lambda>_   s    A r   )rG   )mapr@   assert_extension_array_equal)rE   r   rG   results       r   test_mapzTestMethods.test_map]   s2    ++;;
'55555r   )	r,   r-   r.   pytestmarkparametrizerD   rP   __classcell__rF   s   @r   r:   r:   T   s        [YB00- - - - 10- [[4*:;;6 6 <;6 6 6 6 6r   r:   c                       e Zd ZdS )TestInterfaceNr+   r/   r   r   rW   rW   c   r0   r   rW   c                        e Zd Z fdZ xZS )TestArithmeticOpsc                 V    |dv rd S t                                          |||          S )N)__sub____rsub__)rC   _get_expected_exception)rE   op_nameobjotherrF   s       r   r]   z)TestArithmeticOps._get_expected_exceptionh   s0    ---4ww..wUCCCr   )r,   r-   r.   r]   rT   rU   s   @r   rY   rY   g   sA        D D D D D D D D Dr   rY   c                       e Zd ZdS )TestCastingNr+   r/   r   r   rb   rb   n   r0   r   rb   c                       e Zd ZdS )TestComparisonOpsNr+   r/   r   r   rd   rd   r   r0   r   rd   c                       e Zd ZdS )TestMissingNr+   r/   r   r   rf   rf   v   r0   r   rf   c                       e Zd ZdS )TestReshapingNr+   r/   r   r   rh   rh   z   r0   r   rh   c                       e Zd ZdS )TestSetitemNr+   r/   r   r   rj   rj   ~   r0   r   rj   c                       e Zd ZdS )TestGroupbyNr+   r/   r   r   rl   rl      r0   r   rl   c                       e Zd ZdS )TestPrintingNr+   r/   r   r   rn   rn      r0   r   rn   c                       e Zd ZdS )TestParsingNr+   r/   r   r   rp   rp      r0   r   rp   c                       e Zd ZdS )Test2DCompatNr+   r/   r   r   rr   rr      r0   r   rr   );__doc__numpyr   rQ   pandas._libsr   pandas.compatr   pandas.compat.numpyr   pandas.core.dtypes.dtypesr   pandas._testing_testingr@   pandas.core.arraysr   pandas.tests.extensionr	   fixturer   r   r   r    r"   r(   r*   BaseDtypeTestsr2   BaseConstructorsTestsr4   BaseGetitemTestsr6   BaseIndexTestsr8   BaseMethodsTestsr:   BaseInterfaceTestsrW   BaseArithmeticOpsTestsrY   BaseCastingTestsrb   BaseComparisonOpsTestsrd   BaseMissingTestsrf   BaseReshapingTestsrh   BaseSetitemTestsrj   BaseGroupbyTestsrl   BasePrintingTestsrn   BaseParsingTestsrp   NDArrayBacked2DTestsrr   r/   r   r   <module>r      s               - - - - - - 2 2 2 2 2 2 1 1 1 1 1 1       * * * * * * ' ' ' ' ' ' T{###+ + $#+ ; ; ; 8 8 8 2 2 2 8 8 8 @ @ @	 	 	 	 	 	 	 		 	 	 	 	ot': 	 	 		 	 	 	 	(B 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	# 	 	 	6 6 6 6 6/4#8 6 6 6	 	 	 	 	OT%< 	 	 	D D D D D)D D D D	 	 	 	 	/4#8 	 	 		 	 	 	 	)D 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	OT%< 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	?D$: 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	?D$= 	 	 	 	 	r   