summaryrefslogtreecommitdiff
path: root/test/orm/test_joins.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-08-28 12:38:04 +0100
committerMichael Williamson <mike@zwobble.org>2016-08-28 12:38:04 +0100
commit94fe6fe05dacf6f38dd0541fd59b0ca76b440c4e (patch)
treedb5c13fd44a729a2352c4ae69ac1f3c8a5abc94a /test/orm/test_joins.py
parent117997cd5b849a236208cf9ea16f0f09c6962804 (diff)
downloadsqlalchemy-pr/304.tar.gz
Provide more informative error when joining with no entitiespr/304
Diffstat (limited to 'test/orm/test_joins.py')
-rw-r--r--test/orm/test_joins.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/orm/test_joins.py b/test/orm/test_joins.py
index e14af635d..01f8627bc 100644
--- a/test/orm/test_joins.py
+++ b/test/orm/test_joins.py
@@ -447,6 +447,19 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
sess.query(literal_column('x'), User).join, Address
)
+ def test_left_is_none_and_query_has_no_entities(self):
+ User = self.classes.User
+ Address = self.classes.Address
+
+ sess = create_session()
+
+ assert_raises_message(
+ sa_exc.InvalidRequestError,
+ "No entities to join from; please use select_from\(\) to "
+ "establish the left entity/selectable of this join",
+ sess.query().join, Address
+ )
+
def test_isouter_flag(self):
User = self.classes.User