o
    Û­jÅ  ã                   @   s¸  d dl Z d dlZd dlm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g d$¢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d.d/gd�d0d1„ ƒZejddgd�d2d3„ ƒZejd4d5„ ƒZejd6efd7d8„ƒZdS )9é    N)Ú_get_option)ÚSeriesÚoptionsc                   C   ó   t ‚)z3A fixture providing the ExtensionDtype to validate.©ÚNotImplementedError© r   r   ú\/var/www/html/CropPilot/venv/lib/python3.10/site-packages/pandas/tests/extension/conftest.pyÚdtype   ó   r
   c                   C   r   )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
    r   r   r   r   r	   Údata   ó   r   c                 C   s$   | j s| jdkst | › d�¡ t‚)z‰
    Length-100 array in which all the elements are two.

    Call pytest.skip in your fixture if the dtype does not support divmod.
    Úmz is not a numeric dtype)Ú_is_numericÚkindÚpytestÚskipr   ©r
   r   r   r	   Údata_for_twos   s   r   c                   C   r   )zLength-2 array with [NA, Valid]r   r   r   r   r	   Údata_missing-   r   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_data3   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	   ÚgenL   s   €ÿzdata_repeated.<locals>.genr   )r   r    r   r   r	   Údata_repeated<   s   r!   c                   C   r   )zÆ
    Length-3 array with a known sort order.

    This should be three items [B, C, A] with
    A < B < C

    For boolean dtypes (for which there are only 2 values available),
    set B=C=True
    r   r   r   r   r	   Údata_for_sortingS   s   r"   c                   C   r   )z{
    Length-3 array with a known sort order.

    This should be three items [B, NA, A] with
    A < B and NA missing.
    r   r   r   r   r	   Údata_missing_for_sortinga   r   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_cmpl   s   
r&   c                 C   ó   | j S )z 
    The scalar missing value for this type. Default dtype.na_value.

    TODO: can be removed in 3.x (see https://github.com/pandas-dev/pandas/pull/54930)
    )Úna_valuer   r   r   r	   r(   y   s   r(   c                   C   r   )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.

    If a dtype has _is_boolean = True, i.e. only 2 unique non-NA entries,
    then set C=B.
    r   r   r   r   r	   Údata_for_groupingƒ   s   r)   TFc                 C   r'   )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>š   ó    r0   c                 C   s   dgt | ƒ S r,   )Úlenr.   r   r   r	   r0   ›   s    c                 C   s   t dgt| ƒ ƒS r,   )r   r2   r.   r   r   r	   r0   œ   s    c                 C   s   | S r   r   r.   r   r   r	   r0   �   r1   )ÚscalarÚlistÚseriesÚobject)r   Úidsc                 C   r'   )z,
    Functions to test groupby.apply().
    r   r*   r   r   r	   Úgroupby_apply_op˜   s   r8   c                 C   r'   )zU
    Boolean fixture to support Series and Series.to_frame() comparison testing.
    r   r*   r   r   r	   Úas_frame¨   ó   r9   c                 C   r'   )zL
    Boolean fixture to support arr and Series(arr) comparison testing.
    r   r*   r   r   r	   Ú	as_series°   r:   r;   c                 C   r'   )zd
    Boolean fixture to support comparison testing of ExtensionDtype array
    and numpy array.
    r   r*   r   r   r	   Ú	use_numpy¸   ó   r<   ÚffillÚbfillc                 C   r'   )z{
    Parametrized fixture giving method parameters 'ffill' and 'bfill' for
    Series.fillna(method=<method>) testing.
    r   r*   r   r   r	   Úfillna_methodÁ   r=   r@   c                 C   r'   )zR
    Boolean fixture to support ExtensionDtype _from_sequence method testing.
    r   r*   r   r   r	   Úas_arrayÊ   r:   rA   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.
    )r6   Ú__new__r   r   r   r	   Úinvalid_scalarÒ   s   
	rC   Úreturnc                   C   s   t jjdu otddd�dkS )z7
    Fixture to check if Copy-on-Write is enabled.
    Tzmode.data_manager)ÚsilentÚblock)r   ÚmodeÚcopy_on_writer   r   r   r   r	   Úusing_copy_on_writeÞ   s   þrI   )r$   r   Úpandas._config.configr   Úpandasr   r   Úfixturer
   r   r   r   r   r!   r"   r#   r&   r(   r)   r+   r8   r9   r;   r<   r@   rA   rC   ÚboolrI   r   r   r   r	   Ú<module>   sf    



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


	

üù
	





