mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
test_upsert_compound_primary_key
This commit is contained in:
parent
9f47e8b9a4
commit
468d51314a
1 changed files with 10 additions and 0 deletions
|
|
@ -14,3 +14,13 @@ def test_upsert_all(fresh_db):
|
|||
{"id": 2, "name": "Nixie", "age": 5},
|
||||
] == list(table.rows)
|
||||
assert 2 == table.last_pk
|
||||
|
||||
|
||||
def test_upsert_compound_primary_key(fresh_db):
|
||||
table = fresh_db["table"]
|
||||
table.upsert_all([{"species": "dog", "id": 1, "name": "Cleo", "age": 4}, {"species": "cat", "id": 1, "name": "Catbag"}], pk=("species", "id"))
|
||||
table.upsert_all([{"species": "dog", "id": 1, "age": 5}], pk=("species", "id"))
|
||||
assert [
|
||||
{"species": "dog", "id": 1, "name": "Cleo", "age": 5},
|
||||
{"species": "cat", "id": 1, "name": "Catbag", "age": None},
|
||||
] == list(table.rows)
|
||||
Loading…
Add table
Add a link
Reference in a new issue