summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIuri Diniz <iuridiniz@gmail.com>2016-07-29 13:08:07 -0300
committerIuri Diniz <iuridiniz@gmail.com>2016-07-29 13:09:16 -0300
commitff08201b84c35dce79bf368b9ca55c971b34342c (patch)
tree8afee2f81099565a39b33dcbc1394b7c8a6c5590
parent0d92f79fd86073203a2a956460140c311c85a396 (diff)
downloadsqlalchemy-ff08201b84c35dce79bf368b9ca55c971b34342c.tar.gz
Missing test for group_by (ORM)
-rw-r--r--test/orm/test_query.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/orm/test_query.py b/test/orm/test_query.py
index 34343d78d..7ec0116b7 100644
--- a/test/orm/test_query.py
+++ b/test/orm/test_query.py
@@ -1574,6 +1574,17 @@ class ExpressionTest(QueryTest, AssertsCompiledSQL):
User(id=7, name='jack'),
Address(email_address='jack@bean.com', user_id=7, id=1))])
+ def test_group_by(self):
+ User = self.classes.User
+ s = create_session()
+
+ q1 = s.query(User.id, User.name).group_by(User.name)
+ self.assert_compile(
+ select([q1]),
+ "SELECT users_id, users_name FROM (SELECT users.id AS users_id, "
+ "users.name AS users_name FROM users GROUP BY users.name)"
+ )
+
class ColumnPropertyTest(_fixtures.FixtureTest, AssertsCompiledSQL):
__dialect__ = 'default'