Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio_antuan committed Jan 29, 2019
1 parent c340ac8 commit a549be2
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/orm/test_select.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from sqlalchemy import Column, exc, func, literal
from sqlalchemy import (
Column,
exc,
func,
literal,
literal_column,
)
from sqlalchemy import text
from sqlalchemy import tuple_

Expand Down Expand Up @@ -47,6 +53,9 @@ def test_group_by_query(self):

self.assertIn('with_totals', str(ex.exception))

def make_count_query(self, base_query):
return base_query.from_self(func.count(literal_column('*')))

def test_array_join(self):
table = self.create_table(
Column('nested.array_column', types.Array(types.Int8)),
Expand All @@ -57,7 +66,11 @@ def test_array_join(self):
query = session.query(first_label, second_not_label).array_join(first_label, second_not_label)
self.assertEqual(
self.compile(query),
'SELECT "nested.array_column" AS from_array, "nested.another_array_column" AS "t1_nested.another_array_column" FROM t1 ARRAY JOIN nested.array_column, nested.another_array_column'
'SELECT '
'"nested.array_column" AS from_array, '
'"nested.another_array_column" AS "t1_nested.another_array_column" '
'FROM t1 '
'ARRAY JOIN nested.array_column, nested.another_array_column'
)

def test_sample(self):
Expand All @@ -68,7 +81,8 @@ def test_sample(self):
self.compile(query),
'SELECT x AS t1_x FROM t1 SAMPLE %(param_1)s GROUP BY x'
)

q = self.make_count_query(query)
self.compile(q)
self.assertEqual(
self.compile(query, literal_binds=True),
'SELECT x AS t1_x FROM t1 SAMPLE 0.1 GROUP BY x'
Expand Down

0 comments on commit a549be2

Please sign in to comment.