summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorKhairi Hafsham <jumanjisama@gmail.com>2017-02-02 13:02:21 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2017-02-07 11:21:56 -0500
commit772374735da27df1ddb907f4a0f5085b46dbe82b (patch)
tree41f88c835a74d4665c97853ae8676a5181d61db3 /test/sql
parentd71f4b47186972c5248c94ee2d04364da95a0965 (diff)
downloadsqlalchemy-772374735da27df1ddb907f4a0f5085b46dbe82b.tar.gz
Make all tests to be PEP8 compliant
tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_compiler.py3
-rw-r--r--test/sql/test_constraints.py26
-rw-r--r--test/sql/test_cte.py5
-rw-r--r--test/sql/test_defaults.py38
-rw-r--r--test/sql/test_functions.py8
-rw-r--r--test/sql/test_generative.py62
-rw-r--r--test/sql/test_insert.py5
-rw-r--r--test/sql/test_inspect.py1
-rw-r--r--test/sql/test_labels.py22
-rw-r--r--test/sql/test_lateral.py3
-rw-r--r--test/sql/test_metadata.py3
-rw-r--r--test/sql/test_operators.py28
-rw-r--r--test/sql/test_query.py7
-rw-r--r--test/sql/test_quote.py4
-rw-r--r--test/sql/test_resultset.py22
-rw-r--r--test/sql/test_returning.py1
-rw-r--r--test/sql/test_rowcount.py11
-rw-r--r--test/sql/test_selectable.py61
-rw-r--r--test/sql/test_tablesample.py1
-rw-r--r--test/sql/test_type_expressions.py9
-rw-r--r--test/sql/test_types.py44
-rw-r--r--test/sql/test_update.py13
-rw-r--r--test/sql/test_utils.py5
23 files changed, 199 insertions, 183 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 3e7c3d9a3..e7504a748 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -3092,7 +3092,6 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
'x2': 1,
'y': 2})
-
def test_labels_no_collision(self):
t = table('foo', column('id'), column('foo_id'))
@@ -3856,7 +3855,7 @@ class CoercionTest(fixtures.TestBase, AssertsCompiledSQL):
def test_val_is_null_coerced(self):
t = self._fixture()
- self.assert_compile(and_(t.c.id == None),
+ self.assert_compile(and_(t.c.id == None), # noqa
"foo.id IS NULL")
def test_val_and_None(self):
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py
index efd52ffb5..aebbb4c30 100644
--- a/test/sql/test_constraints.py
+++ b/test/sql/test_constraints.py
@@ -10,7 +10,10 @@ from sqlalchemy.engine import default
from sqlalchemy.testing import engines
from sqlalchemy.testing.assertions import expect_warnings
from sqlalchemy.testing import eq_
-from sqlalchemy.testing.assertsql import AllOf, RegexSQL, CompiledSQL, DialectSQL
+from sqlalchemy.testing.assertsql import (AllOf,
+ RegexSQL,
+ CompiledSQL,
+ DialectSQL)
from sqlalchemy.sql import table, column
@@ -451,11 +454,6 @@ class ConstraintGenTest(fixtures.TestBase, AssertsExecutionResults):
),
)
-
-
-
-
-
@testing.requires.check_constraints
@testing.provide_metadata
def test_check_constraint_create(self):
@@ -616,11 +614,11 @@ class ConstraintGenTest(fixtures.TestBase, AssertsExecutionResults):
RegexSQL("^CREATE TABLE events"),
AllOf(
CompiledSQL('CREATE UNIQUE INDEX ix_events_name ON events '
- '(name)'),
+ '(name)'),
CompiledSQL('CREATE INDEX ix_events_location ON events '
- '(location)'),
+ '(location)'),
CompiledSQL('CREATE UNIQUE INDEX sport_announcer ON events '
- '(sport, announcer)'),
+ '(sport, announcer)'),
CompiledSQL('CREATE INDEX idx_winners ON events (winner)'),
)
)
@@ -828,11 +826,11 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
)
def test_deferrable_pk(self):
- factory = lambda **kw: PrimaryKeyConstraint('a', **kw)
+ def factory(**kw): return PrimaryKeyConstraint('a', **kw)
self._test_deferrable(factory)
def test_deferrable_table_fk(self):
- factory = lambda **kw: ForeignKeyConstraint(['b'], ['tbl.a'], **kw)
+ def factory(**kw): return ForeignKeyConstraint(['b'], ['tbl.a'], **kw)
self._test_deferrable(factory)
def test_deferrable_column_fk(self):
@@ -896,11 +894,11 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
)
def test_deferrable_unique(self):
- factory = lambda **kw: UniqueConstraint('b', **kw)
+ def factory(**kw): return UniqueConstraint('b', **kw)
self._test_deferrable(factory)
def test_deferrable_table_check(self):
- factory = lambda **kw: CheckConstraint('a < b', **kw)
+ def factory(**kw): return CheckConstraint('a < b', **kw)
self._test_deferrable(factory)
def test_multiple(self):
@@ -1148,5 +1146,3 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
schema.CreateIndex(constraint),
"CREATE INDEX name ON tbl (a + 5)"
)
-
-
diff --git a/test/sql/test_cte.py b/test/sql/test_cte.py
index f81a1d8e5..f33516cc2 100644
--- a/test/sql/test_cte.py
+++ b/test/sql/test_cte.py
@@ -171,7 +171,7 @@ class CTETest(fixtures.TestBase, AssertsCompiledSQL):
cte = s1.cte(name="cte", recursive=True)
# can't do it here...
- #bar = select([cte]).cte('bar')
+ # bar = select([cte]).cte('bar')
cte = cte.union_all(
select([cte.c.x + 1]).where(cte.c.x < 10)
)
@@ -480,7 +480,8 @@ class CTETest(fixtures.TestBase, AssertsCompiledSQL):
self.assert_compile(
stmt,
'WITH regional_sales AS (SELECT "order"."order" AS "order" '
- 'FROM "order") oracle suffix SELECT "order"."order" FROM "order", '
+ 'FROM "order") oracle suffix '
+ 'SELECT "order"."order" FROM "order", '
'regional_sales WHERE "order"."order" > regional_sales."order"',
dialect='oracle'
)
diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py
index b294158f4..dff423bf9 100644
--- a/test/sql/test_defaults.py
+++ b/test/sql/test_defaults.py
@@ -329,7 +329,6 @@ class DefaultTest(fixtures.TestBase):
c = sa.ColumnDefault(fn)
c.arg("context")
-
@testing.fails_on('firebird', 'Data type unknown')
def test_standalone(self):
c = testing.db.engine.contextual_connect()
@@ -427,9 +426,9 @@ class DefaultTest(fixtures.TestBase):
ctexec = sa.select(
[currenttime.label('now')], bind=testing.db).scalar()
- l = t.select().order_by(t.c.col1).execute()
+ result = t.select().order_by(t.c.col1).execute()
today = datetime.date.today()
- eq_(l.fetchall(), [
+ eq_(result.fetchall(), [
(x, 'imthedefault', f, ts, ts, ctexec, True, False,
12, today, 'py', 'hi', 'BINDfoo')
for x in range(51, 54)])
@@ -447,9 +446,9 @@ class DefaultTest(fixtures.TestBase):
t.insert().execute({}, {}, {})
ctexec = currenttime.scalar()
- l = t.select().execute()
+ result = t.select().execute()
today = datetime.date.today()
- eq_(l.fetchall(),
+ eq_(result.fetchall(),
[(51, 'imthedefault', f, ts, ts, ctexec, True, False,
12, today, 'py', 'hi', 'BINDfoo'),
(52, 'imthedefault', f, ts, ts, ctexec, True, False,
@@ -463,9 +462,9 @@ class DefaultTest(fixtures.TestBase):
t.insert().values([{}, {}, {}]).execute()
ctexec = currenttime.scalar()
- l = t.select().execute()
+ result = t.select().execute()
today = datetime.date.today()
- eq_(l.fetchall(),
+ eq_(result.fetchall(),
[(51, 'imthedefault', f, ts, ts, ctexec, True, False,
12, today, 'py', 'hi', 'BINDfoo'),
(52, 'imthedefault', f, ts, ts, ctexec, True, False,
@@ -513,8 +512,8 @@ class DefaultTest(fixtures.TestBase):
def test_insert_values(self):
t.insert(values={'col3': 50}).execute()
- l = t.select().execute()
- eq_(50, l.first()['col3'])
+ result = t.select().execute()
+ eq_(50, result.first()['col3'])
@testing.fails_on('firebird', 'Data type unknown')
def test_updatemany(self):
@@ -533,10 +532,10 @@ class DefaultTest(fixtures.TestBase):
{'pkval': 52},
{'pkval': 53})
- l = t.select().execute()
+ result = t.select().execute()
ctexec = currenttime.scalar()
today = datetime.date.today()
- eq_(l.fetchall(),
+ eq_(result.fetchall(),
[(51, 'im the update', f2, ts, ts, ctexec, False, False,
13, today, 'py', 'hi', 'BINDfoo'),
(52, 'im the update', f2, ts, ts, ctexec, True, False,
@@ -550,9 +549,9 @@ class DefaultTest(fixtures.TestBase):
pk = r.inserted_primary_key[0]
t.update(t.c.col1 == pk).execute(col4=None, col5=None)
ctexec = currenttime.scalar()
- l = t.select(t.c.col1 == pk).execute()
- l = l.first()
- eq_(l,
+ result = t.select(t.c.col1 == pk).execute()
+ result = result.first()
+ eq_(result,
(pk, 'im the update', f2, None, None, ctexec, True, False,
13, datetime.date.today(), 'py', 'hi', 'BINDfoo'))
eq_(11, f2)
@@ -562,9 +561,9 @@ class DefaultTest(fixtures.TestBase):
r = t.insert().execute()
pk = r.inserted_primary_key[0]
t.update(t.c.col1 == pk, values={'col3': 55}).execute()
- l = t.select(t.c.col1 == pk).execute()
- l = l.first()
- eq_(55, l['col3'])
+ result = t.select(t.c.col1 == pk).execute()
+ result = result.first()
+ eq_(55, result['col3'])
class CTEDefaultTest(fixtures.TablesTest):
@@ -751,10 +750,10 @@ class PKIncrementTest(fixtures.TablesTest):
try:
try:
self._test_autoincrement(con)
- except:
+ except Exception:
try:
tx.rollback()
- except:
+ except Exception:
pass
raise
else:
@@ -1214,6 +1213,7 @@ class SequenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
result = testing.db.execute(t.insert())
eq_(result.inserted_primary_key, [1])
+
cartitems = sometable = metadata = None
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py
index 0074d789b..272bd876e 100644
--- a/test/sql/test_functions.py
+++ b/test/sql/test_functions.py
@@ -384,7 +384,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
def test_funcfilter_criterion(self):
self.assert_compile(
func.count(1).filter(
- table1.c.name != None
+ table1.c.name != None # noqa
),
"count(:count_1) FILTER (WHERE mytable.name IS NOT NULL)"
)
@@ -392,7 +392,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
def test_funcfilter_compound_criterion(self):
self.assert_compile(
func.count(1).filter(
- table1.c.name == None,
+ table1.c.name == None, # noqa
table1.c.myid > 0
),
"count(:count_1) FILTER (WHERE mytable.name IS NULL AND "
@@ -402,7 +402,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
def test_funcfilter_label(self):
self.assert_compile(
select([func.count(1).filter(
- table1.c.description != None
+ table1.c.description != None # noqa
).label('foo')]),
"SELECT count(:count_1) FILTER (WHERE mytable.description "
"IS NOT NULL) AS foo FROM mytable"
@@ -414,7 +414,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
self.assert_compile(
select([
func.max(table1.c.name).filter(
- literal_column('description') != None
+ literal_column('description') != None # noqa
)
]),
"SELECT max(mytable.name) FILTER (WHERE description "
diff --git a/test/sql/test_generative.py b/test/sql/test_generative.py
index 6335a3cf1..1a12a8b0e 100644
--- a/test/sql/test_generative.py
+++ b/test/sql/test_generative.py
@@ -10,7 +10,11 @@ from sqlalchemy.sql.visitors import ClauseVisitor, CloningVisitor, \
cloned_traverse, ReplacingCloningVisitor
from sqlalchemy import exc
from sqlalchemy.sql import util as sql_util
-from sqlalchemy.testing import eq_, is_, is_not_, assert_raises, assert_raises_message
+from sqlalchemy.testing import (eq_,
+ is_,
+ is_not_,
+ assert_raises,
+ assert_raises_message)
A = B = t1 = t2 = t3 = table1 = table2 = table3 = table4 = None
@@ -1011,7 +1015,8 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
t2alias = t2.alias('t2alias')
vis = sql_util.ClauseAdapter(t1alias)
- s = select([literal_column('*')], from_obj=[t1alias, t2alias]).as_scalar()
+ s = select([literal_column('*')],
+ from_obj=[t1alias, t2alias]).as_scalar()
assert t2alias in s._froms
assert t1alias in s._froms
@@ -1033,8 +1038,8 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
'SELECT * FROM table2 AS t2alias WHERE '
't2alias.col1 = (SELECT * FROM table1 AS '
't1alias)')
- s = select([literal_column('*')], from_obj=[t1alias,
- t2alias]).correlate(t2alias).as_scalar()
+ s = select([literal_column('*')],
+ from_obj=[t1alias, t2alias]).correlate(t2alias).as_scalar()
self.assert_compile(select([literal_column('*')], t2alias.c.col1 == s),
'SELECT * FROM table2 AS t2alias WHERE '
't2alias.col1 = (SELECT * FROM table1 AS '
@@ -1050,7 +1055,8 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
't2alias.col1 = (SELECT * FROM table1 AS '
't1alias)')
- s = select([literal_column('*')]).where(t1.c.col1 == t2.c.col1).as_scalar()
+ s = select([literal_column('*')]).where(t1.c.col1 == t2.c.col1) \
+ .as_scalar()
self.assert_compile(select([t1.c.col1, s]),
'SELECT table1.col1, (SELECT * FROM table2 '
'WHERE table1.col1 = table2.col1) AS '
@@ -1066,8 +1072,8 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
'SELECT t1alias.col1, (SELECT * FROM '
'table2 WHERE t1alias.col1 = table2.col1) '
'AS anon_1 FROM table1 AS t1alias')
- s = select([literal_column('*')]).where(t1.c.col1
- == t2.c.col1).correlate(t1).as_scalar()
+ s = select([literal_column('*')]).where(t1.c.col1 == t2.c.col1) \
+ .correlate(t1).as_scalar()
self.assert_compile(select([t1.c.col1, s]),
'SELECT table1.col1, (SELECT * FROM table2 '
'WHERE table1.col1 = table2.col1) AS '
@@ -1116,21 +1122,22 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
def test_table_to_alias_2(self):
t1alias = t1.alias('t1alias')
vis = sql_util.ClauseAdapter(t1alias)
- self.assert_compile(vis.traverse(select([literal_column('*')], from_obj=[t1])),
- 'SELECT * FROM table1 AS t1alias')
+ self.assert_compile(
+ vis.traverse(select([literal_column('*')], from_obj=[t1])),
+ 'SELECT * FROM table1 AS t1alias')
def test_table_to_alias_3(self):
t1alias = t1.alias('t1alias')
vis = sql_util.ClauseAdapter(t1alias)
- self.assert_compile(select([literal_column('*')], t1.c.col1 == t2.c.col2),
- 'SELECT * FROM table1, table2 WHERE '
- 'table1.col1 = table2.col2')
+ self.assert_compile(
+ select([literal_column('*')], t1.c.col1 == t2.c.col2),
+ 'SELECT * FROM table1, table2 WHERE table1.col1 = table2.col2')
def test_table_to_alias_4(self):
t1alias = t1.alias('t1alias')
vis = sql_util.ClauseAdapter(t1alias)
- self.assert_compile(vis.traverse(select([literal_column('*')], t1.c.col1
- == t2.c.col2)),
+ self.assert_compile(vis.traverse(select([literal_column('*')],
+ t1.c.col1 == t2.c.col2)),
'SELECT * FROM table1 AS t1alias, table2 '
'WHERE t1alias.col1 = table2.col2')
@@ -1151,13 +1158,12 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
def test_table_to_alias_6(self):
t1alias = t1.alias('t1alias')
vis = sql_util.ClauseAdapter(t1alias)
- self.assert_compile(
- select([t1alias, t2]).where(
- t1alias.c.col1 == vis.traverse(
- select([literal_column('*')], t1.c.col1 == t2.c.col2, from_obj=[t1, t2]).
- correlate(t1)
- )
- ),
+ self.assert_compile(select([t1alias, t2]).where(
+ t1alias.c.col1 == vis.traverse(
+ select([literal_column('*')],
+ t1.c.col1 == t2.c.col2, from_obj=[t1, t2]).correlate(t1)
+ )
+ ),
"SELECT t1alias.col1, t1alias.col2, t1alias.col3, "
"table2.col1, table2.col2, table2.col3 "
"FROM table1 AS t1alias, table2 WHERE t1alias.col1 = "
@@ -1170,7 +1176,8 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
self.assert_compile(
select([t1alias, t2]).
where(t1alias.c.col1 == vis.traverse(
- select([literal_column('*')], t1.c.col1 == t2.c.col2, from_obj=[t1, t2]).
+ select([literal_column('*')],
+ t1.c.col1 == t2.c.col2, from_obj=[t1, t2]).
correlate(t2))),
"SELECT t1alias.col1, t1alias.col2, t1alias.col3, "
"table2.col1, table2.col2, table2.col3 "
@@ -1240,11 +1247,12 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
vis = sql_util.ClauseAdapter(t1alias)
t2alias = t2.alias('t2alias')
vis.chain(sql_util.ClauseAdapter(t2alias))
- self.assert_compile(vis.traverse(select([literal_column('*')], t1.c.col1
- == t2.c.col2)),
- 'SELECT * FROM table1 AS t1alias, table2 '
- 'AS t2alias WHERE t1alias.col1 = '
- 't2alias.col2')
+ self.assert_compile(
+ vis.traverse(
+ select([literal_column('*')], t1.c.col1 == t2.c.col2)),
+ 'SELECT * FROM table1 AS t1alias, table2 '
+ 'AS t2alias WHERE t1alias.col1 = '
+ 't2alias.col2')
def test_table_to_alias_15(self):
t1alias = t1.alias('t1alias')
diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py
index e23ab520d..d3bc11a96 100644
--- a/test/sql/test_insert.py
+++ b/test/sql/test_insert.py
@@ -9,6 +9,7 @@ from sqlalchemy.testing import AssertsCompiledSQL,\
assert_raises_message, fixtures, eq_, expect_warnings
from sqlalchemy.sql import crud
+
class _InsertTestBase(object):
@classmethod
@@ -24,8 +25,7 @@ class _InsertTestBase(object):
Column('id', Integer, primary_key=True),
Column('x', Integer, default=10),
Column('y', Integer, server_default=text('5')),
- Column('z', Integer, default=lambda: 10)
- )
+ Column('z', Integer, default=lambda: 10))
class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
@@ -426,7 +426,6 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
"SELECT mytable.foo, :bar AS anon_1 FROM mytable"
)
-
def test_insert_mix_select_values_exception(self):
table1 = self.tables.mytable
sel = select([table1.c.myid, table1.c.name]).where(
diff --git a/test/sql/test_inspect.py b/test/sql/test_inspect.py
index 60267542a..7178bc58a 100644
--- a/test/sql/test_inspect.py
+++ b/test/sql/test_inspect.py
@@ -41,4 +41,3 @@ class TestCoreInspection(fixtures.TestBase):
x = Column('foo', Integer)
assert not hasattr(x, '__clause_element__')
-
diff --git a/test/sql/test_labels.py b/test/sql/test_labels.py
index 7f548eb49..0b279754f 100644
--- a/test/sql/test_labels.py
+++ b/test/sql/test_labels.py
@@ -90,7 +90,8 @@ class MaxIdentTest(fixtures.TestBase, AssertsCompiledSQL):
table1 = self.table1
compiled = s.compile(dialect=self._length_fixture())
- assert set(compiled._create_result_map()['some_large_named_table__2'][1]).\
+ assert set(
+ compiled._create_result_map()['some_large_named_table__2'][1]).\
issuperset(
[
'some_large_named_table_this_is_the_data_column',
@@ -99,7 +100,8 @@ class MaxIdentTest(fixtures.TestBase, AssertsCompiledSQL):
]
)
- assert set(compiled._create_result_map()['some_large_named_table__1'][1]).\
+ assert set(
+ compiled._create_result_map()['some_large_named_table__1'][1]).\
issuperset(
[
'some_large_named_table_this_is_the_primarykey_column',
@@ -137,8 +139,8 @@ class MaxIdentTest(fixtures.TestBase, AssertsCompiledSQL):
set(compiled._create_result_map()['this_is_the_data_column'][1]).\
issuperset(['this_is_the_data_column',
s.c.this_is_the_data_column])
- assert \
- set(compiled._create_result_map()['this_is_the_primarykey__1'][1]).\
+ assert set(
+ compiled._create_result_map()['this_is_the_primarykey__1'][1]).\
issuperset(['this_is_the_primarykey_column',
'this_is_the_primarykey__1',
s.c.this_is_the_primarykey_column])
@@ -170,14 +172,16 @@ class MaxIdentTest(fixtures.TestBase, AssertsCompiledSQL):
"AS anon_1", dialect=dialect)
compiled = s.compile(dialect=dialect)
- assert set(compiled._create_result_map()['anon_1_this_is_the_data_3'][1]).\
+ assert set(
+ compiled._create_result_map()['anon_1_this_is_the_data_3'][1]).\
issuperset([
'anon_1_this_is_the_data_3',
q.corresponding_column(
table1.c.this_is_the_data_column)
])
- assert set(compiled._create_result_map()['anon_1_this_is_the_prim_1'][1]).\
+ assert set(
+ compiled._create_result_map()['anon_1_this_is_the_prim_1'][1]).\
issuperset([
'anon_1_this_is_the_prim_1',
q.corresponding_column(
@@ -253,8 +257,8 @@ class MaxIdentTest(fixtures.TestBase, AssertsCompiledSQL):
def test_bind_param_non_truncated(self):
table1 = self.table1
stmt = table1.insert().values(
- this_is_the_data_column=
- bindparam("this_is_the_long_bindparam_name")
+ this_is_the_data_column=bindparam(
+ "this_is_the_long_bindparam_name")
)
compiled = stmt.compile(dialect=self._length_fixture(length=10))
eq_(
@@ -563,5 +567,3 @@ class LabelLengthTest(fixtures.TestBase, AssertsCompiledSQL):
set(compiled._create_result_map()),
set(['tablename_columnn_1', 'tablename_columnn_2'])
)
-
-
diff --git a/test/sql/test_lateral.py b/test/sql/test_lateral.py
index 301d78aae..785dcd960 100644
--- a/test/sql/test_lateral.py
+++ b/test/sql/test_lateral.py
@@ -129,6 +129,3 @@ class LateralTest(fixtures.TablesTest, AssertsCompiledSQL):
"LATERAL generate_series(:generate_series_1, "
"bookcases.bookcase_shelves) AS anon_1 ON true"
)
-
-
-
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py
index ef61a7e87..56ef8e628 100644
--- a/test/sql/test_metadata.py
+++ b/test/sql/test_metadata.py
@@ -185,7 +185,7 @@ class MetaDataTest(fixtures.TestBase, ComparesTables):
eq_(getattr(fk2c, k), kw[k])
def test_check_constraint_copy(self):
- r = lambda x: x
+ def r(x): return x
c = CheckConstraint("foo bar",
name='name',
initially=True,
@@ -2184,7 +2184,6 @@ class ConstraintTest(fixtures.TestBase):
eq_(list(i.columns), [])
assert i.table is t
-
def test_separate_decl_columns(self):
m = MetaData()
t = Table('t', m, Column('x', Integer))
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py
index bbc912ffd..59cae6584 100644
--- a/test/sql/test_operators.py
+++ b/test/sql/test_operators.py
@@ -63,9 +63,9 @@ class DefaultColumnComparatorTest(fixtures.TestBase):
self._loop_test(operator, right)
def _loop_test(self, operator, *arg):
- l = LoopOperate()
+ loop = LoopOperate()
is_(
- operator(l, *arg),
+ operator(loop, *arg),
operator
)
@@ -764,7 +764,7 @@ class JSONIndexOpTest(fixtures.TestBase, testing.AssertsCompiledSQL):
col = Column('x', self.MyType())
self.assert_compile(
- col[8] != None,
+ col[8] != None, # noqa
"(x -> :x_1) IS NOT NULL"
)
@@ -774,7 +774,7 @@ class JSONIndexOpTest(fixtures.TestBase, testing.AssertsCompiledSQL):
col2 = Column('y', Integer())
self.assert_compile(
- col[col2 + 8] != None,
+ col[col2 + 8] != None, # noqa
"(x -> (y + :y_1)) IS NOT NULL",
checkparams={'y_1': 8}
)
@@ -1306,7 +1306,7 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
def test_operator_precedence_1(self):
self.assert_compile(
- self.table2.select((self.table2.c.field == 5) == None),
+ self.table2.select((self.table2.c.field == 5) == None), # noqa
"SELECT op.field FROM op WHERE (op.field = :field_1) IS NULL")
def test_operator_precedence_2(self):
@@ -1565,11 +1565,11 @@ class OperatorAssociativityTest(fixtures.TestBase, testing.AssertsCompiledSQL):
def test_associativity_22(self):
f = column('f')
- self.assert_compile((f==f) == f, '(f = f) = f')
+ self.assert_compile((f == f) == f, '(f = f) = f')
def test_associativity_23(self):
f = column('f')
- self.assert_compile((f!=f) != f, '(f != f) != f')
+ self.assert_compile((f != f) != f, '(f != f) != f')
class IsDistinctFromTest(fixtures.TestBase, testing.AssertsCompiledSQL):
@@ -1738,8 +1738,9 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
def test_in_21(self):
self.assert_compile(~self.table1.c.myid.in_(
- select([self.table2.c.otherid])),
- "mytable.myid NOT IN (SELECT myothertable.otherid FROM myothertable)")
+ select([self.table2.c.otherid])),
+ "mytable.myid NOT IN "
+ "(SELECT myothertable.otherid FROM myothertable)")
def test_in_22(self):
self.assert_compile(
@@ -1778,7 +1779,8 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
)
), "mytable.myid IN ("
"SELECT mytable.myid FROM mytable WHERE mytable.myid = :myid_1 "
- "UNION SELECT mytable.myid FROM mytable WHERE mytable.myid = :myid_2)")
+ "UNION SELECT mytable.myid FROM mytable "
+ "WHERE mytable.myid = :myid_2)")
def test_in_27(self):
# test that putting a select in an IN clause does not
@@ -1790,8 +1792,9 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
order_by=[self.table2.c.othername],
limit=10, correlate=False)
),
- from_obj=[self.table1.join(self.table2,
- self.table1.c.myid == self.table2.c.otherid)],
+ from_obj=[self.table1.join(
+ self.table2,
+ self.table1.c.myid == self.table2.c.otherid)],
order_by=[self.table1.c.myid]
),
"SELECT mytable.myid, "
@@ -2641,4 +2644,3 @@ class AnyAllTest(fixtures.TestBase, testing.AssertsCompiledSQL):
"FROM tab1 WHERE tab1.data < :data_1)",
checkparams={'data_1': 10, 'param_1': 5}
)
-
diff --git a/test/sql/test_query.py b/test/sql/test_query.py
index 5a201d904..bc9a176f1 100644
--- a/test/sql/test_query.py
+++ b/test/sql/test_query.py
@@ -225,7 +225,8 @@ class QueryTest(fixtures.TestBase):
def test_bindparam_detection(self):
dialect = default.DefaultDialect(paramstyle='qmark')
- prep = lambda q: str(sql.text(q).compile(dialect=dialect))
+
+ def prep(q): return str(sql.text(q).compile(dialect=dialect))
def a_eq(got, wanted):
if got != wanted:
@@ -547,7 +548,7 @@ class RequiredBindTest(fixtures.TablesTest):
is_(bindparam('foo', 'bar').required, False)
is_(bindparam('foo', 'bar', required=True).required, True)
- c = lambda: None
+ def c(): return None
is_(bindparam('foo', callable_=c, required=True).required, True)
is_(bindparam('foo', callable_=c).required, False)
is_(bindparam('foo', callable_=c, required=False).required, False)
@@ -941,6 +942,7 @@ class CompoundTest(fixtures.TestBase):
found = self._fetchall_sorted(ua.select().execute())
eq_(found, wanted)
+
t1 = t2 = t3 = None
@@ -1199,6 +1201,7 @@ class JoinTest(fixtures.TestBase):
from_obj=[(t1.join(t2).outerjoin(t3, criteria))])
self.assertRows(expr, [(10, 20, 30)])
+
metadata = flds = None
diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py
index 6b0ab4ece..94f9d62ac 100644
--- a/test/sql/test_quote.py
+++ b/test/sql/test_quote.py
@@ -3,7 +3,9 @@ from sqlalchemy import sql, schema
from sqlalchemy.sql import compiler
from sqlalchemy.testing import fixtures, AssertsCompiledSQL, eq_
from sqlalchemy import testing
-from sqlalchemy.sql.elements import quoted_name, _truncated_label, _anonymous_label
+from sqlalchemy.sql.elements import (quoted_name,
+ _truncated_label,
+ _anonymous_label)
from sqlalchemy.testing.util import picklers
diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py
index 561176a24..de677be9a 100644
--- a/test/sql/test_resultset.py
+++ b/test/sql/test_resultset.py
@@ -56,10 +56,10 @@ class ResultProxyTest(fixtures.TablesTest):
{'user_id': 9, 'user_name': 'fred'},
)
r = users.select().execute()
- l = []
+ rows = []
for row in r:
- l.append(row)
- eq_(len(l), 3)
+ rows.append(row)
+ eq_(len(rows), 3)
@testing.requires.subqueries
def test_anonymous_rows(self):
@@ -245,10 +245,10 @@ class ResultProxyTest(fixtures.TablesTest):
users.insert().execute(user_id=8, user_name='ed')
users.insert().execute(user_id=9, user_name='fred')
r = users.select().execute()
- l = []
+ rows = []
for row in r.fetchmany(size=2):
- l.append(row)
- eq_(len(l), 2)
+ rows.append(row)
+ eq_(len(rows), 2)
def test_column_slices(self):
users = self.tables.users
@@ -942,14 +942,14 @@ class ResultProxyTest(fixtures.TablesTest):
class MyList(object):
- def __init__(self, l):
- self.l = l
+ def __init__(self, data):
+ self.internal_list = data
def __len__(self):
- return len(self.l)
+ return len(self.internal_list)
def __getitem__(self, i):
- return list.__getitem__(self.l, i)
+ return list.__getitem__(self.internal_list, i)
proxy = RowProxy(object(), MyList(['value']), [None], {
'key': (None, None, 0), 0: (None, None, 0)})
@@ -1111,7 +1111,6 @@ class ResultProxyTest(fixtures.TablesTest):
r.close()
-
class KeyTargetingTest(fixtures.TablesTest):
run_inserts = 'once'
run_deletes = None
@@ -1709,4 +1708,3 @@ class AlternateResultProxyTest(fixtures.TablesTest):
len(result._BufferedRowResultProxy__rowbuffer),
27
)
-
diff --git a/test/sql/test_returning.py b/test/sql/test_returning.py
index 96f9eeee4..947fe0dc5 100644
--- a/test/sql/test_returning.py
+++ b/test/sql/test_returning.py
@@ -414,7 +414,6 @@ class ReturnDefaultsTest(fixtures.TablesTest):
)
-
class ImplicitReturningFlag(fixtures.TestBase):
__backend__ = True
diff --git a/test/sql/test_rowcount.py b/test/sql/test_rowcount.py
index 110f3639f..0ab5589ab 100644
--- a/test/sql/test_rowcount.py
+++ b/test/sql/test_rowcount.py
@@ -17,11 +17,12 @@ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults):
metadata = MetaData(testing.db)
employees_table = Table(
- 'employees', metadata, Column(
- 'employee_id', Integer, Sequence(
- 'employee_id_seq', optional=True), primary_key=True), Column(
- 'name', String(50)), Column(
- 'department', String(1)), )
+ 'employees', metadata,
+ Column(
+ 'employee_id', Integer,
+ Sequence('employee_id_seq', optional=True), primary_key=True),
+ Column('name', String(50)),
+ Column('department', String(1)))
metadata.create_all()
def setup(self):
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index 95a0336b7..d38ee0e8a 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -374,8 +374,8 @@ class SelectableTest(
assert u1.corresponding_column(table1.c.col3) is u1.c.col1
def test_singular_union(self):
- u = union(select([table1.c.col1, table1.c.col2, table1.c.col3]), select(
- [table1.c.col1, table1.c.col2, table1.c.col3]))
+ u = union(select([table1.c.col1, table1.c.col2, table1.c.col3]),
+ select([table1.c.col1, table1.c.col2, table1.c.col3]))
u = union(select([table1.c.col1, table1.c.col2, table1.c.col3]))
assert u.c.col1 is not None
assert u.c.col2 is not None
@@ -389,11 +389,10 @@ class SelectableTest(
table1.c.col2,
table1.c.col3,
table1.c.colx,
- null().label('coly')]).union(select([table2.c.col1,
- table2.c.col2,
- table2.c.col3,
- null().label('colx'),
- table2.c.coly])).alias('analias')
+ null().label('coly')]).union(
+ select([table2.c.col1, table2.c.col2, table2.c.col3,
+ null().label('colx'), table2.c.coly])
+ ).alias('analias')
s1 = table1.select(use_labels=True)
s2 = table2.select(use_labels=True)
assert u.corresponding_column(s1.c.table1_col2) is u.c.col2
@@ -490,11 +489,10 @@ class SelectableTest(
table1.c.col2,
table1.c.col3,
table1.c.colx,
- null().label('coly')]).union(select([table2.c.col1,
- table2.c.col2,
- table2.c.col3,
- null().label('colx'),
- table2.c.coly])).alias('analias')
+ null().label('coly')]).union(
+ select([table2.c.col1, table2.c.col2, table2.c.col3,
+ null().label('colx'), table2.c.coly])
+ ).alias('analias')
s = select([u])
s1 = table1.select(use_labels=True)
s2 = table2.select(use_labels=True)
@@ -509,11 +507,10 @@ class SelectableTest(
table1.c.col2,
table1.c.col3,
table1.c.colx,
- null().label('coly')]).union(select([table2.c.col1,
- table2.c.col2,
- table2.c.col3,
- null().label('colx'),
- table2.c.coly])).alias('analias')
+ null().label('coly')]).union(
+ select([table2.c.col1, table2.c.col2, table2.c.col3,
+ null().label('colx'), table2.c.coly])
+ ).alias('analias')
j1 = table1.join(table2)
assert u.corresponding_column(j1.c.table1_colx) is u.c.colx
assert j1.corresponding_column(u.c.colx) is j1.c.table1_colx
@@ -613,7 +610,8 @@ class SelectableTest(
s2 = select([s.label('c')])
self.assert_compile(
s2.select(),
- "SELECT c FROM (SELECT (SELECT (SELECT table1.col1 AS a FROM table1) AS b) AS c)"
+ "SELECT c FROM (SELECT (SELECT ("
+ "SELECT table1.col1 AS a FROM table1) AS b) AS c)"
)
def test_self_referential_select_raises(self):
@@ -1464,17 +1462,18 @@ class ReduceTest(fixtures.TestBase, AssertsExecutionResults):
Column('primary_language', String(50)),
)
managers = Table(
- 'managers', metadata, Column(
- 'person_id', Integer, ForeignKey('people.person_id'), primary_key=True), Column(
- 'status', String(30)), Column(
- 'manager_name', String(50)))
+ 'managers', metadata,
+ Column('person_id', Integer, ForeignKey('people.person_id'),
+ primary_key=True),
+ Column('status', String(30)),
+ Column('manager_name', String(50)))
pjoin = \
people.outerjoin(engineers).outerjoin(managers).\
select(use_labels=True).alias('pjoin'
)
- eq_(util.column_set(sql_util.reduce_columns([pjoin.c.people_person_id,
- pjoin.c.engineers_person_id,
- pjoin.c.managers_person_id])),
+ eq_(util.column_set(sql_util.reduce_columns(
+ [pjoin.c.people_person_id, pjoin.c.engineers_person_id,
+ pjoin.c.managers_person_id])),
util.column_set([pjoin.c.people_person_id]))
def test_reduce_aliased_union(self):
@@ -1553,7 +1552,8 @@ class ReduceTest(fixtures.TestBase, AssertsExecutionResults):
select_from(page_table.join(magazine_page_table))
).alias('pjoin')
eq_(util.column_set(sql_util.reduce_columns(
- [pjoin.c.id, pjoin.c.page_id, pjoin.c.magazine_page_id])), util.column_set([pjoin.c.id]))
+ [pjoin.c.id, pjoin.c.page_id, pjoin.c.magazine_page_id])),
+ util.column_set([pjoin.c.id]))
# the first selectable has a CAST, which is a placeholder for
# classified_page.magazine_page_id in the second selectable.
@@ -1578,7 +1578,8 @@ class ReduceTest(fixtures.TestBase, AssertsExecutionResults):
join(classified_page_table))
).alias('pjoin')
eq_(util.column_set(sql_util.reduce_columns(
- [pjoin.c.id, pjoin.c.page_id, pjoin.c.magazine_page_id])), util.column_set([pjoin.c.id]))
+ [pjoin.c.id, pjoin.c.page_id, pjoin.c.magazine_page_id])),
+ util.column_set([pjoin.c.id]))
class DerivedTest(fixtures.TestBase, AssertsExecutionResults):
@@ -1833,10 +1834,11 @@ class AnnotationsTest(fixtures.TestBase):
assert elem == {}
assert b2.left is not bin.left
- assert b3.left is not b2.left is not bin.left
+ assert b3.left is not b2.left and b2.left is not bin.left
assert b4.left is bin.left # since column is immutable
# deannotate copies the element
- assert bin.right is not b2.right is not b3.right is not b4.right
+ assert bin.right is not b2.right and b2.right is not b3.right \
+ and b3.right is not b4.right
def test_annotate_unique_traversal(self):
"""test that items are copied only once during
@@ -2302,6 +2304,7 @@ class ResultMapTest(fixtures.TestBase):
[Boolean]
)
+
class ForUpdateTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = "default"
diff --git a/test/sql/test_tablesample.py b/test/sql/test_tablesample.py
index b2dddaf8c..879e83182 100644
--- a/test/sql/test_tablesample.py
+++ b/test/sql/test_tablesample.py
@@ -51,4 +51,3 @@ class TableSampleTest(fixtures.TablesTest, AssertsCompiledSQL):
'SELECT alias.people_id FROM '
'people AS alias TABLESAMPLE system(1)'
)
-
diff --git a/test/sql/test_type_expressions.py b/test/sql/test_type_expressions.py
index 0ef3a3e16..75ff3b85e 100644
--- a/test/sql/test_type_expressions.py
+++ b/test/sql/test_type_expressions.py
@@ -1,4 +1,11 @@
-from sqlalchemy import Table, Column, String, func, MetaData, select, TypeDecorator, cast
+from sqlalchemy import (Table,
+ Column,
+ String,
+ func,
+ MetaData,
+ select,
+ TypeDecorator,
+ cast)
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import testing
from sqlalchemy.testing import eq_
diff --git a/test/sql/test_types.py b/test/sql/test_types.py
index 641db5bc0..8fbc65ef2 100644
--- a/test/sql/test_types.py
+++ b/test/sql/test_types.py
@@ -16,7 +16,7 @@ from sqlalchemy.sql import visitors
from sqlalchemy import inspection
from sqlalchemy import exc, types, util, dialects
from sqlalchemy.util import OrderedDict
-for name in dialects.__all__:
+for name in dialects.__all__: # noqa
__import__("sqlalchemy.dialects.%s" % name)
from sqlalchemy.sql import operators, column, table, null
from sqlalchemy.schema import CheckConstraint, AddConstraint
@@ -31,8 +31,6 @@ from sqlalchemy.testing import fixtures
from sqlalchemy.testing import mock
-
-
class AdaptTest(fixtures.TestBase):
def _all_dialect_modules(self):
@@ -305,14 +303,14 @@ class UserDefinedTest(fixtures.TablesTest, AssertsCompiledSQL):
user_id=4, goofy='fred', goofy2='fred', goofy4=util.u('fred'),
goofy7=util.u('fred'), goofy8=9, goofy9=9)
- l = users.select().order_by(users.c.user_id).execute().fetchall()
+ result = users.select().order_by(users.c.user_id).execute().fetchall()
for assertstr, assertint, assertint2, row in zip(
[
"BIND_INjackBIND_OUT", "BIND_INlalaBIND_OUT",
"BIND_INfredBIND_OUT"],
[1200, 1500, 900],
[1800, 2250, 1350],
- l
+ result
):
for col in list(row)[1:5]:
eq_(col, assertstr)
@@ -890,7 +888,6 @@ class TypeCoerceCastTest(fixtures.TablesTest):
[('BIND_INd1BIND_OUT', )])
-
class VariantTest(fixtures.TestBase, AssertsCompiledSQL):
def setup(self):
@@ -1120,9 +1117,9 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest):
Column("id", Integer, primary_key=True),
Column('someenum', Enum('one', 'two', 'three', native_enum=False)),
Column('someotherenum',
- Enum('one', 'two', 'three',
- create_constraint=False, native_enum=False,
- validate_strings=True)),
+ Enum('one', 'two', 'three',
+ create_constraint=False, native_enum=False,
+ validate_strings=True)),
)
Table(
@@ -1318,7 +1315,6 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest):
non_native_enum_table.insert(), {"id": 1, "someenum": None})
eq_(conn.scalar(select([non_native_enum_table.c.someenum])), None)
-
@testing.fails_on(
'mysql',
"The CHECK clause is parsed but ignored by all storage engines.")
@@ -1466,6 +1462,7 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest):
"Enum('x', 'y', name='somename', "
"inherit_schema=True, native_enum=False)")
+
binary_table = MyPickleType = metadata = None
@@ -1536,14 +1533,14 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults):
'data': LargeBinary, 'data_slice': LargeBinary},
bind=testing.db)
):
- l = stmt.execute().fetchall()
- eq_(stream1, l[0]['data'])
- eq_(stream1[0:100], l[0]['data_slice'])
- eq_(stream2, l[1]['data'])
- eq_(testobj1, l[0]['pickled'])
- eq_(testobj2, l[1]['pickled'])
- eq_(testobj3.moredata, l[0]['mypickle'].moredata)
- eq_(l[0]['mypickle'].stuff, 'this is the right stuff')
+ result = stmt.execute().fetchall()
+ eq_(stream1, result[0]['data'])
+ eq_(stream1[0:100], result[0]['data_slice'])
+ eq_(stream2, result[1]['data'])
+ eq_(testobj1, result[0]['pickled'])
+ eq_(testobj2, result[1]['pickled'])
+ eq_(testobj3.moredata, result[0]['mypickle'].moredata)
+ eq_(result[0]['mypickle'].stuff, 'this is the right stuff')
@testing.requires.binary_comparisons
def test_comparison(self):
@@ -1721,6 +1718,7 @@ class JSONTest(fixtures.TestBase):
bindproc = expr.right.type._cached_literal_processor(non_str_dialect)
eq_(bindproc(expr.right.value), "'five'")
+
class ArrayTest(fixtures.TestBase):
def _myarray_fixture(self):
@@ -1987,7 +1985,6 @@ class ExpressionTest(
tab = table('test', column('bvalue', MyTypeDec))
expr = tab.c.bvalue + 6
-
self.assert_compile(
expr,
"test.bvalue || :bvalue_1",
@@ -2036,7 +2033,7 @@ class ExpressionTest(
# untyped bind - it gets assigned MyFoobarType
bp = bindparam("foo")
expr = column("foo", MyFoobarType) + bp
- assert bp.type._type_affinity is types.NullType
+ assert bp.type._type_affinity is types.NullType # noqa
assert expr.right.type._type_affinity is MyFoobarType
expr = column("foo", MyFoobarType) + bindparam("foo", type_=Integer)
@@ -2135,7 +2132,6 @@ class ExpressionTest(
)
-
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = 'default'
@@ -2296,6 +2292,7 @@ class NumericRawSQLTest(fixtures.TestBase):
else:
eq_(val, 46.583)
+
interval_table = metadata = None
@@ -2443,7 +2440,8 @@ class BooleanTest(
boolean_table = self.tables.boolean_table
with testing.db.connect() as conn:
conn.execute(
- "insert into boolean_table (id, unconstrained_value) values (1, 5)"
+ "insert into boolean_table (id, unconstrained_value) "
+ "values (1, 5)"
)
eq_(
@@ -2456,6 +2454,7 @@ class BooleanTest(
True
)
+
class PickleTest(fixtures.TestBase):
def test_eq_comparison(self):
@@ -2483,6 +2482,7 @@ class PickleTest(fixtures.TestBase):
):
assert p1.compare_values(p1.copy_value(obj), obj)
+
meta = None
diff --git a/test/sql/test_update.py b/test/sql/test_update.py
index 033f2f680..71ac82ce0 100644
--- a/test/sql/test_update.py
+++ b/test/sql/test_update.py
@@ -51,7 +51,7 @@ class _UpdateFromTestBase(object):
(9, 'fred'),
(10, 'chuck')
),
- addresses = (
+ addresses=(
('id', 'user_id', 'name', 'email_address'),
(1, 7, 'x', 'jack@bean.com'),
(2, 8, 'x', 'ed@wood.com'),
@@ -59,7 +59,7 @@ class _UpdateFromTestBase(object):
(4, 8, 'x', 'ed@lala.com'),
(5, 9, 'x', 'fred@fred.com')
),
- dingalings = (
+ dingalings=(
('id', 'address_id', 'data'),
(1, 2, 'ding 1/2'),
(2, 5, 'ding 2/5')
@@ -340,13 +340,14 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL):
def test_where_empty(self):
table1 = self.tables.mytable
self.assert_compile(
- table1.update().where(
- and_()),
- "UPDATE mytable SET myid=:myid, name=:name, description=:description")
+ table1.update().where(and_()),
+ "UPDATE mytable SET myid=:myid, name=:name, "
+ "description=:description")
self.assert_compile(
table1.update().where(
or_()),
- "UPDATE mytable SET myid=:myid, name=:name, description=:description")
+ "UPDATE mytable SET myid=:myid, name=:name, "
+ "description=:description")
def test_prefix_with(self):
table1 = self.tables.mytable
diff --git a/test/sql/test_utils.py b/test/sql/test_utils.py
index 5e54cf734..84e7ad732 100644
--- a/test/sql/test_utils.py
+++ b/test/sql/test_utils.py
@@ -82,8 +82,9 @@ class CompareClausesTest(fixtures.TestBase):
b3 = bindparam("bar", type_=Integer())
b4 = bindparam("foo", type_=String())
- c1 = lambda: 5 # noqa
- c2 = lambda: 6 # noqa
+ def c1(): return 5
+
+ def c2(): return 6
b5 = bindparam("foo", type_=Integer(), callable_=c1)
b6 = bindparam("foo", type_=Integer(), callable_=c2)