U
    >vf                     @   s  d dl Z d dlZd dlmZm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
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gddd Zejdd d d d!d d"d gd#d$d%d&gd'd(d) Zejddgdd*d+ Zejddgdd,d- Zejddgdd.d/ Zejd0d1gdd2d3 Zejddgdd4d5 Zejd6d7 Zejed8d9d:ZdS );    N)Seriesoptionsc                   C   s   t dS )z3A fixture providing the ExtensionDtype to validate.NNotImplementedError r   r   C/tmp/pip-unpacked-wheel-vdrwu74i/pandas/tests/extension/conftest.pydtype   s    r   c                   C   s   t dS )z
    Length-100 array for this type.

    * data[0] and data[1] should both be non missing
    * data[0] and data[1] should not be equal
    Nr   r   r   r   r   data   s    r	   c                   C   s   t dS )z3Length-100 array in which all the elements are two.Nr   r   r   r   r   data_for_twos   s    r
   c                   C   s   t dS )zLength-2 array with [NA, Valid]Nr   r   r   r   r   data_missing"   s    r   )paramsc                 C   s    | j dkr|S | j dkr|S dS )z5Parametrized fixture giving 'data' and 'data_missing'r	   r   Nparam)requestr	   r   r   r   r   all_data(   s    

r   c                    s    fdd}|S )a  
    Generate many datasets.

    Parameters
    ----------
    data : fixture implementing `data`

    Returns
    -------
    Callable[[int], Generator]:
        A callable that takes a `count` argument and
        returns a generator yielding `count` datasets.
    c                 3   s   t | D ]
} V  qd S N)range)count_r	   r   r   genA   s    zdata_repeated.<locals>.genr   )r	   r   r   r   r   data_repeated1   s    r   c                   C   s   t dS )zn
    Length-3 array with a known sort order.

    This should be three items [B, C, A] with
    A < B < C
    Nr   r   r   r   r   data_for_sortingH   s    r   c                   C   s   t dS )z{
    Length-3 array with a known sort order.

    This should be three items [B, NA, A] with
    A < B and NA missing.
    Nr   r   r   r   r   data_missing_for_sortingS   s    r   c                   C   s   t jS )z
    Binary operator for comparing NA values.

    Should return a function of two arguments that returns
    True if both arguments are (scalar) NA for your type.

    By default, uses ``operator.is_``
    )operatoris_r   r   r   r   na_cmp^   s    
r   c                   C   s   dS )z6The scalar missing value for this type. Default 'None'Nr   r   r   r   r   na_valuek   s    r   c                   C   s   t dS )z
    Data for factorization, grouping, and unique tests.

    Expected to be like [B, B, NA, NA, A, A, B, C]

    Where A < B < C and NA is missing
    Nr   r   r   r   r   data_for_groupingq   s    	r   TFc                 C   s   | j S )z#Whether to box the data in a Seriesr   r   r   r   r   box_in_series}   s    r    c                 C   s   dS N   r   xr   r   r   <lambda>       r%   c                 C   s   dgt |  S r!   )lenr#   r   r   r   r%      r&   c                 C   s   t dgt|  S r!   )r   r'   r#   r   r   r   r%      r&   c                 C   s   | S r   r   r#   r   r   r   r%      r&   ZscalarlistZseriesobject)r   idsc                 C   s   | j S )z,
    Functions to test groupby.apply().
    r   r   r   r   r   groupby_apply_op   s    r+   c                 C   s   | j S )zU
    Boolean fixture to support Series and Series.to_frame() comparison testing.
    r   r   r   r   r   as_frame   s    r,   c                 C   s   | j S )zL
    Boolean fixture to support arr and Series(arr) comparison testing.
    r   r   r   r   r   	as_series   s    r-   c                 C   s   | j S )zd
    Boolean fixture to support comparison testing of ExtensionDtype array
    and numpy array.
    r   r   r   r   r   	use_numpy   s    r.   ZffillZbfillc                 C   s   | j S )z{
    Parametrized fixture giving method parameters 'ffill' and 'bfill' for
    Series.fillna(method=<method>) testing.
    r   r   r   r   r   fillna_method   s    r/   c                 C   s   | j S )zR
    Boolean fixture to support ExtensionDtype _from_sequence method testing.
    r   r   r   r   r   as_array   s    r0   c                 C   s
   t t S )z
    A scalar that *cannot* be held by this ExtensionArray.

    The default should work for most subclasses, but is not guaranteed.

    If the array can hold any item (i.e. object dtype), then use pytest.skip.
    )r)   __new__r   r   r   r   invalid_scalar   s    	r2   )returnc                   C   s   t jjot jjdkS )z7
    Fixture to check if Copy-on-Write is enabled.
    block)r   modeZcopy_on_writeZdata_managerr   r   r   r   using_copy_on_write   s    r6   )r   ZpytestZpandasr   r   Zfixturer   r	   r
   r   r   r   r   r   r   r   r   r    r+   r,   r-   r.   r/   r0   r2   boolr6   r   r   r   r   <module>   sb   















	






