
    dk              
          d Z ddlZddlZddlmZmZ ddlZddl	m
Z ddlmZmZ ddlmZmZmZmZmZmZmZmZ ddlmZ d Z ej        eeeeeeee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#ej        d             Z$ G d dej%                  Z& G d dej'                  Z( G d dej)                  Z* G d dej+                  Z, G d dej-                  Z. G d dej/                  Z0 G d dej1                  Z2 G d  d!ej3                  Z4 G d" d#ej5                  Z6 G d$ d%ej7                  Z8 G d& d'ej9                  Z: G d( d)ej;                  Z< G d* d+ej=                  Z> G d, d-ej?                  Z@ejA        B                    d./           G d0 d1ejC                              ZD G d2 d3ejE                  ZF G d4 d5ejG                  ZH G d6 d7ejI                  ZJ G d8 d9ejK                  ZLd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)IS64is_platform_windows)is_extension_array_dtypeis_integer_dtype)	Int8Dtype
Int16Dtype
Int32Dtype
Int64Dtype
UInt8DtypeUInt16DtypeUInt32DtypeUInt64Dtype)basec                      t          t          dd                    t          j        gz   t          t          dd                    z   t          j        gz   ddgz   S )N   	   
   b   c   d   )listrangepdNA     _/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/tests/extension/test_integer.py	make_datar   +   sH    aw&eBmm)<)<<wF"cRRr   )paramsc                 *    |                                  S N)param)requests    r   dtyper$   /   s     ==??r   c                 F    t          j        t                      |           S )Nr$   )r   arrayr   r&   s    r   datar(   ?   s    8IKKu----r   c                 X    t          j        t          j        d          dz  |           S )Nr      r&   )r   r'   nponesr&   s    r   data_for_twosr-   D   s$    8BGCLL1$E2222r   c                 F    t          j        t           j        dg|           S )Nr   r&   r   r'   r   r&   s    r   data_missingr0   I   s    8RUAJe,,,,r   c                 2    t          j        g d|           S )N)r   r*   r   r&   )r   r'   r&   s    r   data_for_sortingr2   N   s    8IIIU++++r   c                 H    t          j        dt           j        dg|           S )Nr   r   r&   r/   r&   s    r   data_missing_for_sortingr4   S   s    8QqM////r   c                      d S )Nc                 :    | t           j        u o|t           j        u S r!   r   r   )xys     r   <lambda>zna_cmp.<locals>.<lambda>[   s    RU
1qBEz r   r   r   r   r   na_cmpr;   X   s     211r   c                      t           j        S r!   r7   r   r   r   na_valuer=   ^   s	    5Lr   c           
      b    d}d}d}t           j        }t          j        ||||||||g|           S )Nr   r   r*   r&   )r   r   r'   )r$   bacnas        r   data_for_groupingrC   c   s>    	A	A	A	B8Q2r1aA.e<<<<r   c                       e Zd ZdS )	TestDtypeN__name__
__module____qualname__r   r   r   rE   rE   l           Dr   rE   c                   6     e Zd Zd fd	ZefdZd fd	Z xZS )TestArithmeticOpsNc                 R    t                                          |||d            d S N)excsupercheck_opnameselfsop_nameotherrO   	__class__s        r   rR   zTestArithmeticOps.check_opnameq   s*    QD99999r   c                 d   |t          j        |          }t          |d          rIt          |j                  s5t          |j                  r!|j        r|                    |j                  } |||          }| 	                    |||          }|dv r3|
                    t          j                                      d          }n|                    |          }|                     ||           d S t          j        |          5   |||           d d d            d S # 1 swxY w Y   d S )Nr$   )__rtruediv____truediv____div__Float64)tm	get_dtypehasattrr   r$   r   is_unsigned_integerastypenumpy_dtype_combinefillnar+   nanassert_equalpytestraises)	rT   rU   oprW   rV   rO   sdtyperesultexpecteds	            r   	_check_opzTestArithmeticOps._check_opu   sv   ;\!__F w''90==9 %U[119 .	9 V%788R5\\F}}Qr22HDDD#??262299)DD $??622fh/////s##  1e                 s   D%%D),D)c                 P    t                                          |||d            d S r!   )rQ   _check_divmod_op)rT   rU   rj   rW   rO   rX   s        r   rp   z"TestArithmeticOps._check_divmod_op   s'      Bt44444r   r!   )rG   rH   rI   rR   NotImplementedErrorrn   rp   __classcell__rX   s   @r   rL   rL   p   su        : : : : : : 4G    >5 5 5 5 5 5 5 5 5 5r   rL   c                   0     e Zd ZefdZd fd	Zd Z xZS )TestComparisonOpsc                    |M |||          }|                     ||                              d          }|                     ||           d S t          j        |          5   |||           d d d            d S # 1 swxY w Y   d S )Nboolean)combinerb   assert_series_equalrh   ri   )rT   rU   rj   rW   rV   rO   rl   rm   s           r   rn   zTestComparisonOps._check_op   s    ;R5\\Fyy++229==H$$VX66666s##  1e                 s   $A>>BBNc                 R    t                                          |||d            d S rN   rP   rS   s        r   rR   zTestComparisonOps.check_opname   s*    QD99999r   c                 J    d|j          d}|                     |||           d S )N__)rG   rR   )rT   rU   r(   rj   rW   rV   s         r   _compare_otherz TestComparisonOps._compare_other   s2    &r{&&&!We,,,,,r   r!   )rG   rH   rI   rq   rn   rR   r}   rr   rs   s   @r   ru   ru      sc        3F    : : : : : :- - - - - - -r   ru   c                       e Zd ZdS )TestInterfaceNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )TestConstructorsNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )TestReshapingNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )TestGetitemNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )TestSetitemNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )	TestIndexNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )TestMissingNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZeZdS )TestMethodsN)rG   rH   rI   object_combine_le_expected_dtyper   r   r   r   r      s        !'r   r   c                       e Zd ZdS )TestCastingNrF   r   r   r   r   r      rJ   r   r   c                       e Zd ZdS )TestGroupbyNrF   r   r   r   r   r      rJ   r   r   c                       e Zd Zd ZdS )TestNumericReducec                    |dk    rV t          ||                      } t          |                                                    d          |                      }n t          ||          |          } t          |                                                    d          |          |          }|s2|                                                                rt
          j        }t          j        ||           d S )Ncountint64skipna)	getattrdropnarb   isnaanyr   r   r^   assert_almost_equal)rT   rU   rV   r   rl   rm   s         r   check_reducezTestNumericReduce.check_reduce   s     g(WQ((**FCwqxxzz00997CCEEHH(WQ((777FCwqxxzz00997CC6RRRH !affhhllnn !5
vx00000r   N)rG   rH   rI   r   r   r   r   r   r      s#        1 1 1 1 1r   r   z-Tested in tests/reductions/test_reductions.py)reasonc                       e Zd ZdS )TestBooleanReduceNrF   r   r   r   r   r      s        Dr   r   c                   `    e Zd Zd Zej                            dddg          d             ZdS )TestAccumulationc           
      .   d}t           rt                      r|j        j        dk    sd}|j        j                            d          rd| }nd| }|dk    r t          ||          |          }t          j        t          j	         t          |
                    d	          |          |          |
                    }t          j        ||           d S |dv r t          ||          |          }t          j        t          j	         t          |
                    d	          |          |          |j        
                    }t          j        ||           d S |dk    r t          |d d         |          |          }t          j        t          j	         t          |d d         
                    d	          |          |          |
                    }t          j        ||           d S t          | d          )N@          UUIntIntcumsumr   float64r&   )cummaxcummincumprod   z not supported)r   r   r$   itemsizename
startswithr   r   Seriesr'   rb   r^   ry   rq   )rT   rU   rV   r   lengthexpected_dtyperl   rm   s           r   check_accumulatez!TestAccumulation.check_accumulate   sB     	*,, 	7#q((7<""3'' 	,,F__NN+6^^Nh(WQ((777Fy9GAHHY//99HHH(   H "6844444,,,(WQ((777Fy9GAHHY//99HHH'   H "6844444	!!-WQssVW--V<<<Fy>GAcrcFMM)44g>>fMMM(   H "6844444 &&@&@&@AAAr   r   TFc                     d S r!   r   )rT   r(   all_numeric_accumulationsr   s       r   test_accumulate_series_raisesz.TestAccumulation.test_accumulate_series_raises  s    r   N)rG   rH   rI   r   rh   markparametrizer   r   r   r   r   r      sY        *B *B *BX [Xe}55  65  r   r   c                       e Zd ZdS )TestPrintingNrF   r   r   r   r   r     rJ   r   r   c                       e Zd ZdS )TestParsingNrF   r   r   r   r   r   !  rJ   r   r   c                       e Zd ZdS )Test2DCompatNrF   r   r   r   r   r   %  rJ   r   r   )M__doc__numpyr+   rh   pandas.compatr   r   pandasr   pandas._testing_testingr^   pandas.api.typesr   r   pandas.core.arrays.integerr   r   r	   r
   r   r   r   r   pandas.tests.extensionr   r   fixturer$   r(   r-   r0   r2   r4   r;   r=   rC   BaseDtypeTestsrE   BaseArithmeticOpsTestsrL   BaseComparisonOpsTestsru   BaseInterfaceTestsr   BaseConstructorsTestsr   BaseReshapingTestsr   BaseGetitemTestsr   BaseSetitemTestsr   BaseIndexTestsr   BaseMissingTestsr   BaseMethodsTestsr   BaseCastingTestsr   BaseGroupbyTestsr   BaseNumericReduceTestsr   r   skipBaseBooleanReduceTestsr   BaseAccumulateTestsr   BasePrintingTestsr   BaseParsingTestsr   Dim2CompatTestsr   r   r   r   <module>r      s               
                 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ( ' ' ' ' 'S S S 	     . . . 3 3 3 - - - , , , 0 0 0 2 2 2
    = = =	 	 	 	 	# 	 	 	%5 %5 %5 %5 %53 %5 %5 %5P- - - - -3 - - -&	 	 	 	 	D+ 	 	 		 	 	 	 	t1 	 	 		 	 	 	 	D+ 	 	 		 	 	 	 	$' 	 	 		 	 	 	 	$' 	 	 		 	 	 	 	# 	 	 		 	 	 	 	$' 	 	 	( ( ( ( ($' ( ( (	 	 	 	 	$' 	 	 		 	 	 	 	$' 	 	 	1 1 1 1 13 1 1 1 HII	 	 	 	 	3 	 	 JI	/ / / / /t/ / / /d	 	 	 	 	4) 	 	 		 	 	 	 	$' 	 	 		 	 	 	 	4' 	 	 	 	 	r   