From: Mike Bayer Date: Wed, 24 Apr 2013 14:39:25 +0000 (-0400) Subject: add postgresql_where test X-Git-Tag: rel_0_6_0~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d90aa89588d4b6e2eb65d093957063295f1edd6;p=thirdparty%2Fsqlalchemy%2Falembic.git add postgresql_where test --- diff --git a/tests/test_op.py b/tests/test_op.py index e7845ee4..f1ab2570 100644 --- a/tests/test_op.py +++ b/tests/test_op.py @@ -2,7 +2,7 @@ from sqlalchemy import Integer, Column, ForeignKey, \ Table, String, Boolean -from sqlalchemy.sql import column, func +from sqlalchemy.sql import column, func, text from sqlalchemy import event from alembic import op @@ -34,6 +34,17 @@ def test_rename_table_schema_postgresql(): op.rename_table('t1', 't2', schema="foo") context.assert_("ALTER TABLE foo.t1 RENAME TO t2") +def test_create_index_postgresql_where(): + context = op_fixture("postgresql") + op.create_index( + 'geocoded', + 'locations', + ['coordinates'], + postgresql_where=text("locations.coordinates != Null")) + context.assert_( + "CREATE INDEX geocoded ON locations (coordinates) " + "WHERE locations.coordinates != Null") + def test_add_column(): context = op_fixture() op.add_column('t1', Column('c1', Integer, nullable=False))