diff options
Diffstat (limited to 'test/sql/generative.py')
| -rw-r--r-- | test/sql/generative.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/sql/generative.py b/test/sql/generative.py index 4edf334f6..daa2432da 100644 --- a/test/sql/generative.py +++ b/test/sql/generative.py @@ -18,6 +18,8 @@ class TraversalTest(TestBase, AssertsExecutionResults): # establish two ficticious ClauseElements. # define deep equality semantics as well as deep identity semantics. class A(ClauseElement): + __visit_name__ = 'a' + def __init__(self, expr): self.expr = expr @@ -34,6 +36,8 @@ class TraversalTest(TestBase, AssertsExecutionResults): return "A(%s)" % repr(self.expr) class B(ClauseElement): + __visit_name__ = 'b' + def __init__(self, *items): self.items = items @@ -137,6 +141,19 @@ class TraversalTest(TestBase, AssertsExecutionResults): assert struct != s3 assert struct3 == s3 + def test_visit_name(self): + # override fns in testlib/schema.py + from sqlalchemy import Column + + class CustomObj(Column): + pass + + assert CustomObj.__visit_name__ == Column.__visit_name__ == 'column' + + foo, bar = CustomObj('foo', String), CustomObj('bar', String) + bin = foo == bar + s = set(ClauseVisitor().iterate(bin)) + assert set(ClauseVisitor().iterate(bin)) == set([foo, bar, bin]) class ClauseTest(TestBase, AssertsCompiledSQL): """test copy-in-place behavior of various ClauseElements.""" |
