import unittest
from compyler.test.util import eval_code

stmts = [
# for
    ("""

def foo():
    x,y,z = 1,2,3
    print x,y,z
    def bar():
        print y
    return bar

foo()()

""","""1 2 3\n2\n"""),

#    ("""
#
#def foo():
#    x,y,z = 1,2,3
#    print x,y,z
#    def bar():
#        print y,x
#    return bar
#
#foo()()
#
#""","""1 2 3\n2 1\n"""),


]


class test_opcodes_nested(unittest.TestCase):
    def test_closures(self):
        for stmt in stmts:
            self.failUnless(eval_code(stmt[0],stmt[1],"exec",title='test_opcodes_nested'))
                
if __name__ == "__main__":
    unittest.main()

