summaryrefslogtreecommitdiff
path: root/test/sql/test_deprecations.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-09-10 12:46:21 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-09-11 01:57:47 -0400
commit3b85eeb5d2e662141139ad54ccaad5df24ad9b7d (patch)
tree55b1a571d91083fc55306c62dda20d6efd2b9ae7 /test/sql/test_deprecations.py
parent7afcb39a962d383e5ba04179c1b13131fb08a787 (diff)
downloadsqlalchemy-3b85eeb5d2e662141139ad54ccaad5df24ad9b7d.tar.gz
Restore subquery.as_scalar() w/ deprecation
Apparently Alias had an .as_scalar() method, so restore an equivalent to Subquery with an appropriate deprecation warning. Fixes: #4854 Change-Id: I6255d61b7d82487ca90ba8ee79d4b3a74e7cbe38
Diffstat (limited to 'test/sql/test_deprecations.py')
-rw-r--r--test/sql/test_deprecations.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py
index d126912a5..09deb1294 100644
--- a/test/sql/test_deprecations.py
+++ b/test/sql/test_deprecations.py
@@ -579,6 +579,15 @@ class SubqueryCoercionsTest(fixtures.TestBase, AssertsCompiledSQL):
is_true(stmt.compare(select([self.table1.c.myid]).scalar_subquery()))
+ def test_as_scalar_from_subquery(self):
+ with testing.expect_deprecated(
+ r"The Subquery.as_scalar\(\) method, which was previously "
+ r"``Alias.as_scalar\(\)`` prior to version 1.4"
+ ):
+ stmt = select([self.table1.c.myid]).subquery().as_scalar()
+
+ is_true(stmt.compare(select([self.table1.c.myid]).scalar_subquery()))
+
def test_fromclause_subquery(self):
stmt = select([self.table1.c.myid])
with testing.expect_deprecated(