def test(): import sys if sys.version[:3] > '2.4': outmost_iterable_name = '.0' else: outmost_iterable_name = '[outmost-iterable]' import dis for line in test_lines.split('\n'): if not line or line.isspace(): continue line = line.strip() if line.startswith('#'): continue code = compile(line, '<?>', 'eval').co_consts[0] ast1 = parse(line).node.nodes[0].expr ast1.code.quals[0].iter.name = outmost_iterable_name try: ast2 = Decompiler(code).ast except Exception as e: print() print(line) print() print(ast1) print() dis.dis(code) raise if str(ast1) != str(ast2): print() print(line) print() print(ast1) print() print(ast2) print() dis.dis(code) break else: print('OK: %s' % line) else: print('Done!')