summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-04-10 19:45:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-04-10 19:45:34 -0400
commitcf9cac34ac8df5613ef2d24884030df8aa749580 (patch)
treec96e90ee2283b64b4fa84c12729316c28caeb41c /test/dialect/test_postgresql.py
parent44c67fef8cc578ffbca409ad95e6471b4cb4d02a (diff)
parent36c05de373f9cbb198573704f2bc28fea8ca9113 (diff)
downloadsqlalchemy-cf9cac34ac8df5613ef2d24884030df8aa749580.tar.gz
merge default
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index fbe62cdec..14814bc20 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -228,7 +228,21 @@ class FloatCoercionTest(TablesTest, AssertsExecutionResults):
).scalar()
eq_(round_decimal(ret, 9), result)
-
+ @testing.provide_metadata
+ def test_arrays(self):
+ t1 = Table('t', metadata,
+ Column('x', postgresql.ARRAY(Float)),
+ Column('y', postgresql.ARRAY(postgresql.REAL)),
+ Column('z', postgresql.ARRAY(postgresql.DOUBLE_PRECISION)),
+ Column('q', postgresql.ARRAY(Numeric))
+ )
+ metadata.create_all()
+ t1.insert().execute(x=[5], y=[5], z=[6], q=[6.4])
+ row = t1.select().execute().first()
+ eq_(
+ row,
+ ([5], [5], [6], [decimal.Decimal("6.4")])
+ )
class EnumTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
__only_on__ = 'postgresql'
@@ -1311,8 +1325,18 @@ class MiscTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
else:
exception_cls = eng.dialect.dbapi.ProgrammingError
assert_raises(exception_cls, eng.execute, "show transaction isolation level")
-
-
+
+ @testing.fails_on('+zxjdbc',
+ "psycopg2/pg8000 specific assertion")
+ @testing.fails_on('pypostgresql',
+ "psycopg2/pg8000 specific assertion")
+ def test_numeric_raise(self):
+ stmt = text("select cast('hi' as char) as hi", typemap={'hi':Numeric})
+ assert_raises(
+ exc.InvalidRequestError,
+ testing.db.execute, stmt
+ )
+
class TimezoneTest(TestBase):
"""Test timezone-aware datetimes.