]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
pg8000 passing test/sql/test_types.py
authorTony Locke <tlocke@tlocke.org.uk>
Mon, 23 Jun 2014 19:45:16 +0000 (20:45 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 6 Jul 2014 21:10:44 +0000 (17:10 -0400)
Opened up two tests that now pass with pg8000. Also, rewrote two tests
to use actual tables rather than having a round trip in a single select
statement. This is necessary for pg8000 because it sends strings to the
server with type 'unknown' and lets the server work out the type.

test/sql/test_types.py

index 19be4466d9efb94b91282982d12b3d0a083f4bb7..17600a32d68eb1617c61d18e5bb12aa5c55ce196 100644 (file)
@@ -576,10 +576,12 @@ class TypeCoerceCastTest(fixtures.TablesTest):
             def __str__(self):
                 return "THISISMYOBJ"
 
+        t = self.tables.t
+
+        t.insert().values(data=coerce_fn(MyObj(), MyType)).execute()
+
         eq_(
-            testing.db.execute(
-                select([coerce_fn(MyObj(), MyType)])
-            ).fetchall(),
+            select([coerce_fn(t.c.data, MyType)]).execute().fetchall(),
             [('BIND_INTHISISMYOBJBIND_OUT',)]
         )
 
@@ -723,16 +725,16 @@ class TypeCoerceCastTest(fixtures.TablesTest):
     def test_type_coerce_existing_typed(self):
         MyType = self.MyType
         coerce_fn = type_coerce
+        t = self.tables.t
+
         # type_coerce does upgrade the given expression to the
         # given type.
-        eq_(
-            testing.db.scalar(
-                select([coerce_fn(literal('d1'), MyType)])
-            ),
-            'BIND_INd1BIND_OUT'
-        )
 
+        t.insert().values(data=coerce_fn(literal('d1'), MyType)).execute()
 
+        eq_(
+            select([coerce_fn(t.c.data, MyType)]).execute().fetchall(),
+            [('BIND_INd1BIND_OUT', )])
 
 class VariantTest(fixtures.TestBase, AssertsCompiledSQL):
     def setup(self):
@@ -983,9 +985,6 @@ class EnumTest(AssertsCompiledSQL, fixtures.TestBase):
     @testing.fails_on('postgresql+zxjdbc',
                         'zxjdbc fails on ENUM: column "XXX" is of type XXX '
                         'but expression is of type character varying')
-    @testing.fails_on('postgresql+pg8000',
-                        'zxjdbc fails on ENUM: column "XXX" is of type XXX '
-                        'but expression is of type text')
     def test_round_trip(self):
         enum_table.insert().execute([
             {'id': 1, 'someenum': 'two'},
@@ -1669,7 +1668,6 @@ class IntervalTest(fixtures.TestBase, AssertsExecutionResults):
         assert adapted.native is False
         eq_(str(adapted), "DATETIME")
 
-    @testing.fails_on("+pg8000", "Not yet known how to pass values of the INTERVAL type")
     @testing.fails_on("postgresql+zxjdbc", "Not yet known how to pass values of the INTERVAL type")
     @testing.fails_on("oracle+zxjdbc", "Not yet known how to pass values of the INTERVAL type")
     def test_roundtrip(self):