# Path: raccoon/utils.py
# def assert_frame_equal(left, right, data_function=None, data_args=None):
#     """
#     For unit testing equality of two DataFrames.
# 
#     :param left: first DataFrame
#     :param right: second DataFrame
#     :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
#     """
#     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.columns == right.columns
#     assert left.index_name == right.index_name
#     assert left.sort == right.sort
#     assert left.dropin == right.dropin


import pytest
import raccoon as rc
from raccoon.utils import assert_frame_equal
    # set entire column to one value
    df.set(columns='c', values=88)
    assert df.data == [[99, 2, 99], [4, 5, 6], [88, 88, 88]]

    # can be anything that isn't a list
    df.set(columns='e', values={1, 2, 3})
    assert df.data == [[99, 2, 99], [4, 5, 6], [88, 88, 88], [{1, 2, 3}, {1, 2, 3}, {1, 2, 3}]]


def test_set_location():
    df = rc.DataFrame({'a': [1, 2, 3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8])

    df.set_location(2, {'a': -3})
    assert_frame_equal(df, rc.DataFrame({'a': [1, 2, -3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8]))

    df.set_location(3, {'a': -10, 'b': -88})
    assert_frame_equal(df, rc.DataFrame({'a': [1, 2, -3, -10], 'b': [5, 6, 7, -88]}, index=[2, 4, 6, 8]))

    df.set_location(0, {'b': -55}, missing_to_none=True)
    assert_frame_equal(df, rc.DataFrame({'a': [None, 2, -3, -10], 'b': [-55, 6, 7, -88]}, index=[2, 4, 6, 8]))

    # location out of bounds
    with pytest.raises(IndexError):
        df.set_location(99, {'a': 10})


def test_set_locations():
    df = rc.DataFrame({'a': [1, 2, 3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8])

    df.set_locations([0, 2], 'a', [-1, -3])

# Path: raccoon/utils.py
# def assert_frame_equal(left, right, data_function=None, data_args=None):
#     """
#     For unit testing equality of two DataFrames.
# 
#     :param left: first DataFrame
#     :param right: second DataFrame
#     :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
#     """
#     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.columns == right.columns
#     assert left.index_name == right.index_name
#     assert left.sort == right.sort
#     assert left.dropin == right.dropin


# Path: tests/test_dataframe/test_set.py
import pytest
import raccoon as rc
from raccoon.utils import assert_frame_equal

    # set entire column to one value
    df.set(columns='c', values=88)
    assert df.data == [[99, 2, 99], [4, 5, 6], [88, 88, 88]]

    # can be anything that isn't a list
    df.set(columns='e', values={1, 2, 3})
    assert df.data == [[99, 2, 99], [4, 5, 6], [88, 88, 88], [{1, 2, 3}, {1, 2, 3}, {1, 2, 3}]]


def test_set_location():
    df = rc.DataFrame({'a': [1, 2, 3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8])

    df.set_location(2, {'a': -3})
    assert_frame_equal(df, rc.DataFrame({'a': [1, 2, -3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8]))

    df.set_location(3, {'a': -10, 'b': -88})
    assert_frame_equal(df, rc.DataFrame({'a': [1, 2, -3, -10], 'b': [5, 6, 7, -88]}, index=[2, 4, 6, 8]))

    df.set_location(0, {'b': -55}, missing_to_none=True)
    assert_frame_equal(df, rc.DataFrame({'a': [None, 2, -3, -10], 'b': [-55, 6, 7, -88]}, index=[2, 4, 6, 8]))

    # location out of bounds
    with pytest.raises(IndexError):
        df.set_location(99, {'a': 10})


def test_set_locations():
    df = rc.DataFrame({'a': [1, 2, 3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8])

    df.set_locations([0, 2], 'a', [-1, -3])

    assert_frame_equal(df, rc.DataFrame({'a': [-1, 2, -3, 4], 'b': [5, 6, 7, 8]}, index=[2, 4, 6, 8]))