summaryrefslogtreecommitdiff
path: root/test/orm/test_mapper.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-01-16 20:18:32 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-01-16 20:18:32 -0500
commita9a67667901e24eefb36e01334eed9bf25b2b144 (patch)
treefc28a4040ca71d69416da59d2102583ba9563c70 /test/orm/test_mapper.py
parent7325ba60bce50c63ce83fcb44f6b337664262ad0 (diff)
downloadsqlalchemy-a9a67667901e24eefb36e01334eed9bf25b2b144.tar.gz
- the zblog example is obsolete, the tests don't really test it
and a key feature of its mapping (the deferred col outside of the select) doesn't work anyway. - add a token "deferred on selectable" test to test_mapper.
Diffstat (limited to 'test/orm/test_mapper.py')
-rw-r--r--test/orm/test_mapper.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/orm/test_mapper.py b/test/orm/test_mapper.py
index b34c4ab8a..4de669b87 100644
--- a/test/orm/test_mapper.py
+++ b/test/orm/test_mapper.py
@@ -1893,6 +1893,28 @@ class DeferredTest(_fixtures.FixtureTest):
self.sql_count_(0, go)
@testing.resolve_artifact_names
+ def test_map_selectable_wo_deferred(self):
+ """test mapping to a selectable with deferred cols,
+ the selectable doesn't include the deferred col.
+
+ """
+
+ order_select = sa.select([
+ orders.c.id,
+ orders.c.user_id,
+ orders.c.address_id,
+ orders.c.description,
+ orders.c.isopen]).alias()
+ mapper(Order, order_select, properties={
+ 'description':deferred(order_select.c.description)
+ })
+
+ sess = Session()
+ o1 = sess.query(Order).order_by(Order.id).first()
+ assert 'description' not in o1.__dict__
+ eq_(o1.description, 'order 1')
+
+ @testing.resolve_artifact_names
def test_deep_options(self):
mapper(Item, items, properties=dict(
description=deferred(items.c.description)))