コード例 #1
0
def test_find_terminator_exception(body, sep, quoting, quotechar, lineterminator):
    with pytest.raises(LineTerminatorNotFound):
        assert Pandas._find_terminator(body=body,
                                       sep=sep,
                                       quoting=quoting,
                                       quotechar=quotechar,
                                       lineterminator=lineterminator)
コード例 #2
0
def test_normalize_columns_names_athena():
    dataframe = pd.DataFrame({
        "CamelCase": [1, 2, 3],
        "With Spaces": [4, 5, 6],
        "With-Dash": [7, 8, 9],
        "Ãccént": [10, 11, 12],
        "with.dot": [10, 11, 12],
        "Camel_Case2": [13, 14, 15],
        "Camel___Case3": [16, 17, 18]
    })
    Pandas.normalize_columns_names_athena(dataframe=dataframe, inplace=True)
    assert dataframe.columns[0] == "camel_case"
    assert dataframe.columns[1] == "with_spaces"
    assert dataframe.columns[2] == "with_dash"
    assert dataframe.columns[3] == "accent"
    assert dataframe.columns[4] == "with_dot"
    assert dataframe.columns[5] == "camel_case2"
    assert dataframe.columns[6] == "camel_case3"
コード例 #3
0
def test_drop_duplicated_columns():
    dataframe = pd.DataFrame({
        "a": [1, 2, 3],
        "b": [4, 5, 6],
        "c": [7, 8, 9],
    })
    dataframe.columns = ["a", "a", "c"]
    dataframe = Pandas.drop_duplicated_columns(dataframe=dataframe)
    assert dataframe.columns[0] == "a"
    assert dataframe.columns[1] == "c"
コード例 #4
0
def test_extract_terminator_profile(body, sep, quotechar, lineterminator, last_index, last_terminator_suspect_index,
                                    first_non_special_byte_index, sep_counter, quote_counter):
    profile = Pandas._extract_terminator_profile(body=body,
                                                 sep=sep,
                                                 quotechar=quotechar,
                                                 lineterminator=lineterminator,
                                                 last_index=last_index)
    assert profile["last_terminator_suspect_index"] == last_terminator_suspect_index
    assert profile["first_non_special_byte_index"] == first_non_special_byte_index
    assert profile["sep_counter"] == sep_counter
    assert profile["quote_counter"] == quote_counter
コード例 #5
0
def test_find_terminator(body, sep, quoting, quotechar, lineterminator, ret):
    assert Pandas._find_terminator(body=body,
                                   sep=sep,
                                   quoting=quoting,
                                   quotechar=quotechar,
                                   lineterminator=lineterminator) == ret