o
    7?e                      @   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
   i/home/www/facesmatcher.com/pyenv/lib/python3.10/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 r   lowerxr
   r
   r   <lambda>&       ztest_map.<locals>.<lambda>r   ZababcZcbaZBACFc                 S   r   r   r   r    r
   r
   r   r"   +   r#   Zbacc                 S   s   dS )N   r
   r    r
   r
   r   r"   0       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*   r8   )r   r/   r   r$   )FFT   F)r$   r9   c                 C   s@   t | }|j|d d}t|t rt|| d S t|| d S )Nr   )r   r   
isinstancer   r   r5   r   r/   r   valuesr   r
   r
   r   test_map_with_nan_noneF   s
   
r=   )FFFc                 C   sB   t | }|j|dd}| d dkrt|| d S t|| d S )Nr   r   r$   )r   r   r   r   r5   r;   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?   )oner9         @r@   r0   r   )rA   r9   r@   )r   )r   r   r   r   r   dictzip)r   Zorig_values
new_valuesr   r7   r   r   r
   r
   r   test_map_with_dict_or_series~   s   rF   c                  C   sR   t g d} d}tjt|d | dd  W d    d S 1 s"w   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   "rL   )numpyr3   ZpytestZpandaspdr   r   r   Zpandas._testingZ_testingr   Zfixturer   markZparametrizer2   Zinterval_rangerepeatr   r8   nanZisnar=   r>   rF   rL   r
   r
   r
   r   <module>   sh    


" "



	 "




	