# 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
    from blist import blist
    df2 = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, columns=['a', 'b'], index=[1, 2, 3], dropin=blist)
    with pytest.raises(AssertionError):
        assert_frame_equal(df1, df2)


def test_print():
    df = rc.DataFrame({'a': [1, 2, 3], 'b': [1.0, 2.55, 3.1], 'c': ['first', 'second', None]}, columns=['b', 'c', 'a'],
                      index=['row1', 'row2', 'row3'], dropin=blist)

    # __repr__ produces a simple representation
    expected = "object id: %s\ncolumns:\nblist(['b', 'c', 'a'])\ndata:\nblist([blist([1.0, 2.55, 3.1]), blist([" \
               "'first', 'second', None]), blist([1, 2, 3])])\nindex:\nblist(['row1', 'row2', 'row3'])\n" % id(df)
    actual = df.__repr__()
    assert actual == expected

    # __string__ produces the standard table
    expected = 'index       b  c         a\n-------  ----  ------  ---\nrow1     1     first     1\n' \
               'row2     2.55  second    2\nrow3     3.1             3'
    actual = df.__str__()
    assert actual == expected

    # print() method will pass along any argument for the tabulate.tabulate function
    df.print()


def test_json():
    df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6], 'c': [7, 8, 9]}, sort=False, dropin=blist)

    string = df.to_json()
    actual = rc.DataFrame.from_json(string, blist)

# 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_dropin/test_dataframe_blist.py
import pytest
import raccoon as rc
from raccoon.utils import assert_frame_equal
    from blist import blist

    df2 = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, columns=['a', 'b'], index=[1, 2, 3], dropin=blist)
    with pytest.raises(AssertionError):
        assert_frame_equal(df1, df2)


def test_print():
    df = rc.DataFrame({'a': [1, 2, 3], 'b': [1.0, 2.55, 3.1], 'c': ['first', 'second', None]}, columns=['b', 'c', 'a'],
                      index=['row1', 'row2', 'row3'], dropin=blist)

    # __repr__ produces a simple representation
    expected = "object id: %s\ncolumns:\nblist(['b', 'c', 'a'])\ndata:\nblist([blist([1.0, 2.55, 3.1]), blist([" \
               "'first', 'second', None]), blist([1, 2, 3])])\nindex:\nblist(['row1', 'row2', 'row3'])\n" % id(df)
    actual = df.__repr__()
    assert actual == expected

    # __string__ produces the standard table
    expected = 'index       b  c         a\n-------  ----  ------  ---\nrow1     1     first     1\n' \
               'row2     2.55  second    2\nrow3     3.1             3'
    actual = df.__str__()
    assert actual == expected

    # print() method will pass along any argument for the tabulate.tabulate function
    df.print()


def test_json():
    df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6], 'c': [7, 8, 9]}, sort=False, dropin=blist)

    string = df.to_json()
    actual = rc.DataFrame.from_json(string, blist)

    assert_frame_equal(df, actual)