mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-22 17:04:31 +02:00
.update(...) with no update argument sets last_pk
This commit is contained in:
parent
4ab8d46b03
commit
bc9c4db34b
2 changed files with 19 additions and 0 deletions
|
|
@ -64,3 +64,20 @@ def test_update_alter(fresh_db):
|
|||
"int_col": -10,
|
||||
}
|
||||
] == list(table.rows)
|
||||
|
||||
|
||||
def test_update_with_no_values_sets_last_pk(fresh_db):
|
||||
table = fresh_db.table("dogs", pk="id")
|
||||
table.insert_all([{
|
||||
"id": 1,
|
||||
"name": "Cleo",
|
||||
}, {
|
||||
"id": 2,
|
||||
"name": "Pancakes"
|
||||
}])
|
||||
table.update(1)
|
||||
assert 1 == table.last_pk
|
||||
table.update(2)
|
||||
assert 2 == table.last_pk
|
||||
with pytest.raises(NotFoundError):
|
||||
table.update(3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue