]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix some tests
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Feb 2011 04:37:15 +0000 (23:37 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Feb 2011 04:37:15 +0000 (23:37 -0500)
test/dialect/test_postgresql.py
test/engine/test_bind.py

index 5d67e19216a8e2eb9cd37d1f5deeb36e2d1f45aa..424e8b5d9c462e5153899dd679b2b8ed1f69128f 100644 (file)
@@ -2094,14 +2094,16 @@ class MatchTest(TestBase, AssertsCompiledSQL):
     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)')
+                            'matchtable.title @@ to_tsquery(%s)',
+                            dialect=postgresql.dialect())
 
     def test_simple_match(self):
         results = \
index 855c3611e94b0b7c493a5ee636b310aabde80602..0ef70c2448171885a1ad1f579b82c96a51899373 100644 (file)
@@ -1,7 +1,7 @@
 """tests the "bind" attribute/argument across schema and SQL,
 including the deprecated versions of these arguments"""
 
-from test.lib.testing import eq_
+from test.lib.testing import eq_, assert_raises
 from sqlalchemy import engine, exc
 from sqlalchemy import MetaData, ThreadLocalMetaData
 from sqlalchemy import Integer, text
@@ -177,19 +177,12 @@ class BindTest(testing.TestBase):
                         if isinstance(bind, engine.Connection):
                             bind.close()
 
-                try:
-                    e = elem()
-                    assert e.bind is None
-                    e.execute()
-                    assert False
-                except exc.UnboundExecutionError, e:
-                    assert str(e).endswith('is not bound and does not '
-                            'support direct execution. Supply this '
-                            'statement to a Connection or Engine for '
-                            'execution. Or, assign a bind to the '
-                            'statement or the Metadata of its '
-                            'underlying tables to enable implicit '
-                            'execution via this method.')
+                e = elem()
+                assert e.bind is None
+                assert_raises(
+                    exc.UnboundExecutionError,
+                    e.execute
+                )
         finally:
             if isinstance(bind, engine.Connection):
                 bind.close()