o
    g                     @   s  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 ddlmZmZ ddlmZ dd Zejeegd	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ejdd ZG dd dejZG dd dejZ G d d! d!ej!Z"G d"d# d#ej#Z$G d$d% d%ej%Z&G d&d' d'ej'Z(G d(d) d)ej)Z*G d*d+ d+ej+Z,G d,d- d-ej-Z.G d.d/ d/ej/Z0G d0d1 d1ej1Z2G d2d3 d3ej3Z4G d4d5 d5ej5Z6G d6d7 d7ej7Z8G d8d9 d9ej9Z:G d:d; d;ej;Z<d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)is_extension_array_dtype)is_float_dtype)Float32DtypeFloat64Dtype)basec                   C   s<   t tdddtjg t tddd tjg ddg S )N皙?g?   g#@g#@g      $@)listnparangepdNA r   r   b/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/pandas/tests/extension/test_floating.py	make_data   s   r   )paramsc                 C   s   |   S N)param)requestr   r   r   dtype)   s   r   c                 C   s   t jt | dS )Nr   )r   arrayr   r   r   r   r   data.   s   r   c                 C   s   t jtdd | dS )Nd      r   )r   r   r
   onesr   r   r   r   data_for_twos3      r   c                 C   s   t jt jdg| dS )Nr   r   r   r   r   r   r   r   r   data_missing8   s   r   c                 C   s   t jg d| dS )N)r   皙?        r   )r   r   r   r   r   r   data_for_sorting=   s   r"   c                 C   s   t jdt jdg| dS )Nr   r!   r   r   r   r   r   r   data_missing_for_sortingB   s   r#   c                   C   s   dd S )Nc                 S   s   | t ju o	|t ju S r   r   r   )xyr   r   r   <lambda>J   s    zna_cmp.<locals>.<lambda>r   r   r   r   r   na_cmpG   s   r(   c                   C   s   t jS r   r$   r   r   r   r   na_valueM   s   r)   c              	   C   s0   d}d}d}t j}t j||||||||g| dS )Nr   r!   r    r   )r   r   r   )r   bacnar   r   r   data_for_groupingR   s
   r.   c                   @   s"   e Zd Zejjdddd ZdS )	TestDtypezusing multiple dtypesreasonc                 C      d S r   r   )selfr   r   r   test_is_dtype_unboxes_dtype\   s   z%TestDtype.test_is_dtype_unboxes_dtypeN)__name__
__module____qualname__pytestmarkskipr4   r   r   r   r   r/   [   s    r/   c                       s8   e Zd Zd fdd	ZefddZd fdd	Z  ZS )	TestArithmeticOpsNc                       t  j|||d d d S N)excsupercheck_opnamer3   sop_nameotherr>   	__class__r   r   rA   c   r   zTestArithmeticOps.check_opnamec           	      C   s   |d u r7t |}t|drt|jst|jr||j}|||}| |||}||}| 	|| d S t
| ||| W d    d S 1 sMw   Y  d S )Nr   )tm	get_dtypehasattrr   r   r   astypenumpy_dtype_combineassert_equalr8   raises)	r3   rC   oprE   rD   r>   sdtyperesultexpectedr   r   r   	_check_opg   s    


"zTestArithmeticOps._check_opc                    s   t  |||d  d S r   )r@   _check_divmod_op)r3   rC   rP   rE   r>   rF   r   r   rU   ~   s   z"TestArithmeticOps._check_divmod_opr   )r5   r6   r7   rA   NotImplementedErrorrT   rU   __classcell__r   r   rF   r   r;   b   s    r;   c                       s2   e Zd ZefddZd fdd	Zdd Z  ZS )	TestComparisonOpsc                 C   sn   |d u r|||}| ||d}| || d S t| ||| W d    d S 1 s0w   Y  d S )Nboolean)combinerK   assert_series_equalr8   rO   )r3   rC   rP   rE   rD   r>   rR   rS   r   r   r   rT      s   
"zTestComparisonOps._check_opNc                    r<   r=   r?   rB   rF   r   r   rA      s   zTestComparisonOps.check_opnamec                 C   s   |  ||| d S r   )rA   )r3   rC   r   rD   rE   r   r   r   _compare_other   s   z TestComparisonOps._compare_otherr   )r5   r6   r7   rV   rT   rA   r\   rW   r   r   rF   r   rX      s    
rX   c                   @      e Zd ZdS )TestInterfaceNr5   r6   r7   r   r   r   r   r^          r^   c                   @   r]   )TestConstructorsNr_   r   r   r   r   ra      r`   ra   c                   @   r]   )TestReshapingNr_   r   r   r   r   rb      r`   rb   c                   @   r]   )TestGetitemNr_   r   r   r   r   rc      r`   rc   c                   @   r]   )TestSetitemNr_   r   r   r   r   rd      r`   rd   c                   @   r]   )TestMissingNr_   r   r   r   r   re      r`   re   c                   @   s8   e Zd Zejjdddd Zejjdddd ZdS )TestMethodszuses nullable integerr0   c                 C   sv   |d d }|rt ||   }n|}t|j|d }t|j|d }|j|j	|_| 
|| d S )N
   )dropna)r
   r   isnar   Seriesvalue_counts
sort_indexindexrK   r   r[   )r3   all_datarh   rE   rR   rS   r   r   r   test_value_counts   s   zTestMethods.test_value_countsc                 C   r2   r   r   )r3   r   r   r   r    test_value_counts_with_normalize   s   z,TestMethods.test_value_counts_with_normalizeN)r5   r6   r7   r8   r9   r:   ro   rp   r   r   r   r   rf      s
    
rf   c                   @   r]   )TestCastingNr_   r   r   r   r   rq      r`   rq   c                   @   r]   )TestGroupbyNr_   r   r   r   r   rr      r`   rr   c                   @   s   e Zd Zdd ZdS )TestNumericReducec                 C   sV   t |||d}|s|  rtj}nt | |jj||d}t	
|| d S )N)skipna)getattrri   anyr   r   rh   rK   r   rL   rH   assert_almost_equal)r3   rC   rD   rt   rR   rS   r   r   r   check_reduce   s   zTestNumericReduce.check_reduceN)r5   r6   r7   rx   r   r   r   r   rs      s    rs   c                   @   r]   )TestBooleanReduceNr_   r   r   r   r   ry      r`   ry   c                   @   r]   )TestPrintingNr_   r   r   r   r   rz      r`   rz   c                   @   r]   )TestParsingNr_   r   r   r   r   r{      r`   r{   )=__doc__numpyr
   r8   pandas.core.dtypes.commonr   pandasr   pandas._testing_testingrH   pandas.api.typesr   pandas.core.arrays.floatingr   r   pandas.tests.extensionr   r   fixturer   r   r   r   r"   r#   r(   r)   r.   BaseDtypeTestsr/   BaseArithmeticOpsTestsr;   BaseComparisonOpsTestsrX   BaseInterfaceTestsr^   BaseConstructorsTestsra   BaseReshapingTestsrb   BaseGetitemTestsrc   BaseSetitemTestsrd   BaseMissingTestsre   BaseMethodsTestsrf   BaseCastingTestsrq   BaseGroupbyTestsrr   BaseNumericReduceTestsrs   BaseBooleanReduceTestsry   BasePrintingTestsrz   BaseParsingTestsr{   r   r   r   r   <module>   sX    









 