summaryrefslogtreecommitdiff
path: root/test/dialect/postgres.py
diff options
context:
space:
mode:
authorAnts Aasma <ants.aasma@gmail.com>2007-09-29 06:21:34 +0000
committerAnts Aasma <ants.aasma@gmail.com>2007-09-29 06:21:34 +0000
commit4924007317f6d3cb9655b258c01ff888fb3f4a28 (patch)
treeeb7627a62ca157a8a157521b488096f39932a880 /test/dialect/postgres.py
parent51b32cd809bfbdd98afc978da4b6739741983b82 (diff)
downloadsqlalchemy-4924007317f6d3cb9655b258c01ff888fb3f4a28.tar.gz
- added partial index support for postgres
- fixed create and drop methods on MockConnection
Diffstat (limited to 'test/dialect/postgres.py')
-rw-r--r--test/dialect/postgres.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/dialect/postgres.py b/test/dialect/postgres.py
index bae1f666d..0535da6f8 100644
--- a/test/dialect/postgres.py
+++ b/test/dialect/postgres.py
@@ -3,6 +3,7 @@ import datetime
from sqlalchemy import *
from sqlalchemy import exceptions
from sqlalchemy.databases import postgres
+from sqlalchemy.engine.strategies import MockEngineStrategy
from testlib import *
class SequenceTest(SQLCompileTest):
@@ -517,6 +518,19 @@ class MiscTest(AssertMixin):
finally:
testbase.db.execute("drop table speedy_users", None)
+ @testing.supported('postgres')
+ def test_create_partial_index(self):
+ tbl = Table('testtbl', MetaData(), Column('data',Integer))
+ idx = Index('test_idx1', tbl.c.data, postgres_where=and_(tbl.c.data > 5, tbl.c.data < 10))
+
+ executed_sql = []
+ mock_strategy = MockEngineStrategy()
+ mock_conn = mock_strategy.create('postgres://', executed_sql.append)
+
+ idx.create(mock_conn)
+
+ assert executed_sql == ['CREATE INDEX test_idx1 ON testtbl (data) WHERE testtbl.data > 5 AND testtbl.data < 10']
+
class TimezoneTest(AssertMixin):
"""test timezone-aware datetimes. psycopg will return a datetime with a tzinfo attached to it,
if postgres returns it. python then will not let you compare a datetime with a tzinfo to a datetime