summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/suite/test_deprecations.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-09-02 23:46:06 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2020-09-08 17:13:48 -0400
commite8600608669d90c4a6385b312d271aed63eb5854 (patch)
treeef984a01c536b2c81d2283b3ca5d9f4395f41dd0 /lib/sqlalchemy/testing/suite/test_deprecations.py
parent0d56a62f721ee6c91d8a8b6a407b959c9215b3b6 (diff)
downloadsqlalchemy-e8600608669d90c4a6385b312d271aed63eb5854.tar.gz
Update select usage to use the new 1.4 format
This change includes mainly that the bracketed use within select() is moved to positional, and keyword arguments are removed from calls to the select() function. it does not yet fully address other issues such as keyword arguments passed to the table.select(). Additionally, allows False / None to both be considered as "disable" for all of select.correlate(), select.correlate_except(), query.correlate(), which establishes consistency with passing of ``False`` for the legact select(correlate=False) argument. Change-Id: Ie6c6e6abfbd3d75d4c8de504c0cf0159e6999108
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_deprecations.py')
-rw-r--r--lib/sqlalchemy/testing/suite/test_deprecations.py34
1 files changed, 12 insertions, 22 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_deprecations.py b/lib/sqlalchemy/testing/suite/test_deprecations.py
index 8c25616a8..b36162fa5 100644
--- a/lib/sqlalchemy/testing/suite/test_deprecations.py
+++ b/lib/sqlalchemy/testing/suite/test_deprecations.py
@@ -38,8 +38,8 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
def test_plain_union(self, connection):
table = self.tables.some_table
- s1 = select([table]).where(table.c.id == 2)
- s2 = select([table]).where(table.c.id == 3)
+ s1 = select(table).where(table.c.id == 2)
+ s2 = select(table).where(table.c.id == 3)
u1 = union(s1, s2)
with testing.expect_deprecated(
@@ -59,8 +59,8 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
# it before.
def _dont_test_select_from_plain_union(self, connection):
table = self.tables.some_table
- s1 = select([table]).where(table.c.id == 2)
- s2 = select([table]).where(table.c.id == 3)
+ s1 = select(table).where(table.c.id == 2)
+ s2 = select(table).where(table.c.id == 3)
u1 = union(s1, s2).alias().select()
with testing.expect_deprecated(
@@ -75,18 +75,8 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
@testing.requires.parens_in_union_contained_select_w_limit_offset
def test_limit_offset_selectable_in_unions(self, connection):
table = self.tables.some_table
- s1 = (
- select([table])
- .where(table.c.id == 2)
- .limit(1)
- .order_by(table.c.id)
- )
- s2 = (
- select([table])
- .where(table.c.id == 3)
- .limit(1)
- .order_by(table.c.id)
- )
+ s1 = select(table).where(table.c.id == 2).limit(1).order_by(table.c.id)
+ s2 = select(table).where(table.c.id == 3).limit(1).order_by(table.c.id)
u1 = union(s1, s2).limit(2)
with testing.expect_deprecated(
@@ -100,8 +90,8 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
@testing.requires.parens_in_union_contained_select_wo_limit_offset
def test_order_by_selectable_in_unions(self, connection):
table = self.tables.some_table
- s1 = select([table]).where(table.c.id == 2).order_by(table.c.id)
- s2 = select([table]).where(table.c.id == 3).order_by(table.c.id)
+ s1 = select(table).where(table.c.id == 2).order_by(table.c.id)
+ s2 = select(table).where(table.c.id == 3).order_by(table.c.id)
u1 = union(s1, s2).limit(2)
with testing.expect_deprecated(
@@ -114,8 +104,8 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
def test_distinct_selectable_in_unions(self, connection):
table = self.tables.some_table
- s1 = select([table]).where(table.c.id == 2).distinct()
- s2 = select([table]).where(table.c.id == 3).distinct()
+ s1 = select(table).where(table.c.id == 2).distinct()
+ s2 = select(table).where(table.c.id == 3).distinct()
u1 = union(s1, s2).limit(2)
with testing.expect_deprecated(
@@ -129,7 +119,7 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
def test_limit_offset_aliased_selectable_in_unions(self, connection):
table = self.tables.some_table
s1 = (
- select([table])
+ select(table)
.where(table.c.id == 2)
.limit(1)
.order_by(table.c.id)
@@ -137,7 +127,7 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
.select()
)
s2 = (
- select([table])
+ select(table)
.where(table.c.id == 3)
.limit(1)
.order_by(table.c.id)