MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_prop_shadow

Method test_prop_shadow

test/orm/test_mapper.py:176–194  ·  view source on GitHub ↗

A backref name may not shadow an existing property name.

(self)

Source from the content-addressed store, hash-verified

174 Mapper(User, users)
175
176 def test_prop_shadow(self):
177 """A backref name may not shadow an existing property name."""
178
179 Address, addresses, users, User = (
180 self.classes.Address,
181 self.tables.addresses,
182 self.tables.users,
183 self.classes.User,
184 )
185
186 self.mapper(Address, addresses)
187 self.mapper(
188 User,
189 users,
190 properties={
191 "addresses": relationship(Address, backref="email_address")
192 },
193 )
194 assert_raises(sa.exc.ArgumentError, sa.orm.configure_mappers)
195
196 def test_update_attr_keys(self, connection):
197 """test that update()/insert() use the correct key when given

Callers

nothing calls this directly

Calls 3

relationshipFunction · 0.90
assert_raisesFunction · 0.90
mapperMethod · 0.45

Tested by

no test coverage detected