summaryrefslogtreecommitdiff
path: root/test/testlib/testing.py
diff options
context:
space:
mode:
authorCatherine Devlin <catherine.devlin@gmail.com>2008-03-20 16:48:46 +0000
committerCatherine Devlin <catherine.devlin@gmail.com>2008-03-20 16:48:46 +0000
commit6d5cb2522b0fbb849032a7cdcbfa27baee10c587 (patch)
treebd4e72be248f7596f1fcbd80a6bdbeaf74ac554e /test/testlib/testing.py
parent50206ec2adcd1c38bc4dad98c7775c7ea8ecd10c (diff)
downloadsqlalchemy-6d5cb2522b0fbb849032a7cdcbfa27baee10c587.tar.gz
Undoing patch #994, for now; more testing needed. Sorry. Also modifying test for query equivalence to account for underscoring of bind variables.
Diffstat (limited to 'test/testlib/testing.py')
-rw-r--r--test/testlib/testing.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/testlib/testing.py b/test/testlib/testing.py
index 03a8e6539..08c3c9192 100644
--- a/test/testlib/testing.py
+++ b/test/testlib/testing.py
@@ -370,6 +370,7 @@ class ExecutionContextWrapper(object):
def __setattr__(self, key, value):
setattr(self.ctx, key, value)
+ trailing_underscore_pattern = re.compile(r'(\W:[\w_#]+)_\b',re.MULTILINE)
def post_execution(self):
ctx = self.ctx
statement = unicode(ctx.compiled)
@@ -412,7 +413,15 @@ class ExecutionContextWrapper(object):
parameters = ctx.compiled_parameters
query = self.convert_statement(query)
- testdata.unittest.assert_(statement == query and (params is None or params == parameters), "Testing for query '%s' params %s, received '%s' with params %s" % (query, repr(params), statement, repr(parameters)))
+ equivalent = ( (statement == query)
+ or ( (config.db.name == 'oracle') and (self.trailing_underscore_pattern.sub(r'\1', statement) == query) )
+ ) \
+ and \
+ ( (params is None) or (params == parameters)
+ or params == [dict((k.strip('_'), v) for (k, v) in p.items())for p in parameters]
+ )
+ testdata.unittest.assert_(equivalent,
+ "Testing for query '%s' params %s, received '%s' with params %s" % (query, repr(params), statement, repr(parameters)))
testdata.sql_count += 1
self.ctx.post_execution()