コード例 #1
0
def test_samples( samples ):
    time_reports = {}
    for sample in samples:
        print "testing", sample
        tstart1, cstart1 = time(), clock()
        pypy_tuples = pypy_parse(sample)
        tstart2, cstart2 = time(), clock()
        python_tuples = python_parse(sample)
        time_reports[sample] = (time() - tstart2, tstart2-tstart1, clock() - cstart2, cstart2-cstart1 )
        #print "-"*10, "PyPy parse results", "-"*10
        #print ''.join(print_sym_tuple(pypy_tuples, names=True))
        #print "-"*10, "CPython parse results", "-"*10
        #print ''.join(print_sym_tuple(python_tuples, names=True))
        print
        try:
            assert_tuples_equal(pypy_tuples, python_tuples)
        except AssertionError,e:
            error_path = e.args[-1]
            print "ERROR PATH =", error_path
            print "="*80
            print file(sample).read()
            print "="*80
            print "-"*10, "PyPy parse results", "-"*10
            print ''.join(print_sym_tuple(pypy_tuples, names=True, trace=error_path))
            print "-"*10, "CPython parse results", "-"*10
            print ''.join(print_sym_tuple(python_tuples, names=True, trace=error_path))
            print "Failed on (%s)" % sample
コード例 #2
0
def check_parse_input(snippet, mode):
    pypy_tuples = pypy_parse(snippet, mode, lineno=True)
    python_tuples = python_parse(snippet, mode, lineno=True)
    _check_tuples_equality(pypy_tuples, python_tuples, snippet)