From 27ec4929198807702190b96d3c00d0291976f49e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 20 Jul 2021 11:03:08 -0400 Subject: dont warn for dictionary passed positionally Fixed issue where use of the :paramref:`_sql.case.whens` parameter passing a dictionary positionally and not as a keyword argument would emit a 2.0 deprecation warning, referring to the deprecation of passing a list positionally. The dictionary format of "whens", passed positionally, is still supported and was accidentally marked as deprecated. Removes warning filter for case statement. Fixes: #6786 Change-Id: I8efd1882563773bec89ae5e34f0dfede77fc4683 --- lib/sqlalchemy/testing/suite/test_select.py | 20 ++++++++------------ lib/sqlalchemy/testing/suite/test_types.py | 10 ++++------ lib/sqlalchemy/testing/warnings.py | 1 - 3 files changed, 12 insertions(+), 19 deletions(-) (limited to 'lib/sqlalchemy/testing') diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index 0a1227e58..c96c62a45 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -1259,12 +1259,10 @@ class ExpandingBoundInTest(fixtures.TablesTest): def test_null_in_empty_set_is_false_bindparam(self, connection): stmt = select( case( - [ - ( - null().in_(bindparam("foo", value=())), - true(), - ) - ], + ( + null().in_(bindparam("foo", value=())), + true(), + ), else_=false(), ) ) @@ -1273,12 +1271,10 @@ class ExpandingBoundInTest(fixtures.TablesTest): def test_null_in_empty_set_is_false_direct(self, connection): stmt = select( case( - [ - ( - null().in_([]), - true(), - ) - ], + ( + null().in_([]), + true(), + ), else_=false(), ) ) diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index f793ff529..d367e7dc3 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -362,12 +362,10 @@ class _DateFixture(_LiteralRoundTripFixture, fixtures.TestBase): id_ = result.inserted_primary_key[0] stmt = select(date_table.c.id).where( case( - [ - ( - bindparam("foo", type_=self.datatype) != None, - bindparam("foo", type_=self.datatype), - ) - ], + ( + bindparam("foo", type_=self.datatype) != None, + bindparam("foo", type_=self.datatype), + ), else_=date_table.c.date_data, ) == date_table.c.date_data diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py index f8d6296a0..af5ad184f 100644 --- a/lib/sqlalchemy/testing/warnings.py +++ b/lib/sqlalchemy/testing/warnings.py @@ -74,7 +74,6 @@ def setup_filters(): "arguments in version 2.0", r"The Join.select\(\) method will no longer accept keyword arguments " "in version 2.0.", - r"The \"whens\" argument to case\(\) is now passed", r"The Join.select\(\).whereclause parameter is deprecated", # # DML -- cgit v1.2.1