From f9554d36e48df2002a9da7ee4b16c129d63292ed Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 7 Jul 2026 15:03:27 +0000 Subject: [PATCH] Apply black formatting Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01E7af8SxFZqiCerJB6MqKnY --- sqlite_utils/db.py | 8 ++------ tests/test_create.py | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 3bf23b0..3033a36 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -4532,9 +4532,7 @@ class Table(Queryable): else: first_record_dict = cast(Dict[str, Any], first_record) if hash_id: - self.last_pk = hash_record( - first_record_dict, hash_id_columns - ) + self.last_pk = hash_record(first_record_dict, hash_id_columns) elif isinstance(pk, str): self.last_pk = first_record_dict[ resolve_casing(pk, first_record_dict) @@ -4587,9 +4585,7 @@ class Table(Queryable): self.last_rowid = result.lastrowid # A rowid-alias pk resolves directly to the rowid, so there # is no separate pk column to look up - rowid_pk = ( - isinstance(pk, str) and pk.lower() in ROWID_ALIASES - ) + rowid_pk = isinstance(pk, str) and pk.lower() in ROWID_ALIASES if (hash_id or (pk and not rowid_pk)) and self.last_rowid: # Set self.last_pk to the pk(s) for that rowid row = list(self.rows_where("rowid = ?", [self.last_rowid]))[0] diff --git a/tests/test_create.py b/tests/test_create.py index 5d75b61..bd05dc3 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -998,9 +998,9 @@ def test_insert_ignore_reports_existing_row(fresh_db): table = fresh_db["docs"].insert({"id": 1, "title": "One"}, ignore=True) assert table.last_rowid == 1 assert table.last_pk == 1 - assert list( - fresh_db["docs"].rows_where("rowid = ?", [table.last_rowid]) - ) == [{"id": 1, "title": "Exists"}] + assert list(fresh_db["docs"].rows_where("rowid = ?", [table.last_rowid])) == [ + {"id": 1, "title": "Exists"} + ] @pytest.mark.parametrize("rowid_alias", ("rowid", "_rowid_", "oid"))