mirror of
https://github.com/simonw/datasette.git
synced 2026-10-30 23:17:41 +01:00
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:
parent
cf113a5985
commit
e8c7b469fa
2 changed files with 27 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue