mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-26 10:54:32 +02:00
Tests for .get() NotFoundError
This commit is contained in:
parent
71a3bc26c9
commit
1445a8ecb5
2 changed files with 24 additions and 1 deletions
|
|
@ -410,6 +410,13 @@ class Table:
|
|||
elif len(pks) > 1:
|
||||
pk_names = pks
|
||||
last_pk = pk_values
|
||||
if len(pk_names) != len(pk_values):
|
||||
raise NotFoundError(
|
||||
"Need {} primary key value{}".format(
|
||||
len(pk_names), "" if len(pk_names) == 1 else "s"
|
||||
)
|
||||
)
|
||||
|
||||
wheres = ["[{}] = ?".format(pk_name) for pk_name in pk_names]
|
||||
rows = self.rows_where(" and ".join(wheres), pk_values)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue