
    d                     &   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             Zej        d             Zej        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/                  Z0 G d( d)eej1                  Z2 G d* d+eej3                  Z4 G d, d-eej5                  Z6 G d. d/eej7                  Z8 G d0 d1eej9                  Z: G d2 d3eej;                  Z< G d4 d5eej=                  Z>dS )6aj  
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    ^/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/tests/extension/test_period.pydtyper      s    GM****    c                 T    t          t          j        dd          | j                  S )Ni  i  r   )r   nparanger   r   s    r   datar   $   s#    ryt,,5:>>>>r   c                 X    t          t          j        d          dz  | j                  S )Nd      r   )r   r   onesr   r   s    r   data_for_twosr   )   s$    rws||a'ej9999r   c                 2    t          g d| j                  S )N)      r   )r   r   r   s    r   data_for_sortingr"   .   s    )))
;;;;r   c                 <    t          t          dg| j                  S )Nr!   r   r   r   r   r   s    r   data_missingr%   3   s    d|%*5555r   c                 >    t          dt          dg| j                  S )Nr   r!   r   r$   r   s    r   data_missing_for_sortingr'   8   s    dD)
;;;;r   c           
      X    d}t           }d}d}t          ||||||||g| j                  S )Nr   r!   r    r   )r   r   r   )r   BNAACs        r   data_for_groupingr-   =   s<    A	BAA1b"aAq1
CCCCr   c                      t           j        S N)pdNaT r   r   na_valuer3   F   s	    6Mr   c                       e Zd ZdS )BasePeriodTestsN__name__
__module____qualname__r2   r   r   r5   r5   K           Dr   r5   c                       e Zd ZdS )TestPeriodDtypeNr6   r2   r   r   r<   r<   O   r:   r   r<   c                       e Zd ZdS )TestConstructorsNr6   r2   r   r   r>   r>   S   r:   r   r>   c                       e Zd ZdS )TestGetitemNr6   r2   r   r   r@   r@   W   r:   r   r@   c                       e Zd ZdS )	TestIndexNr6   r2   r   r   rB   rB   [   r:   r   rB   c                   j     e Zd Zd Zej                            dddg           fd            Z xZS )TestMethodsc                     d S r/   r2   )selfdata_repeateds     r   test_combine_addzTestMethods.test_combine_add`   s    r   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)rF   r   rI   	__class__s      r   rR   zTestMethods.test_diffd   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&)	r7   r8   r9   rH   pytestmarkparametrizerR   __classcell__rS   s   @r   rD   rD   _   sj           [YB00- - - - 10- - - - -r   rD   c                       e Zd ZdS )TestInterfaceNr6   r2   r   r   rZ   rZ   m   r:   r   rZ   c                   T     e Zd ZddhZ fdZ fdZ fdZef fd	Zd Z	d Z
 xZS )	TestArithmeticOps__sub____rsub__c                     || j         v r7t          j        d|i          }|                     |||d         d            d S t	                                          ||           d S )Nr+   r   exc)
implementsr0   	DataFramecheck_opnamerQ   test_arith_frame_with_scalar)rF   r   all_arithmetic_operatorsdfrS   s       r   re   z.TestArithmeticOps.test_arith_frame_with_scalart   sn    #t66sDk**Bb":DGNNNNN GG007OPPPPPr   c                     || j         v r:t          j        |          }|                     |||j        d         d            d S t                                          ||           d S Nr   r`   rb   r0   Seriesrd   ilocrQ   test_arith_series_with_scalarrF   r   rf   srS   s       r   rm   z/TestArithmeticOps.test_arith_series_with_scalar}   sj    #t66	$Aa!916!9$OOOOO GG11$8PQQQQQr   c                     || j         v r:t          j        |          }|                     |||j        d         d            d S t                                          ||           d S ri   rj   rn   s       r   test_arith_series_with_arrayz.TestArithmeticOps.test_arith_series_with_array   sj    #t66	$Aa!916!9$OOOOO GG11$8PQQQQQr   c                 \    t                                          |||t                     d S )Nr`   )rQ   _check_divmod_op	TypeError)rF   ro   opotherra   rS   s        r   rs   z"TestArithmeticOps._check_divmod_op   s*      B9 =====r   c                     t          j        |          }d}t          j        t          |          5  ||z    d d d            d S # 1 swxY w Y   d S )NzIunsupported operand type\(s\) for \+: \'PeriodArray\' and \'PeriodArray\')match)r0   rk   rT   raisesrt   )rF   r   ro   msgs       r   $test_add_series_with_extension_arrayz6TestArithmeticOps.test_add_series_with_extension_array   s    IdOO3 	 ]9C000 	 	HH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AA	A	c                     t          j        |          }|t           j        u r|                                }|                    |          }|t
          u sJ d S r/   )r0   rk   rc   to_framer]   NotImplemented)rF   r   frame_or_seriesrv   results        r   6test_direct_arith_with_ndframe_returns_not_implementedzHTestArithmeticOps.test_direct_arith_with_ndframe_returns_not_implemented   sU     	$bl**NN$$Ee$$''''''r   )r7   r8   r9   rb   re   rm   rq   NotImplementedErrorrs   r{   r   rW   rX   s   @r   r\   r\   q   s        Z(JQ Q Q Q QR R R R RR R R R R 2E > > > > > >  	( 	( 	( 	( 	( 	( 	(r   r\   c                       e Zd ZdS )TestCastingNr6   r2   r   r   r   r      r:   r   r   c                       e Zd ZdS )TestComparisonOpsNr6   r2   r   r   r   r      r:   r   r   c                       e Zd ZdS )TestMissingNr6   r2   r   r   r   r      r:   r   r   c                       e Zd ZdS )TestReshapingNr6   r2   r   r   r   r      r:   r   r   c                       e Zd ZdS )TestSetitemNr6   r2   r   r   r   r      r:   r   r   c                       e Zd ZdS )TestGroupbyNr6   r2   r   r   r   r      r:   r   r   c                       e Zd ZdS )TestPrintingNr6   r2   r   r   r   r      r:   r   r   c                   d     e Zd Zej                            dddg           fd            Z xZS )TestParsingenginecpythonc                 L    t                                          ||           d S r/   )rQ   test_EA_types)rF   r   r   rS   s      r   r   zTestParsing.test_EA_types   s#    fd+++++r   )r7   r8   r9   rT   rU   rV   r   rW   rX   s   @r   r   r      sY        [XX77, , , , 87, , , , ,r   r   c                       e Zd ZdS )Test2DCompatNr6   r2   r   r   r   r      r:   r   r   )?__doc__numpyr   rT   pandas._libsr   pandas.compatr   pandas.compat.numpyr   pandas.core.dtypes.dtypesr   pandasr0   pandas._testing_testingrN   pandas.core.arraysr   pandas.tests.extensionr   fixturer   r   r   r"   r%   r'   r-   r3   r5   BaseDtypeTestsr<   BaseConstructorsTestsr>   BaseGetitemTestsr@   BaseIndexTestsrB   BaseMethodsTestsrD   BaseInterfaceTestsrZ   BaseArithmeticOpsTestsr\   BaseCastingTestsr   BaseComparisonOpsTestsr   BaseMissingTestsr   BaseReshapingTestsr   BaseSetitemTestsr   BaseGroupbyTestsr   BasePrintingTestsr   BaseParsingTestsr   NDArrayBacked2DTestsr   r2   r   r   <module>r      s               - - - - - - 2 2 2 2 2 2 1 1 1 1 1 1           * * * * * * ' ' ' ' ' ' T{###+ + $#+ ? ? ? : : : < < < 6 6 6 < < < D D D   	 	 	 	 	 	 	 		 	 	 	 	ot': 	 	 		 	 	 	 	(B 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	# 	 	 	- - - - -/4#8 - - -	 	 	 	 	OT%< 	 	 	3( 3( 3( 3( 3()D 3( 3( 3(l	 	 	 	 	/4#8 	 	 		 	 	 	 	)D 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	OT%< 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	/4#8 	 	 		 	 	 	 	?D$: 	 	 	, , , , ,/4#8 , , ,	 	 	 	 	?D$= 	 	 	 	 	r   