diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-18 14:17:06 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-18 14:18:02 -0400 |
commit | 8bc793c4dbc876722dfaad0ca731938c70b54b6c (patch) | |
tree | 3c3ffd8f5df8b2dabaa4c24b2f924e4ed51338a9 /test/sql/test_operators.py | |
parent | 7277c12e4d1bdc9647b9b306d89b5847d1c5a4d7 (diff) | |
download | sqlalchemy-8bc793c4dbc876722dfaad0ca731938c70b54b6c.tar.gz |
Deliver straight BinaryExpr w/ no negate for any() / all()
Adjusted the :meth:`_types.ARRAY.Comparator.any` and
:meth:`_types.ARRAY.Comparator.all` methods to implement a straight "NOT"
operation for negation, rather than negating the comparison operator.
Fixes: #5518
Change-Id: I87ee9278c321aafe51a679fcfcbb5fbb11307fda
Diffstat (limited to 'test/sql/test_operators.py')
-rw-r--r-- | test/sql/test_operators.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index e5835a749..fcf40ebbd 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -3045,6 +3045,15 @@ class AnyAllTest(fixtures.TestBase, testing.AssertsCompiledSQL): checkparams={"param_1": 5}, ) + def test_any_array_comparator_negate_accessor(self, t_fixture): + t = t_fixture + + self.assert_compile( + ~t.c.arrval.any(5, operator.gt), + "NOT (:param_1 > ANY (tab1.arrval))", + checkparams={"param_1": 5}, + ) + def test_all_array_comparator_accessor(self, t_fixture): t = t_fixture @@ -3054,6 +3063,15 @@ class AnyAllTest(fixtures.TestBase, testing.AssertsCompiledSQL): checkparams={"param_1": 5}, ) + def test_all_array_comparator_negate_accessor(self, t_fixture): + t = t_fixture + + self.assert_compile( + ~t.c.arrval.all(5, operator.gt), + "NOT (:param_1 > ALL (tab1.arrval))", + checkparams={"param_1": 5}, + ) + def test_any_array_expression(self, t_fixture): t = t_fixture |