def test_insert_dataframe_column_if_not_exist__nonexistent_column():
    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    # method under test
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name, data)

    # make sure the data was inserted
    assert_equals(data, df[column_name].tolist())
def test_insert_dataframe_column_if_not_exist__nonexistent_column():
    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    # method under test
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name, data)

    # make sure the data was inserted
    assert data == df[column_name].tolist()
def test_insert_dataframe_column_if_not_exist__existing_column_not_matching():
    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    # add different data to the DataFrame prior to calling our method
    df.insert(0, column_name, ['mercy', 'main', 'btw'])

    # make sure the data is different
    assert_not_equals(data, df[column_name].tolist())

    # method under test should raise exception
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name, data)
def test_insert_dataframe_column_if_not_exist__existing_column_matching():

    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    # add the same data to the DataFrame prior to calling our method
    df.insert(0, column_name, data)

    # method under test
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name, data)

    # make sure the data has not changed
    assert_equals(data, df[column_name].tolist())
Exemplo n.º 5
0
def test_insert_dataframe_column_if_not_exist__existing_column_not_matching():
    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    # add different data to the DataFrame prior to calling our method
    df.insert(0, column_name, ['mercy', 'main', 'btw'])

    # make sure the data is different
    assert_not_equals(data, df[column_name].tolist())

    # method under test should raise exception
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name,
                                                       data)
def test_insert_dataframe_column_if_not_exist__existing_column_matching():

    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    # add the same data to the DataFrame prior to calling our method
    df.insert(0, column_name, data)

    # method under test
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name, data)

    # make sure the data has not changed
    assert data == df[column_name].tolist()
Exemplo n.º 7
0
def test_insert_dataframe_column_if_not_exist__nonexistent_column():
    if pandas_found:
        raise SkipTest(
            "pandas could not be found. please let the pandas into your library."
        )

    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    #method under test
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name,
                                                       data)

    #make sure the data was inserted
    assert_equals(data, df[column_name].tolist())
Exemplo n.º 8
0
def test_insert_dataframe_column_if_not_exist__existing_column_not_matching():
    if pandas_found:
        raise SkipTest(
            "pandas could not be found. please let the pandas into your library."
        )
    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    #add different data to the DataFrame prior to calling our method
    df.insert(0, column_name, ['mercy', 'main', 'btw'])

    #make sure the data is different
    assert_not_equals(data, df[column_name].tolist())

    #method under test should raise exception
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name,
                                                       data)
Exemplo n.º 9
0
def test_insert_dataframe_column_if_not_exist__existing_column_matching():
    if pandas_found:
        raise SkipTest(
            "pandas could not be found. please let the pandas into your library."
        )

    df, column_name, data = _insert_dataframe_column_if_not_exist__setup()

    #add the same data to the DataFrame prior to calling our method
    df.insert(0, column_name, data)

    #method under test
    CsvFileTable._insert_dataframe_column_if_not_exist(df, 0, column_name,
                                                       data)

    #make sure the data has not changed
    assert_equals(data, df[column_name].tolist())