(self)
| 1206 | eq_(h5.foober, "im the new foober") |
| 1207 | |
| 1208 | def test_eager_defaults(self): |
| 1209 | hohoval, default_t, Hoho = ( |
| 1210 | self.other.hohoval, |
| 1211 | self.tables.default_t, |
| 1212 | self.classes.Hoho, |
| 1213 | ) |
| 1214 | Secondary = self.classes.Secondary |
| 1215 | |
| 1216 | self.mapper_registry.map_imperatively( |
| 1217 | Hoho, |
| 1218 | default_t, |
| 1219 | eager_defaults=True, |
| 1220 | properties={ |
| 1221 | "sec": relationship(Secondary), |
| 1222 | "syn": sa.orm.synonym(default_t.c.counter), |
| 1223 | }, |
| 1224 | ) |
| 1225 | |
| 1226 | self.mapper_registry.map_imperatively( |
| 1227 | Secondary, self.tables.secondary_table |
| 1228 | ) |
| 1229 | h1 = Hoho() |
| 1230 | |
| 1231 | session = fixture_session() |
| 1232 | session.add(h1) |
| 1233 | |
| 1234 | if testing.db.dialect.insert_returning: |
| 1235 | self.sql_count_(1, session.flush) |
| 1236 | else: |
| 1237 | self.sql_count_(2, session.flush) |
| 1238 | |
| 1239 | self.sql_count_(0, lambda: eq_(h1.hoho, hohoval)) |
| 1240 | |
| 1241 | # no actual eager defaults, make sure error isn't raised |
| 1242 | h2 = Hoho(hoho=hohoval, counter=5) |
| 1243 | session.add(h2) |
| 1244 | session.flush() |
| 1245 | eq_(h2.hoho, hohoval) |
| 1246 | eq_(h2.counter, 5) |
| 1247 | |
| 1248 | def test_insert_nopostfetch(self): |
| 1249 | default_t, Hoho = self.tables.default_t, self.classes.Hoho |
nothing calls this directly
no test coverage detected