File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments