mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-27 19:15:05 -04:00
- move out match compiler test to test_compiler
- test_query isn't assertscompiledsql
(cherry picked from commit 269313218d)
This commit is contained in:
@@ -184,6 +184,12 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
|
||||
schema.CreateTable(t2).compile, dialect=mysql.dialect()
|
||||
)
|
||||
|
||||
def test_match(self):
|
||||
matchtable = table('matchtable', column('title', String))
|
||||
self.assert_compile(
|
||||
matchtable.c.title.match('somstr'),
|
||||
"MATCH (matchtable.title) AGAINST (%s IN BOOLEAN MODE)")
|
||||
|
||||
def test_for_update(self):
|
||||
table1 = table('mytable',
|
||||
column('myid'), column('name'), column('description'))
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
from sqlalchemy.testing import eq_, is_
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
|
||||
from sqlalchemy.testing import fixtures
|
||||
from sqlalchemy import testing
|
||||
|
||||
|
||||
class IdiosyncrasyTest(fixtures.TestBase, AssertsCompiledSQL):
|
||||
class IdiosyncrasyTest(fixtures.TestBase):
|
||||
__only_on__ = 'mysql'
|
||||
__backend__ = True
|
||||
|
||||
@@ -28,7 +28,7 @@ class IdiosyncrasyTest(fixtures.TestBase, AssertsCompiledSQL):
|
||||
)
|
||||
|
||||
|
||||
class MatchTest(fixtures.TestBase, AssertsCompiledSQL):
|
||||
class MatchTest(fixtures.TestBase):
|
||||
__only_on__ = 'mysql'
|
||||
__backend__ = True
|
||||
|
||||
@@ -76,25 +76,6 @@ class MatchTest(fixtures.TestBase, AssertsCompiledSQL):
|
||||
def teardown_class(cls):
|
||||
metadata.drop_all()
|
||||
|
||||
@testing.fails_on('mysql+mysqlconnector', 'uses pyformat')
|
||||
def test_expression_format(self):
|
||||
format = testing.db.dialect.paramstyle == 'format' and '%s' or '?'
|
||||
self.assert_compile(
|
||||
matchtable.c.title.match('somstr'),
|
||||
"MATCH (matchtable.title) AGAINST (%s IN BOOLEAN MODE)" % format)
|
||||
|
||||
@testing.fails_on('mysql+mysqldb', 'uses format')
|
||||
@testing.fails_on('mysql+pymysql', 'uses format')
|
||||
@testing.fails_on('mysql+cymysql', 'uses format')
|
||||
@testing.fails_on('mysql+oursql', 'uses format')
|
||||
@testing.fails_on('mysql+pyodbc', 'uses format')
|
||||
@testing.fails_on('mysql+zxjdbc', 'uses format')
|
||||
def test_expression_pyformat(self):
|
||||
format = '%(title_1)s'
|
||||
self.assert_compile(
|
||||
matchtable.c.title.match('somstr'),
|
||||
"MATCH (matchtable.title) AGAINST (%s IN BOOLEAN MODE)" % format)
|
||||
|
||||
def test_simple_match(self):
|
||||
results = (matchtable.select().
|
||||
where(matchtable.c.title.match('python')).
|
||||
|
||||
Reference in New Issue
Block a user