1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/attribute_access_type_restriction_exception.py Sun Jun 10 18:38:37 2012 +0200
1.3 @@ -0,0 +1,24 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class C:
1.7 + def __init__(self):
1.8 + self.visitor = self
1.9 +
1.10 + def default(self, node):
1.11 + return 123
1.12 +
1.13 + def dispatch(self, node):
1.14 + try:
1.15 + return node.visit(self.visitor)
1.16 + except AttributeError:
1.17 + return self.visitor.default(node)
1.18 +
1.19 +class N:
1.20 + def visit(self, visitor):
1.21 + return 456
1.22 +
1.23 +c = C()
1.24 +n = N()
1.25 +result_456 = c.dispatch(n)
1.26 +
1.27 +# vim: tabstop=4 expandtab shiftwidth=4