# Path: pyxc/util.py
# def usingPython3():
#     return sys.version_info[0] == 3
# 
# def check_communicate(cmd, input='', **Popen_kwargs):
#     out, err, returncode = communicateWithReturncode(cmd, input=input, **Popen_kwargs)
#     if returncode != 0:
#         raise SubprocessError(out, err, returncode)
#     return (out, err)
# 
# def exceptionRepr(exc_info=None):
#     
#     if usingPython3():
#         from io import StringIO
#     else:
#         from StringIO import StringIO
#     
#     if not exc_info:
#         exc_info = sys.exc_info()
#     f = StringIO()
#     traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], file=f)
#     return f.getvalue()
# 
# Path: pj/api_internal.py
# def codeToCode(py):
#     
#     t = Transformer(pj.transformations, pj.js_ast.JSStatements)
#     jsAst = t.transformCode(py)
#     js = '%s\n%s' % ('\n'.join(t.snippets), str(jsAst))
#     
#     names = set(topLevelNamesInBody(ast.parse(py).body))
#     if len(names) > 0:
#         js = 'var %s;\n\n%s' % (
#             ', '.join(names),
#             js)
#     
#     return js


import os, json, re, sys
from pyxc.util import usingPython3, check_communicate, exceptionRepr
from pj.api_internal import codeToCode
#!/usr/bin/env python3.1

# For each of many Python fragments, check that...
#
#   * it runs as Python
#   * it compiles to js
#   * the js runs
#   * the value of the last line is the same in py and js
#
# Prereqs
# 
#   * have [Rhino](http://www.mozilla.org/rhino/)'s js.jar somewhere
#   * have the environment variable <code>RHINO_JAR</code> point to it


def up(n):
    path = os.path.abspath(__file__)
    return '/'.join(path.rstrip('/').split('/')[:-n])

sys.path.append(up(3))

assert usingPython3()


def main():
    

# Path: pyxc/util.py
# def usingPython3():
#     return sys.version_info[0] == 3
# 
# def check_communicate(cmd, input='', **Popen_kwargs):
#     out, err, returncode = communicateWithReturncode(cmd, input=input, **Popen_kwargs)
#     if returncode != 0:
#         raise SubprocessError(out, err, returncode)
#     return (out, err)
# 
# def exceptionRepr(exc_info=None):
#     
#     if usingPython3():
#         from io import StringIO
#     else:
#         from StringIO import StringIO
#     
#     if not exc_info:
#         exc_info = sys.exc_info()
#     f = StringIO()
#     traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], file=f)
#     return f.getvalue()
# 
# Path: pj/api_internal.py
# def codeToCode(py):
#     
#     t = Transformer(pj.transformations, pj.js_ast.JSStatements)
#     jsAst = t.transformCode(py)
#     js = '%s\n%s' % ('\n'.join(t.snippets), str(jsAst))
#     
#     names = set(topLevelNamesInBody(ast.parse(py).body))
#     if len(names) > 0:
#         js = 'var %s;\n\n%s' % (
#             ', '.join(names),
#             js)
#     
#     return js


# Path: pj/tests/dual_eval.py
import os, json, re, sys
from pyxc.util import usingPython3, check_communicate, exceptionRepr
from pj.api_internal import codeToCode

#!/usr/bin/env python3.1

# For each of many Python fragments, check that...
#
#   * it runs as Python
#   * it compiles to js
#   * the js runs
#   * the value of the last line is the same in py and js
#
# Prereqs
# 
#   * have [Rhino](http://www.mozilla.org/rhino/)'s js.jar somewhere
#   * have the environment variable <code>RHINO_JAR</code> point to it


def up(n):
    path = os.path.abspath(__file__)
    return '/'.join(path.rstrip('/').split('/')[:-n])

sys.path.append(up(3))

assert usingPython3()


def main():
    

    for py in getFragments():