# Path: raccoon/utils.py
# def assert_series_equal(left, right, data_function=None, data_args=None):
#     """
#     For unit testing equality of two Series.
# 
#     :param left: first Series
#     :param right: second Series
#     :param data_function: if provided will use this function to assert compare the df.data
#     :param data_args: arguments to pass to the data_function
#     :return: nothing
#     """
#     assert type(left) == type(right)
#     if data_function:
#         data_args = {} if not data_args else data_args
#         data_function(left.data, right.data, **data_args)
#     else:
#         assert left.data == right.data
#     assert left.index == right.index
#     assert left.data_name == right.data_name
#     assert left.index_name == right.index_name
#     assert left.sort == right.sort
#     if isinstance(left, rc.ViewSeries):
#         assert left.offset == right.offset
#     if isinstance(left, rc.Series):
#         assert left.dropin == right.dropin


import pytest
import raccoon as rc
from raccoon.utils import assert_series_equal
    with pytest.raises(AttributeError):
        # noinspection PyPropertyAccess
        ser.sort = True

    with pytest.raises(AttributeError):
        ser.sort_index()

    with pytest.raises(AttributeError):
        ser.set(1, 2)

    with pytest.raises(AttributeError):
        ser.delete(1)


def test_from_dataframe():
    df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 9])
    actual = rc.ViewSeries.from_dataframe(df, 'b')
    expected = rc.ViewSeries([4, 5, 6], data_name='b', index=['a', 'b', 9])
    assert_series_equal(actual, expected)

    df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 'e'], sort=True, index_name='date')
    actual = rc.ViewSeries.from_dataframe(df, 'a', -1)
    expected = rc.ViewSeries([1, 2, 3], data_name='a', index=['a', 'b', 'e'], sort=True, offset=-1, index_name='date')
    assert_series_equal(actual, expected)


def test_from_series():
    srs = rc.Series(data=[4, 5, 6], index=['a', 'b', 9], data_name='b')
    actual = rc.ViewSeries.from_series(srs)
    expected = rc.ViewSeries([4, 5, 6], data_name='b', index=['a', 'b', 9])

# Path: raccoon/utils.py
# def assert_series_equal(left, right, data_function=None, data_args=None):
#     """
#     For unit testing equality of two Series.
# 
#     :param left: first Series
#     :param right: second Series
#     :param data_function: if provided will use this function to assert compare the df.data
#     :param data_args: arguments to pass to the data_function
#     :return: nothing
#     """
#     assert type(left) == type(right)
#     if data_function:
#         data_args = {} if not data_args else data_args
#         data_function(left.data, right.data, **data_args)
#     else:
#         assert left.data == right.data
#     assert left.index == right.index
#     assert left.data_name == right.data_name
#     assert left.index_name == right.index_name
#     assert left.sort == right.sort
#     if isinstance(left, rc.ViewSeries):
#         assert left.offset == right.offset
#     if isinstance(left, rc.Series):
#         assert left.dropin == right.dropin


# Path: tests/test_series/test_view_series.py
import pytest
import raccoon as rc
from raccoon.utils import assert_series_equal

    with pytest.raises(AttributeError):
        # noinspection PyPropertyAccess
        ser.sort = True

    with pytest.raises(AttributeError):
        ser.sort_index()

    with pytest.raises(AttributeError):
        ser.set(1, 2)

    with pytest.raises(AttributeError):
        ser.delete(1)


def test_from_dataframe():
    df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 9])
    actual = rc.ViewSeries.from_dataframe(df, 'b')
    expected = rc.ViewSeries([4, 5, 6], data_name='b', index=['a', 'b', 9])
    assert_series_equal(actual, expected)

    df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 'e'], sort=True, index_name='date')
    actual = rc.ViewSeries.from_dataframe(df, 'a', -1)
    expected = rc.ViewSeries([1, 2, 3], data_name='a', index=['a', 'b', 'e'], sort=True, offset=-1, index_name='date')
    assert_series_equal(actual, expected)


def test_from_series():
    srs = rc.Series(data=[4, 5, 6], index=['a', 'b', 9], data_name='b')
    actual = rc.ViewSeries.from_series(srs)
    expected = rc.ViewSeries([4, 5, 6], data_name='b', index=['a', 'b', 9])

    assert_series_equal(actual, expected)