Exemple #1
0
def test_is_same_as():
    df = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 2, 3]})
    df_equal = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 2, 3]})
    df_not_equal = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 2, 1]})

    result = ck.is_same_as(df, df_equal)
    tm.assert_frame_equal(df, result)

    result = dc.is_same_as(df_equal)(_noop)(df)
    tm.assert_frame_equal(df, result)

    with pytest.raises(AssertionError):
        ck.is_same_as(df, df_not_equal)
        dc.is_same_as(df_not_equal)(_noop)(df)
Exemple #2
0
def test_is_same_as_with_kwargs():
    df = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 2, 3]})
    df_equal = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 2, 3]})
    df_equal_float = pd.DataFrame({'A': [1.0, 2, 3], 'B': [1, 2, 3.0]})

    result = ck.is_same_as(df, df_equal, check_dtype=True)
    tm.assert_frame_equal(df, result)

    result = dc.is_same_as(df_equal, check_dtype=True)(_noop)(df)
    tm.assert_frame_equal(df, result)

    with pytest.raises(AssertionError):
        ck.is_same_as(df, df_equal_float, check_dtype=True)
        dc.is_same_as(df_equal_float, check_dtype=True)(_noop)(df)

    result = ck.is_same_as(df, df_equal_float, check_dtype=False)
    tm.assert_frame_equal(df, result)

    result = dc.is_same_as(df_equal_float, check_dtype=False)(_noop)(df)
    tm.assert_frame_equal(df, result)
Exemple #3
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     ck.is_same_as(result, df_to_compare, **assert_kwargs)
     return result
Exemple #4
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     ck.is_same_as(result, df_to_compare, **assert_kwargs)
     return result