def test_roundtrip(f):
    ## print 'Testing:', f
    fobj = open(f)
    try:
        fulltok = list(generate_tokens(fobj.readline))
    finally:
        fobj.close()

    t1 = [tok[:2] for tok in fulltok]
    newtext = untokenize(t1)
    readline = iter(newtext.splitlines(1)).next
    t2 = [tok[:2] for tok in generate_tokens(readline)]
    if t1 != t2:
        raise TestFailed(f % "untokenize() roundtrip failed for %r")

# This is an example from the docs, set up as a doctest.
dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test_tokenize.py/test_roundtrip/swapped operands of `%`