Exemple #1
0
def test_process_cells_yield_when_no_header():
    cell = process_cell(None, 'test value')
    assert next(cell) == {
        names.HEADER_MATCH: 'NO HEADER',
        names.UNMATCHED: 'test value'
    }

    with pytest.raises(StopIteration):
        next(cell)
Exemple #2
0
def test_process_cells_yield_when_no_header_match_found():
    cell = process_cell('Non-Existent Header', 'test value')
    assert next(cell) == {
        names.HEADER_MATCH: None,
        names.UNMATCHED: 'test value'
    }

    with pytest.raises(StopIteration):
        next(cell)
Exemple #3
0
def test_process_cells_yield_when_header_found_but_no_value_found():
    cell = process_cell('IUPMs', 'test value')

    assert next(cell) == {
        names.HEADER_MATCH: 'IUPM',
        names.VALUE_MATCH: None,
        names.UNMATCHED: 'test value'
    }

    with pytest.raises(StopIteration):
        next(cell)
Exemple #4
0
def test_day_header_matching():
    header = 'Day 21 in Culture'
    value = 'Day 21 in Culture'
    expected = [{
        'Header Match': 'Day',
        'Day': '21',
        'Value Match': 'FULL'
    }]

    actual = list(process_cell(header, value))

    assert actual == expected
Exemple #5
0
def test_header_matching():
    header = '2.5'
    value = '0/1'
    expected = [{
        'Header Match': 'Dilution',
        'Positive': '0',
        'Total': '1',
        'Value Match': 'FULL'
    }]

    actual = list(process_cell(header, value))

    assert actual == expected
Exemple #6
0
def process_column(col, headers, pheresis, filename):
    for row, cell in enumerate(col):
        if not cell.value or not cell.value.strip():
            continue

        row_header = headers[row]
        initial_values = get_initial_values(cell, pheresis, filename,
                                            row_header)

        clean_header = row_header[names.CLEAN]
        cell_value = cell.value.strip()

        for result in process_cell(clean_header, cell_value):
            yield {**initial_values, **result}