MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_autobegin_flush

Method test_autobegin_flush

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

Source from the content-addressed store, hash-verified

189 is_(s._transaction, None)
190
191 def test_autobegin_flush(self):
192 # test the new autobegin behavior introduced in #5074
193 User, users = self.classes.User, self.tables.users
194
195 self.mapper_registry.map_imperatively(User, users)
196
197 s = Session(testing.db)
198
199 is_(s._transaction, None)
200
201 # empty flush, nothing happens
202 s.flush()
203 is_(s._transaction, None)
204
205 s.add(User(id=1, name="name"))
206 s.flush()
207 is_not(s._transaction, None)
208 s.commit()
209 is_(s._transaction, None)
210
211 def test_autobegin_within_flush(self):
212 """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