summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authorКатаев Денис <bteamko@gmail.com>2017-03-17 14:19:21 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-03-17 14:19:21 -0400
commit8f7cf2990f9010ea4924f2525318dff0ba1028d7 (patch)
tree3e0e4b44d8c4d5c8ae8e63b9ff5842770ec23515 /lib/sqlalchemy/testing
parentd96fc5d02a921820aa5973daf66445c880ca6cd4 (diff)
downloadsqlalchemy-8f7cf2990f9010ea4924f2525318dff0ba1028d7.tar.gz
New features from python 2.7
After bump minimum supported version to 2.7 (1da9d3752160430c91534a8868ceb8c5ad1451d4), we can use new syntax. Change-Id: Ib064c75a00562e641d132f9c57e5e69744200e05 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/347
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/assertions.py6
-rw-r--r--lib/sqlalchemy/testing/provision.py2
-rw-r--r--lib/sqlalchemy/testing/schema.py6
-rw-r--r--lib/sqlalchemy/testing/suite/test_reflection.py2
-rw-r--r--lib/sqlalchemy/testing/suite/test_types.py2
-rw-r--r--lib/sqlalchemy/testing/util.py2
6 files changed, 9 insertions, 11 deletions
diff --git a/lib/sqlalchemy/testing/assertions.py b/lib/sqlalchemy/testing/assertions.py
index 44551bd86..c8525f2f6 100644
--- a/lib/sqlalchemy/testing/assertions.py
+++ b/lib/sqlalchemy/testing/assertions.py
@@ -384,8 +384,8 @@ class ComparesTables(object):
eq_(c.type.length, reflected_c.type.length)
eq_(
- set([f.column.name for f in c.foreign_keys]),
- set([f.column.name for f in reflected_c.foreign_keys])
+ {f.column.name for f in c.foreign_keys},
+ {f.column.name for f in reflected_c.foreign_keys}
)
if c.server_default:
assert isinstance(reflected_c.server_default,
@@ -440,7 +440,7 @@ class AssertsExecutionResults(object):
return id(self)
found = util.IdentitySet(result)
- expected = set([immutabledict(e) for e in expected])
+ expected = {immutabledict(e) for e in expected}
for wrong in util.itertools_filterfalse(lambda o:
isinstance(o, cls), found):
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py
index 7e4454465..83b6115fe 100644
--- a/lib/sqlalchemy/testing/provision.py
+++ b/lib/sqlalchemy/testing/provision.py
@@ -288,7 +288,7 @@ def reap_oracle_dbs(eng, idents_file):
"select u.username from all_users u where username "
"like 'TEST_%' and not exists (select username "
"from v$session where username=u.username)")
- all_names = set([username.lower() for (username, ) in to_reap])
+ all_names = {username.lower() for (username, ) in to_reap}
to_drop = set()
for name in all_names:
if name.endswith("_ts1") or name.endswith("_ts2"):
diff --git a/lib/sqlalchemy/testing/schema.py b/lib/sqlalchemy/testing/schema.py
index 018a291d9..f40654a2a 100644
--- a/lib/sqlalchemy/testing/schema.py
+++ b/lib/sqlalchemy/testing/schema.py
@@ -17,8 +17,7 @@ table_options = {}
def Table(*args, **kw):
"""A schema.Table wrapper/hook for dialect-specific tweaks."""
- test_opts = dict([(k, kw.pop(k)) for k in list(kw)
- if k.startswith('test_')])
+ test_opts = {k: kw.pop(k) for k in list(kw) if k.startswith('test_')}
kw.update(table_options)
@@ -64,8 +63,7 @@ def Table(*args, **kw):
def Column(*args, **kw):
"""A schema.Column wrapper/hook for dialect-specific tweaks."""
- test_opts = dict([(k, kw.pop(k)) for k in list(kw)
- if k.startswith('test_')])
+ test_opts = {k: kw.pop(k) for k in list(kw) if k.startswith('test_')}
if not config.requirements.foreign_key_ddl.enabled_for_config(config):
args = [arg for arg in args if not isinstance(arg, schema.ForeignKey)]
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py
index a761c0882..f47b34bf4 100644
--- a/lib/sqlalchemy/testing/suite/test_reflection.py
+++ b/lib/sqlalchemy/testing/suite/test_reflection.py
@@ -746,7 +746,7 @@ class ComponentReflectionTest(fixtures.TablesTest):
('dingalings', 'dingaling_id'),
]:
cols = insp.get_columns(tname)
- id_ = dict((c['name'], c) for c in cols)[cname]
+ id_ = {c['name']: c for c in cols}[cname]
assert id_.get('autoincrement', True)
diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py
index dbbe03111..ee757e1ca 100644
--- a/lib/sqlalchemy/testing/suite/test_types.py
+++ b/lib/sqlalchemy/testing/suite/test_types.py
@@ -340,7 +340,7 @@ class NumericTest(_LiteralRoundTripFixture, fixtures.TestBase):
t.create()
t.insert().execute([{'x': x} for x in input_])
- result = set([row[0] for row in t.select().execute()])
+ result = {row[0] for row in t.select().execute()}
output = set(output)
if filter_:
result = set(filter_(x) for x in result)
diff --git a/lib/sqlalchemy/testing/util.py b/lib/sqlalchemy/testing/util.py
index 8f91f31ed..a37637ac0 100644
--- a/lib/sqlalchemy/testing/util.py
+++ b/lib/sqlalchemy/testing/util.py
@@ -173,7 +173,7 @@ def rowset(results):
Useful for asserting the results of an unordered query.
"""
- return set([tuple(row) for row in results])
+ return {tuple(row) for row in results}
def fail(msg):