o
    i`                     @  s  d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 ee d dlmZ W d   n1 s8w   Y  d(ddZeddddeddddeddddddddddddd)d$d%Zeddddeddddeddddddddddddd)d&d'ZdS )*    )annotationsN)Any)deprecate_renamed_parameter)Series)raise_assertion_error)assert_series_equal_pyleftr   rightreturnboolc                 C  s6   d}t | trt |tstddt| jt|j dS )NTZinputszunexpected input types)
isinstancer   r   type__name__)r   r	   __tracebackhide__ r   T/home/app/Keep/.python/lib/python3.10/site-packages/polars/testing/asserts/series.py_assert_correct_input_type   s   r   Zcheck_dtypecheck_dtypesz0.20.31)versionZrtolrel_tolz1.32.3Zatolabs_tolTFgh㈵>g:0yE>r   check_namescheck_ordercheck_exactr   r   categorical_as_strr   r   r   r   floatr   Nonec          
      C  s0   d}	t | | t| j|j|||||||d	 dS )ap  
    Assert that the left and right Series are equal.

    Raises a detailed `AssertionError` if the Series differ.
    This function is intended for use in unit tests.

    .. versionchanged:: 0.20.31
        The `check_dtype` parameter was renamed `check_dtypes`.

    .. versionchanged:: 1.32.3
        The `rtol` and `atol` parameters were renamed to `rel_tol` and `abs_tol`,
        respectively.

    Parameters
    ----------
    left
        The first Series to compare.
    right
        The second Series to compare.
    check_dtypes
        Requires data types to match.
    check_names
        Requires names to match.
    check_order
        Requires elements to appear in the same order.
    check_exact
        Requires float values to match exactly. If set to `False`, values are considered
        equal when within tolerance of each other (see `rel_tol` and `abs_tol`).
        Only affects columns with a Float data type.
    rel_tol
        Relative tolerance for inexact checking, given as a fraction of the values in
        `right`.
    abs_tol
        Absolute tolerance for inexact checking.
    categorical_as_str
        Cast categorical columns to string before comparing. Enabling this helps
        compare columns that do not share the same string cache.

    See Also
    --------
    assert_frame_equal
    assert_series_not_equal

    Notes
    -----
    When using pytest, it may be worthwhile to shorten Python traceback printing
    by passing `--tb=short`. The default mode tends to be unhelpfully verbose.
    More information in the
    `pytest docs <https://docs.pytest.org/en/latest/how-to/output.html#modifying-python-traceback-printing>`_.

    Examples
    --------
    >>> from polars.testing import assert_series_equal
    >>> s1 = pl.Series([1, 2, 3])
    >>> s2 = pl.Series([1, 5, 3])
    >>> assert_series_equal(s1, s2)
    Traceback (most recent call last):
    ...
    AssertionError: Series are different (exact value mismatch)
    [left]: shape: (3,)
    Series: '' [i64]
    [
        1
        2
        3
    ]
    [right]: shape: (3,)
    Series: '' [i64]
    [
        1
        5
        3
    ]
    Tr   N)r   r   Z_s)
r   r	   r   r   r   r   r   r   r   r   r   r   r   assert_series_equal   s   Y

r   c                C  sN   d}	t | | zt| ||||||||d	 W n
 ty    Y dS w d}
t|
)aV  
    Assert that the left and right Series are **not** equal.

    This function is intended for use in unit tests.

    .. versionchanged:: 0.20.31
        The `check_dtype` parameter was renamed `check_dtypes`.

    .. versionchanged:: 1.32.3
        The `rtol` and `atol` parameters were renamed to `rel_tol` and `abs_tol`,
        respectively.

    Parameters
    ----------
    left
        The first Series to compare.
    right
        The second Series to compare.
    check_dtypes
        Requires data types to match.
    check_names
        Requires names to match.
    check_order
        Requires elements to appear in the same order.
    check_exact
        Requires float values to match exactly. If set to `False`, values are considered
        equal when within tolerance of each other (see `rel_tol` and `abs_tol`).
        Only affects columns with a Float data type.
    rel_tol
        Relative tolerance for inexact checking, given as a fraction of the values in
        `right`.
    abs_tol
        Absolute tolerance for inexact checking.
    categorical_as_str
        Cast categorical columns to string before comparing. Enabling this helps
        compare columns that do not share the same string cache.

    See Also
    --------
    assert_series_equal
    assert_frame_not_equal

    Examples
    --------
    >>> from polars.testing import assert_series_not_equal
    >>> s1 = pl.Series([1, 2, 3])
    >>> s2 = pl.Series([1, 2, 3])
    >>> assert_series_not_equal(s1, s2)
    Traceback (most recent call last):
    ...
    AssertionError: Series are equal (but are expected not to be)
    T)	r   r	   r   r   r   r   r   r   r   Nz-Series are equal (but are expected not to be))r   r   AssertionError)r   r	   r   r   r   r   r   r   r   r   msgr   r   r   assert_series_not_equal   s&   C

r!   )r   r   r	   r   r
   r   )r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r   )
__future__r   
contextlibtypingr   Zpolars._utils.deprecationr   Zpolars.seriesr   Zpolars.testing.asserts.utilsr   suppressImportErrorZpolars._plrr   r   r   r!   r   r   r   r   <module>   s@    
g