Use db.table() and db.view() in tests, closes #838

This commit is contained in:
Simon Willison 2026-08-12 13:40:55 -07:00
commit 38fe466700
43 changed files with 1321 additions and 1254 deletions

View file

@ -112,7 +112,7 @@ def test_mutator_commits_by_default(tmp_path, mutate, expected_rows):
db = seed_database(path)
assert not db.conn.in_transaction
mutate(db["items"])
mutate(db.table("items"))
assert current_rows(db) == expected_rows
assert not db.conn.in_transaction
@ -127,7 +127,7 @@ def test_mutator_commits_with_outer_atomic(tmp_path, mutate, expected_rows):
with db.atomic():
assert db.conn.in_transaction
mutate(db["items"])
mutate(db.table("items"))
assert current_rows(db) == expected_rows
assert db.conn.in_transaction
@ -143,7 +143,7 @@ def test_mutator_rolls_back_outer_atomic(tmp_path, mutate, expected_rows):
db = seed_database(path)
with pytest.raises(RollbackTest), db.atomic():
mutate(db["items"])
mutate(db.table("items"))
assert current_rows(db) == expected_rows
assert db.conn.in_transaction
raise RollbackTest