Fix _shape=arrays and _shape=arrayfirst for rows containing infinity

remove_infinites() returns a plain list for sqlite3.Row rows that contain
infinity, which caused a 500 error with these two shapes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GaqG8H8ajwxizKXdbGrtve
This commit is contained in:
Claude 2026-10-05 21:44:50 +00:00
commit e8c7b469fa
No known key found for this signature in database
2 changed files with 27 additions and 14 deletions

View file

@ -1302,6 +1302,24 @@ async def test_infinity_returned_as_invalid_json_if_requested(ds_client):
]
@pytest.mark.asyncio
@pytest.mark.parametrize(
"shape,expected",
(
("arrays", {"ok": True, "rows": [[None], [None], [1.5]], "truncated": False}),
("arrayfirst", [None, None, 1.5]),
),
)
async def test_infinity_with_array_shapes(ds_client, shape, expected):
# Rows containing infinity are lists rather than sqlite3.Row objects
response = await ds_client.get(
"/fixtures/-/query.json?sql=select+value+from+infinity+order+by+rowid"
"&_shape=" + shape
)
assert response.status_code == 200
assert response.json() == expected
@pytest.mark.asyncio
async def test_custom_query_with_unicode_characters(ds_client):
# /fixtures/𝐜𝐢𝐭𝐢𝐞𝐬.json