Skip to content

Commit 8022be6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bf76240 commit 8022be6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/test_sql_core.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,23 +257,32 @@ def test_sqlcore_set_entry_fallback(monkeypatch):
257257
from sqlalchemy.orm import Session
258258
from sqlalchemy.sql.dml import Insert, Update
259259
from sqlalchemy.sql.selectable import Select
260+
260261
core = _SQLCore(hash_func=None, sql_engine=SQL_CONN_STR)
261262
core.set_func(lambda x: x)
262263
# Monkeypatch Session.execute to simulate fallback path
263264
orig_execute = Session.execute
265+
264266
def fake_execute(self, stmt, *args, **kwargs):
265267
if isinstance(stmt, (Insert, Update)):
268+
266269
class FakeInsert:
267270
pass
271+
268272
return FakeInsert()
269273
elif isinstance(stmt, Select):
274+
270275
class FakeSelectResult:
271276
def scalar_one_or_none(self):
272277
return None # Simulate no row found
278+
273279
return FakeSelectResult()
280+
274281
class Dummy:
275282
pass
283+
276284
return Dummy()
285+
277286
monkeypatch.setattr(Session, "execute", fake_execute)
278287
# Should not raise
279288
core.set_entry("fallback", 123)

0 commit comments

Comments
 (0)