| 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`""" |