# 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
    assert srs.get_slice(1, 8, as_list=True) == ([2, 4, 6, 8], [5, 6, 7, 8])
    assert srs.get_slice(2, 18, as_list=True) == ([2, 4, 6, 8], [5, 6, 7, 8])
    assert srs.get_slice(1, 18, as_list=True) == ([2, 4, 6, 8], [5, 6, 7, 8])

    assert srs.get_slice(4, 4, as_list=True) == ([4], [6])
    assert srs.get_slice(3, 4, as_list=True) == ([4], [6])
    assert srs.get_slice(4, 5, as_list=True) == ([4], [6])
    assert srs.get_slice(3, 5, as_list=True) == ([4], [6])

    assert srs.get_slice(3, 6, as_list=True) == ([4, 6], [6, 7])
    assert srs.get_slice(4, 7, as_list=True) == ([4, 6], [6, 7])
    assert srs.get_slice(3, 7, as_list=True) == ([4, 6], [6, 7])

    assert srs.get_slice(None, 7, as_list=True) == ([2, 4, 6], [5, 6, 7])
    assert srs.get_slice(3, None, as_list=True) == ([4, 6, 8], [6, 7, 8])

    assert srs.get_slice(3, 3, as_list=True) == ([], [])
    assert srs.get_slice(0, 0, as_list=True) == ([], [])
    assert srs.get_slice(5, 5, as_list=True) == ([], [])


def test_get_square_brackets():
    srs = rc.Series([10, 11, 12], index=['a', 'b', 'c'], sort=False)

    assert srs['b'] == 11
    assert_series_equal(srs[['a', 'c']], rc.Series([10, 12], ['a', 'c']))

    # get a series back
    assert_series_equal(srs[['b']], rc.Series([11], ['b'], sort=False))


# 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_get.py
import pytest
import raccoon as rc
from raccoon.utils import assert_series_equal

    assert srs.get_slice(1, 8, as_list=True) == ([2, 4, 6, 8], [5, 6, 7, 8])
    assert srs.get_slice(2, 18, as_list=True) == ([2, 4, 6, 8], [5, 6, 7, 8])
    assert srs.get_slice(1, 18, as_list=True) == ([2, 4, 6, 8], [5, 6, 7, 8])

    assert srs.get_slice(4, 4, as_list=True) == ([4], [6])
    assert srs.get_slice(3, 4, as_list=True) == ([4], [6])
    assert srs.get_slice(4, 5, as_list=True) == ([4], [6])
    assert srs.get_slice(3, 5, as_list=True) == ([4], [6])

    assert srs.get_slice(3, 6, as_list=True) == ([4, 6], [6, 7])
    assert srs.get_slice(4, 7, as_list=True) == ([4, 6], [6, 7])
    assert srs.get_slice(3, 7, as_list=True) == ([4, 6], [6, 7])

    assert srs.get_slice(None, 7, as_list=True) == ([2, 4, 6], [5, 6, 7])
    assert srs.get_slice(3, None, as_list=True) == ([4, 6, 8], [6, 7, 8])

    assert srs.get_slice(3, 3, as_list=True) == ([], [])
    assert srs.get_slice(0, 0, as_list=True) == ([], [])
    assert srs.get_slice(5, 5, as_list=True) == ([], [])


def test_get_square_brackets():
    srs = rc.Series([10, 11, 12], index=['a', 'b', 'c'], sort=False)

    assert srs['b'] == 11
    assert_series_equal(srs[['a', 'c']], rc.Series([10, 12], ['a', 'c']))

    # get a series back
    assert_series_equal(srs[['b']], rc.Series([11], ['b'], sort=False))


    assert_series_equal(srs[['c', 'a']], rc.Series([12, 10], ['c', 'a'], sort=False))