def test_aaa_normalize_column_name_convert_upper_case_to_lower():
    print('aaa')
    result = normalize_column_name('STATE_PROVINCE')
    assert result == 'state_province'
def test_bbb_normalize_column_name_max_len():
    print('bbb')
    result = normalize_column_name('state_province', 10)
    assert result == 'state_prov'
def test_normalize_column_name_already_normalized():
    result = normalize_column_name('state_province')
    assert result == 'state_province'
def test_ccc_normalize_column_name_convert_upper_case_to_lower_leading_blanks(
):
    print('ccc')
    result = normalize_column_name('  STATE_PROVINCE  ')
    assert result == 'state_province'
def test_normalize_column_name_max_len_do_not_leave_trailing_underscore():
    result = normalize_column_name('state_', 6)
    assert result == 'state'
def test_normalize_column_name_len_1():
    result = normalize_column_name('x')
    assert result == 'x'
def test_normalize_column_name_max_len_threshold_exactly():
    result = normalize_column_name('state_province', 14)
    assert result == 'state_province'
def test_normalize_column_name_max_len_threshold_plus_1():
    result = normalize_column_name('state_province', 13)
    assert result == 'state_provinc'
def test_normalize_column_name_max_len():
    result = normalize_column_name('state_province', 10)
    assert result == 'state_prov'
def test_normalize_column_name_strip_leading_and_trailing_whitespace():
    result = normalize_column_name('  state_province  ')
    assert result == 'state_province'
def test_normalize_column_name_replace_dash_with_underscore():
    result = normalize_column_name('state-province')
    assert result == 'state_province'
def test_normalize_column_name_replace_multiple_spaces():
    result = normalize_column_name('state   province')
    assert result == 'state_province'
Example #13
0
def test_normalize_column_name(name, max_len, expected):
    result = normalize_column_name(name, max_len)

    assert result == expected