]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add test_match_expression_supports_bindparam
authorAnton Kovalevich <kai3341@gmail.com>
Tue, 5 Oct 2021 21:20:25 +0000 (00:20 +0300)
committerAnton Kovalevich <kai3341@gmail.com>
Tue, 5 Oct 2021 21:20:25 +0000 (00:20 +0300)
test/dialect/mysql/test_compiler.py

index 169d46ed245d1f127500e7a1620c4e9a1e59e31b..46e29ce8c0f5f9cd0fb84bdb5440f573e3459bac 100644 (file)
@@ -53,7 +53,7 @@ from sqlalchemy.dialects.mysql import insert
 from sqlalchemy.dialects.mysql import match
 from sqlalchemy.sql import column
 from sqlalchemy.sql import table
-from sqlalchemy.sql.expression import literal_column
+from sqlalchemy.sql.expression import bindparam, literal_column
 from sqlalchemy.testing import assert_raises_message
 from sqlalchemy.testing import AssertsCompiledSQL
 from sqlalchemy.testing import eq_
@@ -1283,6 +1283,16 @@ class MatchExpressionTest(fixtures.TestBase, AssertsCompiledSQL):
         expr = case(expr)
         self.assert_compile(expr, expected)
 
+    def test_match_expression_supports_bindparam(self):
+        firstname = self.match_table.c.firstname
+        lastname = self.match_table.c.lastname
+        against = bindparam('against', required=True)
+
+        expr = match(firstname, lastname, against=against)
+
+        expected = "MATCH (user.firstname, user.lastname) AGAINST (%s)"
+        self.assert_compile(expr, expected)
+
     def test_cols_required(self):
         assert_raises_message(
             exc.ArgumentError,