def test_expression_pyformat(self):
self.assert_compile(matchtable.c.title.match('somstr'),
'matchtable.title @@ to_tsquery(%(title_1)s'
- ')',
- dialect=postgresql.dialect())
+ ')')
@testing.fails_on('postgresql+psycopg2', 'uses pyformat')
@testing.fails_on('postgresql+pypostgresql', 'uses pyformat')
@testing.fails_on('postgresql+zxjdbc', 'uses qmark')
def test_expression_positional(self):
self.assert_compile(matchtable.c.title.match('somstr'),
- 'matchtable.title @@ to_tsquery(%s)',
- dialect=postgresql.dialect())
+ 'matchtable.title @@ to_tsquery(%s)')
def test_simple_match(self):
results = \
class ReverseCasingReflectTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
@testing.requires.denormalized_names
def setup(self):
from test.lib import *
class UserDefinedTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def test_column(self):
class DefaultOnExistingTest(TestBase, AssertsCompiledSQL):
"""Test replacement of default compilation on existing constructs."""
+ __dialect__ = 'default'
def teardown(self):
for cls in (Select, _BindParamClause):
from test.lib.testing import TestBase, eq_, AssertsCompiledSQL
class PropertyComparatorTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def _fixture(self):
Base = declarative_base()
)
class PropertyExpressionTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def _fixture(self):
Base = declarative_base()
)
class PropertyValueTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def _fixture(self):
Base = declarative_base()
eq_(a1._value, 10)
class MethodExpressionTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def _fixture(self):
Base = declarative_base()
class AssertsCompiledSQL(object):
def assert_compile(self, clause, result, params=None,
checkparams=None, dialect=None,
- use_default_dialect=False):
+ use_default_dialect=False,
+ allow_dialect_select=False):
+
if use_default_dialect:
dialect = default.DefaultDialect()
-
- if dialect is None:
+ elif dialect == None and not allow_dialect_select:
dialect = getattr(self, '__dialect__', None)
+ if dialect == 'default':
+ dialect = default.DefaultDialect()
+ elif dialect is None:
+ dialect = db.dialect
kw = {}
if params is not None:
class CaseTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
@classmethod
def setup_class(cls):
)
class SelectTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def test_attribute_sanity(self):
assert hasattr(table1, 'c')
class CRUDTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
def test_insert(self):
# generic insert, will create bind params for all columns
self.assert_compile(insert(table1),
)
class InlineDefaultTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
def test_insert(self):
m = MetaData()
foo = Table('foo', m,
"col3=:col3")
class SchemaTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
def test_select(self):
self.assert_compile(table4.select(),
"SELECT remote_owner.remotetable.rem_id, remote_owner.remotetable.datatype_id,"
)
class ConstraintCompilationTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def _test_deferrable(self, constraint_factory):
t = Table('tbl', MetaData(),
class CompileTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
def test_compile(self):
for dialect in all_dialects(exclude=('sybase', 'access', 'informix', 'maxdb')):
class ClauseTest(TestBase, AssertsCompiledSQL):
"""test copy-in-place behavior of various ClauseElements."""
+ __dialect__ = 'default'
+
@classmethod
def setup_class(cls):
global t1, t2
'anon_1.col1')
class ClauseAdapterTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
@classmethod
def setup_class(cls):
global t1, t2
)
class SpliceJoinsTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
@classmethod
def setup_class(cls):
global table1, table2, table3, table4
class SelectTest(TestBase, AssertsCompiledSQL):
"""tests the generative capability of Select"""
+ __dialect__ = 'default'
+
@classmethod
def setup_class(cls):
global t1, t2
class InsertTest(TestBase, AssertsCompiledSQL):
"""Tests the generative capability of Insert"""
+ __dialect__ = 'default'
+
# fixme: consolidate converage from elsewhere here and expand
@classmethod
from test.lib import *
class QuoteTest(TestBase, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
@classmethod
def setup_class(cls):
# TODO: figure out which databases/which identifiers allow special
return open(f, mode='rb').read()
class ExpressionTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
+ __dialect__ = 'default'
+
@classmethod
def setup_class(cls):
global test_table, meta, MyCustomType, MyTypeDec
(INTEGER(), "INTEGER"),
(dialects.mysql.INTEGER(display_width=5), "INTEGER(5)")
):
- self.assert_compile(type_, expected)
+ self.assert_compile(type_, expected,
+ allow_dialect_select=True)
class DateTest(TestBase, AssertsExecutionResults):
@classmethod