diff options
author | Tony Locke <tlocke@tlocke.org.uk> | 2014-06-23 20:45:16 +0100 |
---|---|---|
committer | Tony Locke <tlocke@tlocke.org.uk> | 2014-06-23 20:45:16 +0100 |
commit | a88169c501411b1b5ad2975b9e96cdc864bab7f1 (patch) | |
tree | 43ee474fdeb467ef72c3042991fbace7db7dd207 | |
parent | ea54b635d66bc695c5149ede5279cc6ee2f43e7c (diff) | |
download | sqlalchemy-a88169c501411b1b5ad2975b9e96cdc864bab7f1.tar.gz |
pg8000 passing test/sql/test_types.py
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.
-rw-r--r-- | test/sql/test_types.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 19be4466d..17600a32d 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -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): |