]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add precedence test for NOT
authorjazzthief <mynameisyegor@gmail.com>
Thu, 19 Jan 2023 17:05:56 +0000 (18:05 +0100)
committerjazzthief <mynameisyegor@gmail.com>
Thu, 19 Jan 2023 17:05:56 +0000 (18:05 +0100)
test/sql/test_operators.py

index 3424f3ab3f533ccc9733db4635e750a5d6cf725d..b426aba8a41200682248c0e12b228d7ae1884d9d 100644 (file)
@@ -1768,6 +1768,15 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         self.assert_compile(op2, "mytable.myid hoho :myid_1 lala :param_1")
         self.assert_compile(op3, "(mytable.myid hoho :myid_1) lala :param_1")
 
+    def test_bitwise_not_precedence(self):
+        op1 = operators.bitwise_not_op
+        c = self.table1.c.myid
+        op2 = op1(c).op("lala", precedence=6)(4)
+        op3 = op1(c).op("lala", precedence=8)(4)
+
+        self.assert_compile(op2, "~mytable.myid lala :param_1")
+        self.assert_compile(op3, "(~mytable.myid) lala :param_1")
+
     @testing.combinations(
         ("xor", operators.bitwise_xor_op, "^"),
         ("or", operators.bitwise_or_op, "|"),