From c8a80e21301791fd4e1caf29ed8cadd40f617765 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 9 Mar 2013 17:26:16 -0500 Subject: - remove all compat items that are pre-2.5 (hooray) - other cleanup - don't need compat.decimal, that approach never panned out. hopefully outside libs aren't pulling it in, they shouldn't be --- test/dialect/test_postgresql.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test/dialect/test_postgresql.py') diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 3337fa6ab..d9fb9830d 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 @@ -734,7 +734,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()): -- cgit v1.2.1 From a0de45185bf510fca9e237d9191e89391d118591 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 9 Mar 2013 17:40:06 -0500 Subject: Added support for Postgresql's traditional SUBSTRING function syntax, renders as "SUBSTRING(x FROM y FOR z)" when regular ``func.substring()`` is used. Also in 0.7.11. Courtesy Gunnlaugur Por Briem. [ticket:2676] --- test/dialect/test_postgresql.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/dialect/test_postgresql.py') diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index d9fb9830d..62e855356 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -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), -- cgit v1.2.1 From 9ad9ccec87b89023db611d70da2c6d455c29ab60 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 18 Mar 2013 12:55:56 -0700 Subject: 0.8.1 bump + test, changelog for hstore fix [ticket:2680] --- test/dialect/test_postgresql.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/dialect/test_postgresql.py') diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 62e855356..005aed1ce 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -3101,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 -- cgit v1.2.1