Beispiel #1
0
def test_pad_lots_of_columns(columns_many):
    """Ensure edge case where there are more columns than would be normally expected are handled correctly"""
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(columns_many(1000, 5000))
    assert max_column == 1000
    for i in columns:
        assert (len(i)) == 1000
Beispiel #2
0
def test_pad_last_column_empty(last_column_empty_2):
    """Ensure edge case where last column in empty is padded correctly"""
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(last_column_empty_2)
    assert max_column == 2
    for i in columns:
        assert (len(i)) == 2
Beispiel #3
0
def test_pad_all_columns_empty(all_columns_empty):
    """Ensure edge case where all columns are empty can be handled"""
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(all_columns_empty)
    assert max_column == 0
    for i in columns:
        assert (len(i)) == 0
Beispiel #4
0
def test_pad_columns_already_same(columns_same_length_4):
    """Ensure columns already the same length are not padded any further"""
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(columns_same_length_4)
    assert max_column == 4
    for i in columns:
        assert (len(i)) == 4
Beispiel #5
0
def test_build_using_parametrized_fixture(padded_columns):
    original_columns = padded_columns[0]
    out_column_length = padded_columns[1]
    num_cols = padded_columns[2]
    instance = _BaseVMC(num_cols=num_cols)
    rows = instance.build_new_rows(original_columns, out_column_length)

    assert (
        len(rows) == out_column_length
    )  # number of rows corresponds to max length of the original columns
    for row in rows:
        assert (
            len(row) == instance.number_of_columns
        )  # each row contains the number of elements specified by the setting NUMBER_OF_COLUMNS

    reversed_columns = []
    for c in range(instance.number_of_columns):
        col = [rows[r][c] for r in range(out_column_length)]
        reversed_columns.append(col)
    assert (
        reversed_columns == original_columns
    )  # when "unbuilt" the result should be identical to the original columns
Beispiel #6
0
def test_pad_lots_of_columns(entries_0, columns_many):
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(columns_many(1000, 5000))
    assert max_column == 1000
    for i in columns:
        assert (len(i)) == 1000
Beispiel #7
0
def test_pad_last_column_empty(entries_0, last_column_empty_2):
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(last_column_empty_2)
    assert max_column == 2
    for i in columns:
        assert (len(i)) == 2
Beispiel #8
0
def test_pad_all_columns_empty(entries_0, all_columns_empty):
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(all_columns_empty)
    assert max_column == 0
    for i in columns:
        assert (len(i)) == 0
Beispiel #9
0
def test_pad_first_column_empty(entries_0, first_column_empty_5):
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(first_column_empty_5)
    assert max_column == 5
    for i in columns:
        assert (len(i)) == 5
Beispiel #10
0
def test_pad_columns_already_same(entries_0, columns_same_length_4):
    instance = _BaseVMC()
    columns, max_column = instance.pad_columns(columns_same_length_4)
    assert max_column == 4
    for i in columns:
        assert (len(i)) == 4