summaryrefslogtreecommitdiff
path: root/test/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-04-17 13:37:39 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-04-29 11:54:25 -0400
commit099522075088a3e1a333a2285c10a8a33b203c19 (patch)
treeb1359c9ff50d19e4787d8ead0bfe5b03ad1fb69a /test/ext
parent2f55c844051d9fe8865576bd77107e94c6de16c1 (diff)
downloadsqlalchemy-099522075088a3e1a333a2285c10a8a33b203c19.tar.gz
Reimplement .compare() in terms of a visitor
Reworked the :meth:`.ClauseElement.compare` methods in terms of a new visitor-based approach, and additionally added test coverage ensuring that all :class:`.ClauseElement` subclasses can be accurately compared against each other in terms of structure. Structural comparison capability is used to a small degree within the ORM currently, however it also may form the basis for new caching features. Fixes: #4336 Change-Id: I581b667d8e1642a6c27165cc9f4aded1c66effc6
Diffstat (limited to 'test/ext')
-rw-r--r--test/ext/test_compiler.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ext/test_compiler.py b/test/ext/test_compiler.py
index ac6af0a96..ccd79f8d1 100644
--- a/test/ext/test_compiler.py
+++ b/test/ext/test_compiler.py
@@ -274,6 +274,18 @@ class UserDefinedTest(fixtures.TestBase, AssertsCompiledSQL):
dialect=postgresql.dialect(),
)
+ def test_functions_args_noname(self):
+ class myfunc(FunctionElement):
+ pass
+
+ @compiles(myfunc)
+ def visit_myfunc(element, compiler, **kw):
+ return "myfunc%s" % (compiler.process(element.clause_expr, **kw),)
+
+ self.assert_compile(myfunc(), "myfunc()")
+
+ self.assert_compile(myfunc(column("x"), column("y")), "myfunc(x, y)")
+
def test_function_calls_base(self):
from sqlalchemy.dialects import mssql