
    d                        d Z ddlZddlZddlmZ ddlZddlm	Z	 ddl
mZ  ej        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&                  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j0                  Z1 G d. d/eej2                  Z3dS )0aj  
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)DatetimeTZDtype)DatetimeArray)basez
US/Central)paramsc                 .    t          d| j                  S )Nns)unittz)r   param)requests    `/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/tests/extension/test_datetime.pydtyper      s    7777    c                 \    t          t          j        dd| j                  |           }|S )N2000d   )periodsr
   r   )r   pd
date_ranger
   )r   datas     r   r   r      s-    vsuxHHHPUVVVDKr   c                 P    t          t          j        ddgd          |           S )NNaT
2000-01-01datetime64[ns]r   )r   nparrayr   s    r   data_missingr   %   s3    
%&.>???u   r   c                     t          j        d          }t          j        d          }t          j        d          }t          t          j        |||gd          |           S )Nr   
2000-01-02
2000-01-03r   r   r   	Timestampr   r   r   )r   abcs       r   data_for_sortingr'   ,   sX    
\""A
\""A
\""A1a)3CDDDERRRRr   c                     t          j        d          }t          j        d          }t          t          j        |d|gd          |           S )Nr   r    r   r   r   r"   )r   r$   r%   s      r   data_missing_for_sortingr)   4   sJ    
\""A
\""A1eQ-7GHHHPUVVVVr   c                     t          j        d          }t          j        d          }t          j        d          }d}t          t          j        ||||||||gd          |           S )z_
    Expected to be like [B, B, NA, NA, A, A, B, C]

    Where A < B < C and NA is missing
    r   r    r!   r   r   r   r"   )r   r$   r%   r&   nas        r   data_for_groupingr,   ;   ss     	\""A
\""A
\""A	B
!QB1a+3CDDDE   r   c                      d } | S )Nc                 &    | t           j        u o| |u S Nr   r   )r$   r%   s     r   cmpzna_cmp.<locals>.cmpM   s    BF{%qAv%r    )r1   s    r   na_cmpr3   K   s    & & & Jr   c                      t           j        S r/   r0   r2   r   r   na_valuer5   S   s	    6Mr   c                       e Zd ZdS )BaseDatetimeTestsN__name__
__module____qualname__r2   r   r   r7   r7   Y           Dr   r7   c                       e Zd ZdS )TestDatetimeDtypeNr8   r2   r   r   r>   r>   _   r<   r   r>   c                        e Zd Z fdZ xZS )TestConstructorsc                 t    |                     d           }t                                          |           d S r/   )
_with_freqsupertest_series_constructor)selfr   	__class__s     r   rD   z(TestConstructors.test_series_constructord   s2    t$$''-----r   )r9   r:   r;   rD   __classcell__rF   s   @r   r@   r@   c   s8        . . . . . . . . .r   r@   c                       e Zd ZdS )TestGetitemNr8   r2   r   r   rJ   rJ   j   r<   r   rJ   c                       e Zd ZdS )	TestIndexNr8   r2   r   r   rL   rL   n   r<   r   rL   c                       e Zd Zd ZdS )TestMethodsc                     d S r/   r2   )rE   data_repeateds     r   test_combine_addzTestMethods.test_combine_adds   s    r   N)r9   r:   r;   rQ   r2   r   r   rN   rN   r   s#            r   rN   c                       e Zd ZdS )TestInterfaceNr8   r2   r   r   rS   rS   x   r<   r   rS   c                   F     e Zd ZddhZ fdZ fdZd Z fdZd Z xZ	S )TestArithmeticOps__sub____rsub__c                     || j         v r7t          j        d|i          }|                     |||d         d            d S t	                                          ||           d S )NAr   exc)
implementsr   	DataFramecheck_opnamerC   test_arith_frame_with_scalar)rE   r   all_arithmetic_operatorsdfrF   s       r   r_   z.TestArithmeticOps.test_arith_frame_with_scalar   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   rZ   r\   r   Seriesr^   ilocrC   test_arith_series_with_scalarrE   r   r`   serrF   s       r   rg   z/TestArithmeticOps.test_arith_series_with_scalar   j    #t66)D//Cc#;SXa[dSSSSS GG11$8PQQQQQr   c                     t          j        |          }d}t          j        t          |          5  ||z    d d d            d S # 1 swxY w Y   d S )Nz*cannot add DatetimeArray and DatetimeArray)match)r   re   pytestraises	TypeError)rE   r   ri   msgs       r   $test_add_series_with_extension_arrayz6TestArithmeticOps.test_add_series_with_extension_array   s    ioo:]9C000 	 	$JJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AA	A	c                     || j         v r:t          j        |          }|                     |||j        d         d            d S t                                          ||           d S rc   rd   rh   s       r   test_arith_series_with_arrayz.TestArithmeticOps.test_arith_series_with_array   rj   r   c                     d S r/   r2   )rE   s    r   test_divmod_series_arrayz*TestArithmeticOps.test_divmod_series_array   s	     	r   )
r9   r:   r;   r\   r_   rg   rq   rs   ru   rG   rH   s   @r   rU   rU   |   s        Z(JQ Q Q Q QR R R R R  R R R R R      r   rU   c                       e Zd ZdS )TestCastingNr8   r2   r   r   rw   rw      r<   r   rw   c                       e Zd ZdS )TestComparisonOpsNr8   r2   r   r   ry   ry      r<   r   ry   c                       e Zd ZdS )TestMissingNr8   r2   r   r   r{   r{      r<   r   r{   c                       e Zd ZdS )TestReshapingNr8   r2   r   r   r}   r}      r<   r   r}   c                       e Zd ZdS )TestSetitemNr8   r2   r   r   r   r      r<   r   r   c                       e Zd ZdS )TestGroupbyNr8   r2   r   r   r   r      r<   r   r   c                       e Zd ZdS )TestPrintingNr8   r2   r   r   r   r      r<   r   r   c                       e Zd ZdS )Test2DCompatNr8   r2   r   r   r   r      r<   r   r   )4__doc__numpyr   rm   pandas.core.dtypes.dtypesr   pandasr   pandas.core.arraysr   pandas.tests.extensionr   fixturer   r   r   r'   r)   r,   r3   r5   r7   BaseDtypeTestsr>   BaseConstructorsTestsr@   BaseGetitemTestsrJ   BaseIndexTestsrL   BaseMethodsTestsrN   BaseInterfaceTestsrS   BaseArithmeticOpsTestsrU   BaseCastingTestsrw   BaseComparisonOpsTestsry   BaseMissingTestsr{   BaseReshapingTestsr}   BaseSetitemTestsr   BaseGroupbyTestsr   BasePrintingTestsr   NDArrayBacked2DTestsr   r2   r   r   <module>r      sf         5 5 5 5 5 5     , , , , , , ' ' ' ' ' ' ~&&&8 8 '&8   
    S S S W W W         
	 	 	 	 	 	 	 		 	 	 	 	)4+> 	 	 	. . . . .($*D . . .	 	 	 	 	#T%: 	 	 		 	 	 	 	# 	 	 	    #T%:   	 	 	 	 	%t'> 	 	 	& & & & &)4+F & & &R	 	 	 	 	#T%: 	 	 		 	 	 	 	)4+F 	 	 		 	 	 	 	#T%: 	 	 		 	 	 	 	%t'> 	 	 		 	 	 	 	#T%: 	 	 		 	 	 	 	#T%: 	 	 		 	 	 	 	$d&< 	 	 		 	 	 	 	$d&? 	 	 	 	 	r   