From afb121b0af8bd8a08f02031b5cf443b72dac952b Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Wed, 17 Jan 2018 16:38:50 -0500 Subject: [PATCH] Normalize check constraints even more radically This is the only way I could get this test pass on informix, basically I strip every whitespace. The sql text as recorded in informix is: ``` ((a > 1 ) AND (a < 5 ) ) ((a = 1 ) OR ((a > 2 ) AND (a <5 ) ) ) ``` Yes, this is absolutely bonkers, but that is what I get :( Change-Id: I936e860f2b75b521e5560c05c452dbe72f0d3812 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/413 --- lib/sqlalchemy/testing/suite/test_reflection.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index f541165e33..0c391fad01 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -789,12 +789,15 @@ class ComponentReflectionTest(fixtures.TablesTest): key=operator.itemgetter('name') ) + # trying to minimize effect of quoting, parenthesis, etc. + # may need to add more to this as new dialects get CHECK + # constraint reflection support + def normalize(sqltext): + return " ".join(re.findall(r"and|\d|=|a|or|<|>", sqltext.lower(), re.I)) + reflected = [ {"name": item["name"], - # trying to minimize effect of quoting, parenthesis, etc. - # may need to add more to this as new dialects get CHECK - # constraint reflection support - "sqltext": re.sub(r"[`'\(\)]", '', item["sqltext"].lower())} + "sqltext": normalize(item["sqltext"])} for item in reflected ] eq_( -- 2.47.3