summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_compiler.py35
-rw-r--r--test/dialect/postgresql/test_dialect.py4
-rw-r--r--test/dialect/postgresql/test_on_conflict.py1
-rw-r--r--test/dialect/postgresql/test_reflection.py4
-rw-r--r--test/dialect/postgresql/test_types.py23
5 files changed, 38 insertions, 29 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index 160641855..eddf20877 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -17,6 +17,7 @@ from sqlalchemy.sql import util as sql_util
from sqlalchemy.util import u, OrderedDict
from sqlalchemy.dialects.postgresql import aggregate_order_by, insert
+
class SequenceTest(fixtures.TestBase, AssertsCompiledSQL):
__prefer__ = 'postgresql'
@@ -414,9 +415,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
m = MetaData()
tbl = Table('testtbl', m, Column('data', String))
- idx1 = Index('test_idx1', tbl.c.data)
- idx2 = Index('test_idx2', tbl.c.data, postgresql_tablespace='sometablespace')
- idx3 = Index('test_idx3', tbl.c.data, postgresql_tablespace='another table space')
+ idx1 = Index('test_idx1',
+ tbl.c.data)
+ idx2 = Index('test_idx2',
+ tbl.c.data,
+ postgresql_tablespace='sometablespace')
+ idx3 = Index('test_idx3',
+ tbl.c.data,
+ postgresql_tablespace='another table space')
self.assert_compile(schema.CreateIndex(idx1),
'CREATE INDEX test_idx1 ON testtbl '
@@ -437,13 +443,12 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
m = MetaData()
tbl = Table('testtbl', m, Column('data', String))
- idx1 = Index(
- 'test_idx1',
- tbl.c.data,
- postgresql_using='btree',
- postgresql_tablespace='atablespace',
- postgresql_with={"fillfactor": 60},
- postgresql_where=and_(tbl.c.data > 5, tbl.c.data < 10))
+ idx1 = Index('test_idx1',
+ tbl.c.data,
+ postgresql_using='btree',
+ postgresql_tablespace='atablespace',
+ postgresql_with={"fillfactor": 60},
+ postgresql_where=and_(tbl.c.data > 5, tbl.c.data < 10))
self.assert_compile(schema.CreateIndex(idx1),
'CREATE INDEX test_idx1 ON testtbl '
@@ -928,8 +933,11 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
postgresql.array([1, 2]) == [3, 4, 5],
"ARRAY[%(param_1)s, %(param_2)s] = "
"ARRAY[%(param_3)s, %(param_4)s, %(param_5)s]",
- checkparams={'param_5': 5, 'param_4': 4, 'param_1': 1,
- 'param_3': 3, 'param_2': 2}
+ checkparams={'param_5': 5,
+ 'param_4': 4,
+ 'param_1': 1,
+ 'param_3': 3,
+ 'param_2': 2}
)
@@ -1053,7 +1061,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
stmt2 = sql_util.ClauseAdapter(a1).traverse(stmt)
self.assert_compile(
stmt2,
- "SELECT array_agg(foo.a ORDER BY foo.b DESC) AS array_agg_1 FROM table1 AS foo"
+ "SELECT array_agg(foo.a ORDER BY foo.b DESC) AS array_agg_1 "
+ "FROM table1 AS foo"
)
diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py
index 9f7af8638..ba68faf16 100644
--- a/test/dialect/postgresql/test_dialect.py
+++ b/test/dialect/postgresql/test_dialect.py
@@ -236,8 +236,8 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
r = t.insert().execute(user_name='user',
user_password='lala')
assert r.inserted_primary_key == [1]
- l = t.select().execute().fetchall()
- assert l == [(1, 'user', 'lala')]
+ result = t.select().execute().fetchall()
+ assert result == [(1, 'user', 'lala')]
finally:
testing.db.execute('drop table speedy_users')
diff --git a/test/dialect/postgresql/test_on_conflict.py b/test/dialect/postgresql/test_on_conflict.py
index 0e1dea06a..7c83f2826 100644
--- a/test/dialect/postgresql/test_on_conflict.py
+++ b/test/dialect/postgresql/test_on_conflict.py
@@ -511,4 +511,3 @@ class OnConflictTest(fixtures.TablesTest):
conn.scalar(sql.select([bind_targets.c.data])),
"new updated data processed"
)
-
diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py
index 5f9e6df9a..1d5648e57 100644
--- a/test/dialect/postgresql/test_reflection.py
+++ b/test/dialect/postgresql/test_reflection.py
@@ -706,8 +706,8 @@ class ReflectionTest(fixtures.TestBase):
tmp.sort()
r1, r2 = [idx[1] for idx in tmp]
assert r1.name == 'idx2'
- assert r1.unique == True
- assert r2.unique == False
+ assert r1.unique is True
+ assert r2.unique is False
assert [t2.c.id] == r1.columns
assert [t2.c.name] == r2.columns
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index c4106c68e..ddc121a8b 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -548,7 +548,7 @@ class NumericInterpretationTest(fixtures.TestBase):
psycopg2, psycopg2cffi, base
dialects = (pg8000.dialect(), pygresql.dialect(),
- psycopg2.dialect(), psycopg2cffi.dialect())
+ psycopg2.dialect(), psycopg2cffi.dialect())
for dialect in dialects:
typ = Numeric().dialect_impl(dialect)
for code in base._INT_TYPES + base._FLOAT_TYPES + \
@@ -1089,10 +1089,11 @@ class ArrayRoundTripTest(fixtures.TablesTest, AssertsExecutionResults):
def test_array_comparison(self):
arrtable = self.tables.arrtable
arrtable.insert().execute(id=5, intarr=[1, 2, 3],
- strarr=[util.u('abc'), util.u('def')])
- results = select([arrtable.c.id]).\
- where(arrtable.c.intarr < [4, 5, 6]).execute()\
- .fetchall()
+ strarr=[util.u('abc'), util.u('def')])
+ results = select([arrtable.c.id])\
+ .where(arrtable.c.intarr < [4, 5, 6])\
+ .execute()\
+ .fetchall()
eq_(len(results), 1)
eq_(results[0][0], 5)
@@ -1819,7 +1820,7 @@ class HStoreTest(AssertsCompiledSQL, fixtures.TestBase):
def test_where_getitem(self):
self._test_where(
- self.hashcol['bar'] == None,
+ self.hashcol['bar'] == None, # noqa
"(test_table.hash -> %(hash_1)s) IS NULL"
)
@@ -1908,7 +1909,7 @@ class HStoreTest(AssertsCompiledSQL, fixtures.TestBase):
def test_cols_against_is(self):
self._test_cols(
- self.hashcol['foo'] != None,
+ self.hashcol['foo'] != None, # noqa
"(test_table.hash -> %(hash_1)s) IS NOT NULL AS anon_1"
)
@@ -2445,13 +2446,13 @@ class JSONTest(AssertsCompiledSQL, fixtures.TestBase):
# do anything
def test_where_getitem(self):
self._test_where(
- self.jsoncol['bar'] == None,
+ self.jsoncol['bar'] == None, # noqa
"(test_table.test_column -> %(test_column_1)s) IS NULL"
)
def test_where_path(self):
self._test_where(
- self.jsoncol[("foo", 1)] == None,
+ self.jsoncol[("foo", 1)] == None, # noqa
"(test_table.test_column #> %(test_column_1)s) IS NULL"
)
@@ -2490,7 +2491,7 @@ class JSONTest(AssertsCompiledSQL, fixtures.TestBase):
def test_where_getitem_as_text(self):
self._test_where(
- self.jsoncol['bar'].astext == None,
+ self.jsoncol['bar'].astext == None, # noqa
"(test_table.test_column ->> %(test_column_1)s) IS NULL"
)
@@ -2510,7 +2511,7 @@ class JSONTest(AssertsCompiledSQL, fixtures.TestBase):
def test_where_path_as_text(self):
self._test_where(
- self.jsoncol[("foo", 1)].astext == None,
+ self.jsoncol[("foo", 1)].astext == None, # noqa
"(test_table.test_column #>> %(test_column_1)s) IS NULL"
)