From: Tobias Pfeiffer Date: Wed, 16 Nov 2022 08:17:14 +0000 (+0900) Subject: extend test case X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2624867ecbcba7519933fb2bf894608926bb22a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git extend test case --- diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index 9ed5f64bac..a5e2bec4b7 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -2313,22 +2313,47 @@ class ConstraintReflectionTest(fixtures.TestBase): "create unique index ix_partial on " "foo_with_partial_index (x) where y > 10" ) + conn.exec_driver_sql( + "create unique index ix_no_partial on " + "foo_with_partial_index (x)" + ) + conn.exec_driver_sql( + "create unique index ix_partial2 on " + "foo_with_partial_index (x, y) where " + "y = 10 or abs(x) < 5" + ) inspector = inspect(conn) indexes = inspector.get_indexes("foo_with_partial_index") eq_( indexes, [ + { + "unique": 1, + "name": "ix_no_partial", + "column_names": ["x"], + "dialect_options": {}, + }, { "unique": 1, "name": "ix_partial", "column_names": ["x"], "dialect_options": {"sqlite_where": ANY}, - } + }, + { + "unique": 1, + "name": "ix_partial2", + "column_names": ["x", "y"], + "dialect_options": {"sqlite_where": ANY}, + }, ], ) assert ( - indexes[0]["dialect_options"]["sqlite_where"].text == "y > 10" + indexes[1]["dialect_options"]["sqlite_where"].text == "y > 10" + ) + assert ( + indexes[2]["dialect_options"]["sqlite_where"].text + == "y = 10 or abs(x) < 5" ) def test_unique_constraint_named(self):