diff --git a/python_repositories/adapters/postgres_adapter.py b/python_repositories/adapters/postgres_adapter.py index 1ba00f8..1098a91 100644 --- a/python_repositories/adapters/postgres_adapter.py +++ b/python_repositories/adapters/postgres_adapter.py @@ -94,9 +94,7 @@ class PostgresAdapter(ConnectionAwareAdapter, TableRepositoryInterface): cursor.execute("SELECT 1") try: cursor.execute( - sql.SQL("SELECT 1 FROM {} LIMIT 0").format( - self._table_identifier() - ) + sql.SQL("SELECT 1 FROM {} LIMIT 0").format(self._table_identifier()) ) except UndefinedTable as exc: raise ConnectionError( @@ -189,9 +187,7 @@ class PostgresAdapter(ConnectionAwareAdapter, TableRepositoryInterface): on_conflict = sql.SQL("DO UPDATE SET {}").format(update_assignments) else: on_conflict = sql.SQL("DO NOTHING") - query = sql.SQL( - "INSERT INTO {} ({}) VALUES ({}) ON CONFLICT ({}) {}" - ).format( + query = sql.SQL("INSERT INTO {} ({}) VALUES ({}) ON CONFLICT ({}) {}").format( self._table_identifier(), column_list, placeholders, diff --git a/tests/unit/adapters_test.py b/tests/unit/adapters_test.py index fcdce76..164c8fe 100644 --- a/tests/unit/adapters_test.py +++ b/tests/unit/adapters_test.py @@ -149,7 +149,9 @@ def test_adapters_dir_exposes_lazy_exports() -> None: """dir(adapters) includes lazy adapter names for tab completion.""" import python_repositories.adapters as adapters - assert {"RedisAdapter", "MinioAdapter", "PostgresAdapter"}.issubset(set(dir(adapters))) + assert {"RedisAdapter", "MinioAdapter", "PostgresAdapter"}.issubset( + set(dir(adapters)) + ) def test_adapters_getattr_raises_for_unknown() -> None: diff --git a/tests/unit/postgres_adapter_test.py b/tests/unit/postgres_adapter_test.py index f7cf29a..d28ccd5 100644 --- a/tests/unit/postgres_adapter_test.py +++ b/tests/unit/postgres_adapter_test.py @@ -125,7 +125,9 @@ def test_connect_with_injected_client_skips_validation_when_client_cleared() -> def test_connect_reconnects_when_existing_client_unhealthy( monkeypatch: pytest.MonkeyPatch, ) -> None: - stale_client = _mock_client(probe_raises=psycopg.OperationalError("connection lost")) + stale_client = _mock_client( + probe_raises=psycopg.OperationalError("connection lost") + ) new_client = _mock_client() adapter = PostgresAdapter(config=TEST_POSTGRES_CONFIG) adapter._client = stale_client