mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-29 20:34:31 +02:00
Refactor .update() to use .get()
.pks introspection now returns [rowid] for rowid tables.
This commit is contained in:
parent
455071f3c5
commit
e4a11b1815
2 changed files with 20 additions and 30 deletions
|
|
@ -98,3 +98,11 @@ def test_guess_foreign_table(fresh_db, column, expected_table_guess):
|
|||
fresh_db.create_table("authors", {"name": str})
|
||||
fresh_db.create_table("genre", {"name": str})
|
||||
assert expected_table_guess == fresh_db["books"].guess_foreign_table(column)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"pk,expected", ((None, ["rowid"]), ("id", ["id"]), (["id", "id2"], ["id", "id2"]))
|
||||
)
|
||||
def test_pks(fresh_db, pk, expected):
|
||||
fresh_db["foo"].insert_all([{"id": 1, "id2": 2}], pk=pk)
|
||||
assert expected == fresh_db["foo"].pks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue