diff options
author | John Passaro <john.a.passaro@gmail.com> | 2016-09-19 15:43:46 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-09-19 17:17:07 -0400 |
commit | 2c4119d1eb9e231676bf4facedf46849970b8253 (patch) | |
tree | afadbb6920ecf219965713dc27b0202e83ec3989 /test/sql/test_operators.py | |
parent | 881369b949cff44e0017fdc28d9722ef3c26171a (diff) | |
download | sqlalchemy-2c4119d1eb9e231676bf4facedf46849970b8253.tar.gz |
Exclude eq and ne from associative operators
The "eq" and "ne" operators are no longer part of the list of
"associative" operators, while they remain considered to be
"commutative". This allows an expression like ``(x == y) == z``
to be maintained at the SQL level with parenthesis. Pull request
courtesy John Passaro.
Fixes: #3799
Change-Id: I3759d8987b35649d7418b6524316c9e70c857e68
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/308
Diffstat (limited to 'test/sql/test_operators.py')
-rw-r--r-- | test/sql/test_operators.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index b6e80de4b..99f8a10ca 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -1538,6 +1538,14 @@ class OperatorAssociativityTest(fixtures.TestBase, testing.AssertsCompiledSQL): f = column('f') self.assert_compile(f / (f / (f - f)), "f / (f / (f - f))") + def test_associativity_22(self): + f = column('f') + self.assert_compile((f==f) == f, '(f = f) = f') + + def test_associativity_23(self): + f = column('f') + self.assert_compile((f!=f) != f, '(f != f) != f') + class IsDistinctFromTest(fixtures.TestBase, testing.AssertsCompiledSQL): __dialect__ = 'default' |