o
    ҷh                     @   s6   d dl Zd dlZd dlZd dlmZ G dd dZdS )    Nc                   @   s   e Zd Zdd Zejdddgdd Zdd	 Zd
d Z	dd Z
dd Zejddd Zejddd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!S )"BaseMissingTestsc                 C   s~   t ddg}t|}t|| t| }t|}t|| t|ddg }tjg t	d}t|| d S )NTFr      dtype)
nparraypdisnatmassert_numpy_array_equalSeriesassert_series_equaldropbool)selfdata_missingexpectedresult r   V/var/www/html/venv/lib/python3.10/site-packages/pandas/tests/extension/base/missing.py	test_isna	   s   

zBaseMissingTests.test_isnana_funcr	   notnac                 C   sR   t |}| }t|| }t|jt jrt|}d|d d < t	
|| d S )NT)r   r   copygetattr
isinstancer   SparseDtyper   r   r
   r   )r   r   r   r   r   maskr   r   r   test_isna_returns_copy   s   

z'BaseMissingTests.test_isna_returns_copyc                 C   s"   |  }|dg }t|| d S Nr   )dropnar
   assert_extension_array_equal)r   r   r   r   r   r   r   test_dropna_array#   s   
z"BaseMissingTests.test_dropna_arrayc                 C   s.   t |}| }|jdg }t|| d S r   )r   r   r    ilocr
   r   )r   r   serr   r   r   r   r   test_dropna_series(   s   
z#BaseMissingTests.test_dropna_seriesc                 C   s   t d|i}| }|jdg }t|| |jdd}t jt dt g d}t|| t |dtj	gd}| }|jd d }t|| d S )	NAr   columns)axis   )indexr'   r&   Br   )
r   	DataFramer    r#   r
   assert_frame_equal
RangeIndexIndexr   nan)r   r   dfr   r   r   r   r   test_dropna_frame.   s   z"BaseMissingTests.test_dropna_framec                 C   s,   |d }| |}| |}t|| d S r   )fillnar
   r!   )r   r   validr   r   r   r   r   test_fillna_scalarA   s   

z#BaseMissingTests.test_fillna_scalarz>ignore:Series.fillna with 'method' is deprecated:FutureWarningc                 C   sD   | g d}t|jdd}t| g d}t|| d S )Nr   r   r   r   r   r)   )limit)r   r   r   r   r   )taker   r   ffillr
   r   r   r   arrr   r   r   r   r   test_fillna_limit_padG   s   z&BaseMissingTests.test_fillna_limit_padc                 C   sF   | g d}t|jddd}t| g d}t|| d S )Nr7   backfillr)   )methodr8   )r   r   r   r   r   )r9   r   r   r4   r
   r   r;   r   r   r   test_fillna_limit_backfillP   s   z+BaseMissingTests.test_fillna_limit_backfillc                 C   s`   ||    }|d }||}||usJ t|| |jdd}||us(J t|| d S )Nr   r>   )r?   )r	   r4   r
   r!   _pad_or_backfill)r   datar5   r   r   r   r   test_fillna_no_op_returns_copyY   s   
z/BaseMissingTests.test_fillna_no_op_returns_copyc                 C   sr   |d }t |}||}t |j||g|jd}t|| ||}t|| ||}t|| d S )Nr   r   )r   r   r4   _from_sequencer   r
   r   )r   r   
fill_valuer$   r   r   r   r   r   test_fillna_seriese   s   




z#BaseMissingTests.test_fillna_seriesc                 C   sZ   |d }|dkr|d d d }t t|| }t|j||g|jd}t|| d S )Nr   r:   r   )r   r   r   rD   r   r
   r   )r   r   fillna_methodrE   r   r   r   r   r   test_fillna_series_methody   s   
z*BaseMissingTests.test_fillna_series_methodc                 C   sV   |d }t |ddgd|}t |j||g|jdddgd}t|| d S )Nr   r)   r+   r   )r   r-   r4   rD   r   r
   r.   )r   r   rE   r   r   r   r   r   test_fillna_frame   s   
	z"BaseMissingTests.test_fillna_framec                 C   sP   t |tjgt| dddi}t |dgt| d}t|| d S )Nr+   r,   g        )r   r-   r   r1   lenr4   r
   r.   )r   rB   r   r   r   r   r   test_fillna_fill_other   s   &z'BaseMissingTests.test_fillna_fill_otherc              	   C   s   t |}| }d}tjt|d" t dd | }W d    n1 s(w   Y  W d    n1 s7w   Y  t|| d S )Nz"use_inf_as_na option is deprecated)matchzmode.use_inf_as_naT)r   r   r	   r
   assert_produces_warningFutureWarningoption_contextr   )r   r   r$   r   msgr   r   r   r   test_use_inf_as_na_no_effect   s   

z-BaseMissingTests.test_use_inf_as_na_no_effectN)__name__
__module____qualname__r   pytestmarkparametrizer   r"   r%   r3   r6   filterwarningsr=   r@   rC   rF   rI   rJ   rL   rR   r   r   r   r   r      s,    



r   )	numpyr   rV   pandasr   pandas._testing_testingr
   r   r   r   r   r   <module>   s
    