MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _option_test_fixture

Method _option_test_fixture

test/orm/test_deprecations.py:290–319  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

288 )
289
290 def _option_test_fixture(self):
291 users, addresses, dingalings = (
292 self.tables.users,
293 self.tables.addresses,
294 self.tables.dingalings,
295 )
296
297 # these must be module level for pickling
298 from .test_pickled import Address
299 from .test_pickled import Dingaling
300 from .test_pickled import User
301
302 self.mapper_registry.map_imperatively(
303 User,
304 users,
305 properties={"addresses": relationship(Address, backref="user")},
306 )
307 self.mapper_registry.map_imperatively(
308 Address,
309 addresses,
310 properties={"dingaling": relationship(Dingaling)},
311 )
312 self.mapper_registry.map_imperatively(Dingaling, dingalings)
313 sess = fixture_session()
314 u1 = User(name="ed")
315 u1.addresses.append(Address(email_address="ed@bar.com"))
316 sess.add(u1)
317 sess.flush()
318 sess.expunge_all()
319 return sess, User, Address, Dingaling
320
321
322class SynonymTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 9

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
map_imperativelyMethod · 0.80
UserClass · 0.70
AddressClass · 0.70
appendMethod · 0.45
addMethod · 0.45
flushMethod · 0.45
expunge_allMethod · 0.45

Tested by

no test coverage detected