MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_reconfigure_on_other_mapper

Method test_reconfigure_on_other_mapper

test/orm/test_mapper.py:410–435  ·  view source on GitHub ↗

A configure trigger on an already-configured mapper still triggers a check against all mappers.

(self)

Source from the content-addressed store, hash-verified

408 )
409
410 def test_reconfigure_on_other_mapper(self):
411 """A configure trigger on an already-configured mapper
412 still triggers a check against all mappers."""
413
414 users, Address, addresses, User = (
415 self.tables.users,
416 self.classes.Address,
417 self.tables.addresses,
418 self.classes.User,
419 )
420
421 mp = self.mapper(User, users)
422 sa.orm.configure_mappers()
423 assert mp.registry._new_mappers is False
424
425 m = self.mapper(
426 Address,
427 addresses,
428 properties={"user": relationship(User, backref="addresses")},
429 )
430
431 assert m.configured is False
432 assert m.registry._new_mappers is True
433 User()
434 assert User.addresses
435 assert m.registry._new_mappers is False
436
437 def test_configure_on_session(self):
438 User, users = self.classes.User, self.tables.users

Callers

nothing calls this directly

Calls 3

relationshipFunction · 0.90
UserClass · 0.70
mapperMethod · 0.45

Tested by

no test coverage detected