'test that variables are pulled from
\'enclosing\' scope before context.'

def test_scope_five(self):

    t = Template('\n                                                <%def    name="enclosing()">\n                                                <%\n                                                                x    =    5\n                                                %>\n                                                <%def    name="a()">\n                                                                this    is    a.    x    is    ${x}.\n                                                </%def>\n\n                                                <%def    name="b()">\n                                                                <%\n                                                                                x    =    9\n                                                                %>\n                                                                this    is    b.    x    is    ${x}.\n                                                                calling    a.    ${a()}\n                                                </%def>\n\n                                                ${b()}\n                                                </%def>\n                                                ${enclosing()}\n')
    eq_(flatten_result(t.render()), 'this    is    b.    x    is    9.    calling    a.    this    is    a.    x    is    5.')
