MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_defer_primary_key

Method test_defer_primary_key

test/orm/test_deferred.py:188–201  ·  view source on GitHub ↗

what happens when we try to defer the primary key?

(self)

Source from the content-addressed store, hash-verified

186 )
187
188 def test_defer_primary_key(self):
189 """what happens when we try to defer the primary key?"""
190
191 Order, orders = self.classes.Order, self.tables.orders
192
193 self.mapper_registry.map_imperatively(
194 Order, orders, properties={"id": deferred(orders.c.id)}
195 )
196
197 # right now, it's not that graceful :)
198 q = fixture_session().query(Order)
199 assert_raises_message(
200 sa.exc.NoSuchColumnError, "Could not locate", q.first
201 )
202
203 @testing.combinations(True, False, argnames="use_wildcard")
204 def test_defer_option_primary_key(self, use_wildcard):

Callers

nothing calls this directly

Calls 5

deferredFunction · 0.90
fixture_sessionFunction · 0.90
assert_raises_messageFunction · 0.90
map_imperativelyMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected