table.count_where() method, closes #305

This commit is contained in:
Simon Willison 2021-08-01 22:05:03 -07:00
commit 4823aff4c3
4 changed files with 45 additions and 10 deletions

View file

@ -52,7 +52,14 @@ def test_views(fresh_db):
def test_count(existing_db):
assert 3 == existing_db["foo"].count
assert existing_db["foo"].count == 3
assert existing_db["foo"].count_where() == 3
assert existing_db["foo"].execute_count() == 3
def test_count_where(existing_db):
assert existing_db["foo"].count_where("text != ?", ["two"]) == 2
assert existing_db["foo"].count_where("text != :t", {"t": "two"}) == 2
def test_columns(existing_db):