summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/orm/lazy_relations.py21
-rw-r--r--test/sql/select.py1
2 files changed, 22 insertions, 0 deletions
diff --git a/test/orm/lazy_relations.py b/test/orm/lazy_relations.py
index 4ac8a13ef..b5c3b3669 100644
--- a/test/orm/lazy_relations.py
+++ b/test/orm/lazy_relations.py
@@ -174,6 +174,27 @@ class LazyTest(_fixtures.FixtureTest):
assert [User(id=7, address=Address(id=1))] == l
@testing.resolve_artifact_names
+ def test_many_to_one_binds(self):
+ mapper(Address, addresses, primary_key=[addresses.c.user_id, addresses.c.email_address])
+
+ mapper(User, users, properties = dict(
+ address = relation(Address, uselist=False,
+ primaryjoin=sa.and_(users.c.id==addresses.c.user_id, addresses.c.email_address=='ed@bettyboop.com')
+ )
+ ))
+ q = create_session().query(User)
+ eq_(
+ [
+ User(id=7, address=None),
+ User(id=8, address=Address(id=3)),
+ User(id=9, address=None),
+ User(id=10, address=None),
+ ],
+ list(q)
+ )
+
+
+ @testing.resolve_artifact_names
def test_double(self):
"""tests lazy loading with two relations simulatneously, from the same table, using aliases. """
diff --git a/test/sql/select.py b/test/sql/select.py
index 5d6d6dcaa..15c47a674 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -404,6 +404,7 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A
"myothertable.othername = :othername_2 OR myothertable.otherid = :otherid_1) AND sysdate() = today()",
checkparams = {'othername_1': 'asdf', 'othername_2':'foo', 'otherid_1': 9, 'myid_1': 12}
)
+
def test_distinct(self):
self.assert_compile(