Handle empty input in rows_from_file

Closes #808
This commit is contained in:
Rami Abdelrazzaq 2026-08-12 16:05:09 -05:00 committed by GitHub
commit 25c632fbbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -20,6 +20,13 @@ def test_rows_from_file_detect_format(input, expected_format):
assert rows_list == [{"id": "1", "name": "Cleo"}]
@pytest.mark.parametrize("input", (b"", b" \n\t"))
def test_rows_from_file_empty_input(input):
rows, format = rows_from_file(BytesIO(input))
assert format == Format.CSV
assert list(rows) == []
@pytest.mark.parametrize(
"ignore_extras,extras_key,expected",
(