a
    Pf                      @   sf  d dl Zd dlZd dlZd dlmZmZmZ d dlm	Z
 ejddgddd Zejjdeded	fed d
d
ed d
fgddgddd Zdd Zejdddejgejeg dfddejgejeg dfddejgddieddejgfddejgdddeddejgfddejgeddgeddejgfddejgedgd
 eddejgffdd Zejdddejgejeddejgfddejgejeddejgfddejgddieddejgfddejgdddeddejgfddejgeddgeddejgfddejgeg deddejgffdd Zdd Zdd  ZdS )!    N)CategoricalIndexSeriesignore)paramsc                 C   s   | j S N)param)request r
   a/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/tests/arrays/categorical/test_map.py	na_action   s    r   zdata, categoriesZabcbcaZcab   stringinterval)Zidsc                 C   sF   t | ||d}|jt|d}t tt| tt||d}t|| d S )N
categoriesorderedr   )r   mapstrtmassert_categorical_equal)datar   r   r   catresultexpectedr
   r
   r   test_map_str   s    
r   c                 C   sn  t tdtddd}|jdd | d}t tdtd	dd}t|| t tdtd
dd}|jdd | d}t tdtddd}t|| |jdd | d}ttjdgd tjd}t	|| t tdtd
dd}dd }|j|| d}t g dg ddd}t|| t
g dg dd}|j|| d}t|| |jdddd| d}t|| d S )NZABABCZCBATr   c                 S   s   |   S r   lowerxr
   r
   r   <lambda>&       ztest_map.<locals>.<lambda>r   ZababcZcbaZBACFc                 S   s   |   S r   r   r   r
   r
   r   r!   +   r"   Zbacc                 S   s   dS )N   r
   r   r
   r
   r   r!   0   r"   r#      )Zdtypec                 S   s   dddd | S )N
         ABC)getr   r
   r
   r   f7   s    ztest_map.<locals>.f)r%   r&   r%   r&   r'   )r&   r%   r'   )r%   r&   r'   r(   indexr%   r&   r'   )r   listr   r   r   r   nparrayZint64assert_index_equalr   )r   r   r   expr-   mapperr
   r
   r   test_map$   s*    r6   )r   r-   r   r#   )FFT   F)r#   r7   c                 C   s>   t | }|j|d d}t|t r.t|| nt|| d S )Nr   )r   r   
isinstancer   r   r3   r   r-   r   valuesr   r
   r
   r   test_map_with_nan_noneF   s
    
r;   )FFFc                 C   s@   t | }|j|dd}| d dkr0t|| nt|| d S )Nr   r   r#   )r   r   r   r   r3   r9   r
   r
   r   test_map_with_nan_ignoreb   s
    r<   c                 C   s   g d}g d}t |}t|d d |d d d}|j|| d}t |g dd}t|| tt|d d |d d }|j|| d}t|| d S )N)ar*   r#   r=   )oner7         @r>   r.   r   )r?   r7   r>   )r   )r   r   r   r   r   dictzip)r   Zorig_values
new_valuesr   r5   r   r   r
   r
   r   test_map_with_dict_or_series~   s    rD   c                  C   sP   t g d} d}tjt|d | dd  W d    n1 sB0    Y  d S )N)r=   bczThe default value of 'ignore' for the `na_action` parameter in pandas.Categorical.map is deprecated and will be changed to 'None' in a future version. Please set na_action to the desired value to avoid seeing this warning)matchc                 S   s   | S r   r
   r   r
   r
   r   r!      r"   z:test_map_na_action_no_default_deprecated.<locals>.<lambda>)r   r   Zassert_produces_warningFutureWarningr   )r   msgr
   r
   r   (test_map_na_action_no_default_deprecated   s
    rJ   )numpyr1   ZpytestZpandaspdr   r   r   Zpandas._testingZ_testingr   Zfixturer   markZparametrizer0   Zinterval_rangerepeatr   r6   nanZisnar;   r<   rD   rJ   r
   r
   r
   r   <module>   sf   


" "



	 "




	