summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/suite
diff options
context:
space:
mode:
authorFlorian Apolloner <apollo13@users.noreply.github.com>2018-01-17 16:38:50 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-01-17 16:38:50 -0500
commitafb121b0af8bd8a08f02031b5cf443b72dac952b (patch)
tree996cbdae966565900771ebc232f9ad2a88276dde /lib/sqlalchemy/testing/suite
parent92cabe2d8803c5f4aa3e627ef131ffa765ddc1c6 (diff)
downloadsqlalchemy-afb121b0af8bd8a08f02031b5cf443b72dac952b.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/testing/suite')
-rw-r--r--lib/sqlalchemy/testing/suite/test_reflection.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py
index f541165e3..0c391fad0 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_(