diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-21 17:18:49 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-21 17:18:49 -0400 |
commit | 3aff498e4a96eda06f09f09f98e73e135719b388 (patch) | |
tree | f1ca2029cfd147478447d3cb98bae587a8ccb3c2 /test/dialect/test_postgresql.py | |
parent | 1f6528ed8581ba63721bdc2a0593a5d39b9c27e0 (diff) | |
parent | fbcdba12f88d88c509fc34eb8aab3f501d1b705b (diff) | |
download | sqlalchemy-3aff498e4a96eda06f09f09f98e73e135719b388.tar.gz |
merge into cymysql branch...
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 3337fa6ab..005aed1ce 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -17,8 +17,8 @@ from sqlalchemy import Table, Column, select, MetaData, text, Integer, \ from sqlalchemy.orm import Session, mapper, aliased from sqlalchemy import exc, schema, types from sqlalchemy.dialects.postgresql import base as postgresql -from sqlalchemy.dialects.postgresql import HSTORE, hstore, array, ARRAY -from sqlalchemy.util.compat import decimal +from sqlalchemy.dialects.postgresql import HSTORE, hstore, array +import decimal from sqlalchemy.testing.util import round_decimal from sqlalchemy.sql import table, column, operators import logging @@ -180,6 +180,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): 'USING hash (data)', dialect=postgresql.dialect()) + def test_substring(self): + self.assert_compile(func.substring('abc', 1, 2), + 'SUBSTRING(%(substring_1)s FROM %(substring_2)s ' + 'FOR %(substring_3)s)') + self.assert_compile(func.substring('abc', 1), + 'SUBSTRING(%(substring_1)s FROM %(substring_2)s)') + + def test_extract(self): t = table('t', column('col1', DateTime), column('col2', Date), @@ -734,7 +742,6 @@ class NumericInterpretationTest(fixtures.TestBase): def test_numeric_codes(self): from sqlalchemy.dialects.postgresql import pg8000, psycopg2, base - from sqlalchemy.util.compat import decimal for dialect in (pg8000.dialect(), psycopg2.dialect()): @@ -3094,6 +3101,12 @@ class HStoreRoundTripTest(fixtures.TablesTest): engine.connect() return engine + def test_reflect(self): + from sqlalchemy import inspect + insp = inspect(testing.db) + cols = insp.get_columns('data_table') + assert isinstance(cols[2]['type'], HSTORE) + @testing.only_on("postgresql+psycopg2") def test_insert_native(self): engine = testing.db |