def eq_ast(input, expected, filename=None):
    lexer = phplex.lexer.clone()
    lexer.filename = filename
    output = parser.parse(input, lexer=lexer)
    resolve_magic_constants(output)

    print 'Parser output:'
    pprint.pprint(output)
    print

    print 'Node by node:'
    for out, exp in zip(output, expected):
        print '\tgot:', out, '\texpected:', exp
        nose.tools.eq_(out, exp)

    assert len(output) == len(expected), \
           'output length was %d, expected %s' % (len(output), len(expected))
dataset/ETHPy150Open ramen/phply/tests/test_parser.py/eq_ast/original