o
    ŀg                      @   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
   \/var/www/html/myenv/lib/python3.10/site-packages/pandas/tests/arrays/categorical/test_map.py	na_action   s   r   zdata, categoriesabcbcacab   stringinterval)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 )NABABCCBATr   c                 S      |   S r   lowerxr
   r
   r   <lambda>&       ztest_map.<locals>.<lambda>r   ababccbaBACFc                 S   r"   r   r#   r%   r
   r
   r   r'   +   r(   bacc                 S   s   dS )N   r
   r%   r
   r
   r   r'   0       r-      )dtypec                 S   s   dddd | S )N
         ABC)getr%   r
   r
   r   f7   s   ztest_map.<locals>.f)r1   r2   r1   r2   r3   )r2   r1   r3   )r1   r2   r3   r4   indexr1   r2   r3   )r   listr   r   r   r   nparrayint64assert_index_equalr   )r   r   r   expr9   mapperr
   r
   r   test_map$   s*   rC   )r   r9   r   r-   )FFT   F)r-   rD   c                 C   s@   t | }|j|d d}t|t rt|| d S t|| d S )Nr   )r   r   
isinstancer   r   r@   r   r9   r   valuesr   r
   r
   r   test_map_with_nan_noneF   s
   
rH   )FFFc                 C   sB   t | }|j|dd}| d dkrt|| d S t|| d S )Nr   r   r-   )r   r   r   r   r@   rF   r
   r
   r   test_map_with_nan_ignoreb   s
   rI   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)ar6   r-   rJ   )onerD         @rK   r:   r   )rL   rD   rK   )r   )r   r   r   r   r   dictzip)r   orig_values
new_valuesr   rB   r   r   r
   r
   r   test_map_with_dict_or_series~   s   rR   c                  C   sR   t g d} d}tjt|d | dd  W d    d S 1 s"w   Y  d S )N)rJ   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   assert_produces_warningFutureWarningr   )r   msgr
   r
   r   (test_map_na_action_no_default_deprecated   s   "rY   )numpyr=   pytestpandaspdr   r   r   pandas._testing_testingr   fixturer   markparametrizer<   interval_rangerepeatr   rC   nanisnarH   rI   rR   rY   r
   r
   r
   r   <module>   sh    


" "



	 "




	