From e63705fa2fe6d0f13a55bb310e0ff79cc4195525 Mon Sep 17 00:00:00 2001 From: Jeff Horemans Date: Thu, 8 Aug 2024 10:04:38 +0200 Subject: [PATCH] Expanded SQLite constraint reflection tests with more check constraints cases. --- test/dialect/test_sqlite.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index c7e20d4c1a..98de6e3560 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -1817,10 +1817,14 @@ class ConstraintReflectionTest(fixtures.TestBase): Table("q", meta, Column("id", Integer), PrimaryKeyConstraint("id")) # intentional new line - Table("r", meta, Column("id", Integer), Column("value", Integer), PrimaryKeyConstraint("id"), + Table("r", meta, Column("id", Integer), Column("value", Integer), Column("prefix", String), PrimaryKeyConstraint("id"), CheckConstraint("id > 0"), - CheckConstraint("((value > 0) AND \n\t(value < 100))", name='ck_r_value_multiline'), - CheckConstraint("value IS NOT NULL", name='ck_r_value with spaces'), + # Constraint definition with newline and tab characters + CheckConstraint("((value > 0) AND \n\t(value < 100) AND \n\t(value != 50))", name='ck_r_value_multiline'), + # Constraint name with special characters and spaces. + CheckConstraint("value IS NOT NULL", name='^ck-r* # Value'), + # Constraint definition with special characters. + CheckConstraint("prefix NOT GLOB '*[^-. /#,]*'") ) meta.create_all(conn) @@ -2467,9 +2471,10 @@ class ConstraintReflectionTest(fixtures.TestBase): eq_( inspector.get_check_constraints("r"), [ - {"sqltext": "value IS NOT NULL", "name": "ck_r_value with spaces"}, - {"sqltext": "((value > 0) AND \n\t(value < 100))", "name": "ck_r_value_multiline"}, + {"sqltext": "value IS NOT NULL", "name": "^ck-r* # Value"}, + {"sqltext": "((value > 0) AND \n\t(value < 100) AND \n\t(value != 50))", "name": "ck_r_value_multiline"}, {"sqltext": "id > 0", "name": None}, + {"sqltext": "prefix NOT GLOB '*[^-. /#,]*'", "name": None}, ], ) -- 2.47.3