예제 #1
0
def test_build_using_parametrized_fixture(padded_columns):
    """Ensure rows are built correctly. Using one method for parametrized fixtures."""
    original_columns = padded_columns[0]
    out_column_length = padded_columns[1]
    num_cols = padded_columns[2]
    instance = EvenVMCView(num_columns=num_cols)  # using EvenVMCView but for test, only interested in _BaseVMC
    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

    # SUSAN - Rework this
    reversed_columns = []
    for num in range(instance.number_of_columns):
        col = [rows[row][num] for row 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
예제 #2
0
def test_build_using_getfixturevalue(padded_columns, request):
    """Ensure rows are built correctly. This is the same test as above using a different method of parametrizing fixtures"""
    padded_columns = request.getfixturevalue(padded_columns)
    original_columns = padded_columns[0]
    out_column_length = padded_columns[1]
    num_cols = padded_columns[2]
    instance = EvenVMCView(num_columns=num_cols)  # using EvenVMCView but for test, only interested in _BaseVMC
    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 num in range(instance.number_of_columns):
        col = [rows[row][num] for row 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