Skip to content

Commit

Permalink
Merge pull request #138 from lisad/test_another_col_name_case
Browse files Browse the repository at this point in the history
Adds a test to make sure that files with returns in column names get fixed
  • Loading branch information
lisad authored Jun 4, 2024
2 parents 7635a72 + 54f2770 commit 9825764
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ def test_conflicting_renames():
Phase(columns=[FloatColumn(name="Division", rename='div'), IntColumn(name="Divisor", rename='div')])


def test_canonicalize_names():
@pytest.mark.parametrize('column_name', ['country of origin', 'country_of_origin', 'Country of\nOrigin'])
def test_canonicalize_names(column_name):
col1 = Column("Country of Origin")
phase = Phase(columns=[col1])
phase.load_data([{'country of origin': 'UK'}, {'country_of_origin': 'US'}])
phase.load_data([{column_name: 'UK'}, {column_name: 'US'}])
phase.rename_columns()
assert all(list(row.keys()) == ['Country of Origin'] for row in phase.row_data)
assert phase.headers == ['Country of Origin']
Expand Down

0 comments on commit 9825764

Please sign in to comment.