Skip to content

Commit

Permalink
CSV smoke test flag additional columns (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
CBonnell authored Sep 27, 2024
1 parent 99eb6c0 commit addb02d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_finding_metadata_csv_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ def _test_csv(filename, expected_fieldnames):
filename = path.join(cur_dir, '..', filename)

with open(filename, 'r', encoding='utf8') as csvfile:
reader = csv.DictReader(csvfile)
reader = csv.DictReader(csvfile, restkey='extra')

assert reader.fieldnames == expected_fieldnames

for row_idx, row in enumerate(reader):
lineno = row_idx + 1 + 1 # 1-based index and header row

extra = row.pop('extra', None)
assert extra is None, f'Row "{row}" (line {lineno}) has extra fields'

assert all(c is not None for c in row.values()), f'Row "{row}" (line {lineno}) has a None value'


Expand Down

0 comments on commit addb02d

Please sign in to comment.