MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_autobegin_flush

Method test_autobegin_flush

test/orm/test_session.py:209–227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

207 is_(s._transaction, None)
208
209 def test_autobegin_flush(self):
210 # test the new autobegin behavior introduced in #5074
211 User, users = self.classes.User, self.tables.users
212
213 self.mapper_registry.map_imperatively(User, users)
214
215 s = Session(testing.db)
216
217 is_(s._transaction, None)
218
219 # empty flush, nothing happens
220 s.flush()
221 is_(s._transaction, None)
222
223 s.add(User(id=1, name="name"))
224 s.flush()
225 is_not(s._transaction, None)
226 s.commit()
227 is_(s._transaction, None)
228
229 def test_autobegin_within_flush(self):
230 """test :ticket:`6233`"""

Callers

nothing calls this directly

Calls 8

flushMethod · 0.95
addMethod · 0.95
commitMethod · 0.95
SessionClass · 0.90
is_Function · 0.90
is_notFunction · 0.90
map_imperativelyMethod · 0.80
UserClass · 0.70

Tested by

no test coverage detected