Test for bool(results), closes #1832

pull/1823/head
Simon Willison 2022-10-04 21:32:11 -07:00
rodzic e0e8522622
commit b545b6a04e
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -30,6 +30,14 @@ async def test_results_first(db):
assert isinstance(row, sqlite3.Row)
@pytest.mark.asyncio
@pytest.mark.parametrize("expected", (True, False))
async def test_results_bool(db, expected):
where = "" if expected else "where pk = 0"
results = await db.execute("select * from facetable {}".format(where))
assert bool(results) is expected
@pytest.mark.parametrize(
"query,expected",
[