Ejemplo n.º 1
0
def test_compare_BAU(x, y, names, dups, same, expected):
    dict_test1 = compare(x, y, names=["df1", "df2"], dups=True, same=True)
    for i in expected.keys():
        if i == "Same":
            assert dict_test1[i] == expected[i]
        else:
            for j in expected[i]:
                list_test1 = list(dict_test1[i][j])
                list_exp = list(expected[i][j])
                assert list_test1 == list_exp
Ejemplo n.º 2
0
def test_compare_console(x, y, names, dups, same, comment, capsys):
    dict_test1 = compare(x,
                         y,
                         names=["df1", "df2"],
                         dups=True,
                         same=True,
                         comment=comment)
    captured = capsys.readouterr()
    assert (captured.out == "\nThere are " +
            str(dict_test1["same_values"].shape[0]) +
            " same values\nThere are " +
            str(dict_test1[names[0] + "_not_" + names[1]].shape[0]) +
            " outliers in " + str(names[0]) + "\nThere are " +
            str(dict_test1[names[1] + "_not_" + names[0]].shape[0]) +
            " outliers in " + str(names[1]) + "\nThere are " +
            str(dict_test1[names[0] + "_dups"].shape[0]) + " duplicates in " +
            str(names[0]) + "\nThere are " +
            str(dict_test1[names[1] + "_dups"].shape[0]) + " duplicates in " +
            str(names[1]) + "\nDataFrames are not the same\n")
Ejemplo n.º 3
0
def test_compare_ValueError_6(y):

    with pytest.raises(ValueError):

        compare(df1, y, names=["df1", "y"])
Ejemplo n.º 4
0
def test_compare_ValueError_5(comment):

    with pytest.raises(ValueError):

        compare(df1, df2, names=["df1", "df2"], comment=comment)
Ejemplo n.º 5
0
def test_compare_ValueError_4(same):

    with pytest.raises(ValueError):

        compare(df1, df2, names=["df1", "df2"], same=same)
Ejemplo n.º 6
0
def test_compare_ValueError_3(dups):

    with pytest.raises(ValueError):

        compare(df1, df2, names=["df1", "df2"], dups=dups)
Ejemplo n.º 7
0
def test_compare_ValueError_2(x):

    with pytest.raises(ValueError):

        compare(x, df2, names=["x", "df2"])
Ejemplo n.º 8
0
def test_compare_ValueError_1(names):

    with pytest.raises(ValueError):

        compare(df1, df2, names=names)