MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_configure_on_get_props_3

Method test_configure_on_get_props_3

test/orm/test_mapper.py:829–856  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

827 assert not m.configured
828
829 def test_configure_on_get_props_3(self):
830 users, Address, addresses, User = (
831 self.tables.users,
832 self.classes.Address,
833 self.tables.addresses,
834 self.classes.User,
835 )
836
837 m = self.mapper(User, users)
838 assert not m.configured
839 configure_mappers()
840
841 self.mapper(
842 Address,
843 addresses,
844 properties={"user": relationship(User, backref="addresses")},
845 )
846
847 # as of 2.0 #9220
848 # get_property() doesn't do "configure" now, there is
849 # no reason for this
850 with expect_raises_message(
851 sa.exc.InvalidRequestError, r".has no property 'addresses'"
852 ):
853 m.get_property("addresses")
854
855 configure_mappers()
856 is_(m.get_property("addresses"), m.attrs.addresses)
857
858 def test_backrefs_dont_automatically_configure(self):
859 """in #9220 for 2.0 we are changing an ancient behavior that

Callers

nothing calls this directly

Calls 6

configure_mappersFunction · 0.90
relationshipFunction · 0.90
expect_raises_messageFunction · 0.90
is_Function · 0.90
get_propertyMethod · 0.80
mapperMethod · 0.45

Tested by

no test coverage detected