diff options
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 2 | ||||
-rw-r--r-- | test/sql/test_operators.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index bf470710d..142606680 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -917,7 +917,7 @@ def mirror(op): return _mirror.get(op, op) -_associative = _commutative.union([concat_op, and_, or_]) +_associative = _commutative.union([concat_op, and_, or_]).difference([eq, ne]) _natural_self_precedent = _associative.union([ getitem, json_getitem_op, json_path_getitem_op]) 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' |