示例#1
0
def test_rebuild_errored_csv_row_too_many_columns():
    # Given
    # If a row contains too many columns then the excess will be stored in a list in the None key
    row_in_expected_format = {'COL_1': 'value_1', None: ['extra_1', 'extra_2']}

    # When
    rebuilt_row = BulkProcessor.rebuild_errored_csv_row(row_in_expected_format)

    # Then
    assert rebuilt_row == 'value_1,extra_1,extra_2'
示例#2
0
def test_rebuild_errored_csv_row_too_few_columns():
    # Given
    # If a row contains too few columns then the missing values on the end will be stored as None
    row_in_expected_format = {'COL_1': 'value_1', 'COL_MISSING_2': None}

    # When
    rebuilt_row = BulkProcessor.rebuild_errored_csv_row(row_in_expected_format)

    # Then
    assert rebuilt_row == 'value_1'
示例#3
0
def test_rebuild_errored_csv_row():
    # Given
    row_in_expected_format = {
        'COL_1': 'value_1',
        'COL_2': '',
        'COL_3': 'value_3'
    }

    # When
    rebuilt_row = BulkProcessor.rebuild_errored_csv_row(row_in_expected_format)

    # Then
    assert rebuilt_row == 'value_1,,value_3'