diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-12-11 23:28:01 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-12-11 23:28:01 +0000 |
| commit | b22edf1d8a16467a8d5625f4ddf7dca9403bdfe0 (patch) | |
| tree | 785fb5bad86f24a267bb42d72a52cbe3c2f747d7 /test/sql | |
| parent | 8d3fab1250fdb9e5cf389fcfa6a8c5f7f0ebbded (diff) | |
| download | sqlalchemy-b22edf1d8a16467a8d5625f4ddf7dca9403bdfe0.tar.gz | |
- turn __visit_name__ into an explicit member.
[ticket:1244]
Diffstat (limited to 'test/sql')
| -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.""" |
