summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-08-09 18:53:06 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-08-09 18:53:06 +0000
commitcb8906bab1776bafed48ef69ded0768461f7e7b8 (patch)
treeda6e7112ed7c13e8c2d9314f797bd0a2d6495d31 /test/sql
parent5434e64b2f3b28609bece1e2b4d07a7afa431b13 (diff)
parentd49eef15bfb759fb33d7d23988cc5a385d9e8a40 (diff)
downloadsqlalchemy-cb8906bab1776bafed48ef69ded0768461f7e7b8.tar.gz
Merge "add columns_clause_froms and related use cases"
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_deprecations.py11
-rw-r--r--test/sql/test_selectable.py27
2 files changed, 37 insertions, 1 deletions
diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py
index 44135e373..9b74ab1fa 100644
--- a/test/sql/test_deprecations.py
+++ b/test/sql/test_deprecations.py
@@ -451,6 +451,17 @@ class SelectableTest(fixtures.TestBase, AssertsCompiledSQL):
"deprecated"
)
+ def test_froms_renamed(self):
+ t1 = table("t1", column("q"))
+
+ stmt = select(t1)
+
+ with testing.expect_deprecated(
+ r"The Select.froms attribute is moved to the "
+ r"Select.get_final_froms\(\) method."
+ ):
+ eq_(stmt.froms, [t1])
+
def test_select_list_argument(self):
with testing.expect_deprecated_20(
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py
index 5a94d4038..b76873490 100644
--- a/test/sql/test_selectable.py
+++ b/test/sql/test_selectable.py
@@ -1,5 +1,4 @@
"""Test various algorithmic properties of selectables."""
-
from sqlalchemy import and_
from sqlalchemy import bindparam
from sqlalchemy import Boolean
@@ -590,6 +589,32 @@ class SelectableTest(
"table1.col3, table1.colx FROM table1) AS anon_1",
)
+ @testing.combinations(
+ (
+ [table1.c.col1],
+ [table1.join(table2)],
+ [table1.join(table2)],
+ [table1],
+ ),
+ ([table1], [table2], [table1, table2], [table1]),
+ (
+ [table1.c.col1, table2.c.col1],
+ [],
+ [table1, table2],
+ [table1, table2],
+ ),
+ )
+ def test_froms_accessors(
+ self, cols_expr, select_from, exp_final_froms, exp_cc_froms
+ ):
+ """tests for #6808"""
+ s1 = select(*cols_expr).select_from(*select_from)
+
+ for ff, efp in util.zip_longest(s1.get_final_froms(), exp_final_froms):
+ assert ff.compare(efp)
+
+ eq_(s1.columns_clause_froms, exp_cc_froms)
+
def test_scalar_subquery_from_subq_same_source(self):
s1 = select(table1.c.col1)