Test for bool(results), closes #1832

This commit is contained in:
Simon Willison 2022-10-04 21:32:11 -07:00
commit bbf33a7635

View file

@ -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",
[