From: Tony Locke Date: Mon, 23 Jun 2014 19:45:16 +0000 (+0100) Subject: pg8000 passing test/sql/test_types.py X-Git-Tag: rel_0_9_7~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d14c3f8f1d645f64de51de3f71172611389eeec2;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 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. --- diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 19be4466d9..17600a32d6 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):