%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/lib2to3/tests/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyc


Pac@s!dZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZddlm
Z
de
jfdYZd	efd
YZdefdYZd
efdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefd YZd!efd"YZd#efd$YZd%efd&YZd'efd(YZd)efd*YZ d+efd,YZ!d-efd.YZ"d/efd0YZ#d1fd2YZ$d3ee$fd4YZ%d5ee$fd6YZ&d7ee$fd8YZ'd9efd:YZ(d;efd<YZ)d=efd>YZ*d?efd@YZ+dAefdBYZ,dCefdDYZ-dEefdFYZ.dGefdHYZ/dIefdJYZ0dKefdLYZ1dMefdNYZ2dOefdPYZ3dQefdRYZ4dSefdTYZ5dUefdVYZ6dWefdXYZ7dYefdZYZ8d[efd\YZ9d]efd^YZ:d_efd`YZ;daefdbYZ<dcefddYZ=deefdfYZ>dgefdhYZ?diefdjYZ@dkefdlYZAdmefdnYZBdoefdpYZCdqefdrYZDdS(ss" Test suite for the fixer modules iN(tchain(t
itemgetter(tpygramtpytreetrefactort
fixer_util(tsupportt
FixerTestCasecBsYeZddddZdZedZedZdZedZ	dZ
RS(	tlib2to3cCs{|dkr|jg}ntj||||_g|_d|_x/t|jj|jj	D]}|j|_
qaWdS(Nu<string>(tNonetfixerRtget_refactorerRt	fixer_logtfilenameRt	pre_ordert
post_ordertlog(tselftfix_listt	fixer_pkgtoptionsR
((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytsetUps		cCsPtj|}tj|}|jj||j}|j|t||S(N(RtreformatRtrefactor_stringR
tassertEqualtunicode(Rtbeforetafterttree((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt_checks
cCsB|j||}|j|j|s>|j|jgndS(N(Rt
assertTruetwas_changedRR(RRRtignore_warningsR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytcheck$scCsK|j||}|j|dj|j|sG|j|jndS(Nt(RtassertIntjoinRRR(RRRtmessaget	unchangedR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytwarns*scCs|j|||dtdS(NR&(R'tTrue(RRR%((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytwarns_unchanged0scCs0|j|||s,|j|jgndS(N(RRR(RRR ((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR&3scGs|jg}|j|tjd|}|j\}}d|j}|rm|djjj|rmdS|r|djjj|r|rdS|jddj	g||D]}|jj^q|fdS(NRtfix_is5Fixer run order (%s) is incorrect; %s should be last.s, (
R
textendRRt
get_fixerst	__class__t
__module__tendswithtfailR$(Rtnamestfixestrtpretposttntx((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytassert_runs_after8s

&	N(t__name__R.R	RRtFalseR!R'R)R&R8(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs		tTest_necBs)eZdZdZdZdZRS(tnecCs d}d}|j||dS(Nsif x <> y:
            passsif x != y:
            pass(R!(Rtbta((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_basicJscCs d}d}|j||dS(Nsif x<>y:
            passsif x!=y:
            pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_no_spacesRscCs d}d}|j||dS(Nsif x<>y<>z:
            passsif x!=y!=z:
            pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_chainedZs(R9R.R
R?R@RA(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR;Gs		tTest_has_keycBsqeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
RS(thas_keycCs d}d}|j||dS(Ns$x = d.has_key("x") or d.has_key("y")sx = "x" in d or "y" in d(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_1escCs d}d}|j||dS(Nsx = a.b.c.d.has_key("x") ** 3sx = ("x" in a.b.c.d) ** 3(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_2jscCs d}d}|j||dS(Ns!x = a.b.has_key(1 + 2).__repr__()sx = (1 + 2 in a.b).__repr__()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_3oscCs d}d}|j||dS(Ns,x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4s(x = (1 + 2 in a.b).__repr__() ** -3 ** 4(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_4tscCs d}d}|j||dS(Nsx = a.has_key(f or g)sx = (f or g) in a(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_5yscCs d}d}|j||dS(Nsx = a + b.has_key(c)sx = a + (c in b)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_6~scCs d}d}|j||dS(Nsx = a.has_key(lambda: 12)sx = (lambda: 12) in a(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_7scCs d}d}|j||dS(Nsx = a.has_key(a for a in b)sx = (a for a in b) in a(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_8scCs d}d}|j||dS(Nsif not a.has_key(b): passsif b not in a: pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_9scCs d}d}|j||dS(Ns$if not a.has_key(b).__repr__(): passs if not (b in a).__repr__(): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_10scCs d}d}|j||dS(Nsif not a.has_key(b) ** 2: passsif not (b in a) ** 2: pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_11s(R9R.R
RDRERFRGRHRIRJRKRLRMRN(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRBbs										t
Test_applycBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(tapplycCs d}d}|j||dS(Nsx = apply(f, g + h)s
x = f(*g + h)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Nsy = apply(f, g, h)sy = f(*g, **h)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Ns z = apply(fs[0], g or h, h or g)sz = fs[0](*g or h, **h or g)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Nsapply(f, (x, y) + t)sf(*(x, y) + t)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGscCs d}d}|j||dS(Nsapply(f, args,)sf(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRHscCs d}d}|j||dS(Nsapply(f, args, kwds,)sf(*args, **kwds)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRIscCs d}d}|j||dS(Nsx = apply(f+g, args)sx = (f+g)(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_complex_1scCs d}d}|j||dS(Nsx = apply(f*g, args)sx = (f*g)(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_complex_2scCs d}d}|j||dS(Nsx = apply(f**g, args)sx = (f**g)(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_complex_3scCs d}d}|j||dS(Nsx = apply(f.g, args)sx = f.g(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_dotted_namescCs d}d}|j||dS(Nsx = apply(f[x], args)sx = f[x](*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_subscriptscCs d}d}|j||dS(Nsx = apply(f(), args)sx = f()(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_callscCs d}d}|j||dS(Ns"x = apply(a.b.c.d.e.f, args, kwds)sx = a.b.c.d.e.f(*args, **kwds)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_extremescCs d}d}|j||dS(Ns1apply(   # foo
          f, # bar
          args)sf(*args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_weird_commentsscCsd}|j|dS(Nsapply()(R&(Rts((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_1scCsd}|j|dS(Nsapply(f)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_2scCsd}|j|dS(Ns	apply(f,)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_3scCsd}|j|dS(Nsapply(f, args, kwds, extras)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_4scCsd}|j|dS(Nsapply(f, *args, **kwds)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_5scCsd}|j|dS(Nsapply(f, *args)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_6scCsd}|j|dS(Nsapply(f, **kwds)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_6bscCsd}|j|dS(Ns#apply(func=f, args=args, kwds=kwds)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_7scCsd}|j|dS(Nsapply(f, args=args, kwds=kwds)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_8scCsd}|j|dS(Nsapply(f, args, kwds=kwds)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_9scCs d}d}|j||dS(Nsapply(  f,  args,   kwds)sf(*args, **kwds)(R!(RR>R=((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_space_1scCs d}d}|j||dS(Nsapply(  f  ,args,kwds   )sf(*args, **kwds)(R!(RR>R=((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_space_2s(R9R.R
RDRERFRGRHRIRQRRRSRTRURVRWRXRZR[R\R]R^R_R`RaRbRcRdRe(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyROs6																										tTest_interncBs)eZdZdZdZdZRS(tinterncCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsx =   intern(  a  )s"import sys
x =   sys.intern(  a  )s%y = intern("b" # test
              )s4import sys
y = sys.intern("b" # test
              )sz = intern(a+b+c.d,   )s&import sys
z = sys.intern(a+b+c.d,   )(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation$scCsXd}d}|j||d}d}|j||d}d}|j||dS(Ns
x = intern(a)simport sys
x = sys.intern(a)sz = intern(a+b+c.d,)s#import sys
z = sys.intern(a+b+c.d,)s"intern("y%s" % 5).replace("y", "")s1import sys
sys.intern("y%s" % 5).replace("y", "")(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest3scCscd}|j|d}|j|d}|j|d}|j|d}|j|dS(Nsintern(a=1)sintern(f, g)s
intern(*h)sintern(**i)sintern()(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchangedBs



(R9R.R
RhRiRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRf!s		tTest_reducecBs2eZdZdZdZdZdZRS(treducecCs d}d}|j||dS(Nsreduce(a, b, c)s,from functools import reduce
reduce(a, b, c)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_simple_callUscCs d}d}|j||dS(Nsdef x(arg): reduce(sum, [])s8from functools import reduce
def x(arg): reduce(sum, [])(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_bug_7253ZscCs d}d}|j||dS(Nsreduce(lambda x, y: x + y, seq)s<from functools import reduce
reduce(lambda x, y: x + y, seq)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_call_with_lambda`scCscd}|j|d}|j|d}|j|d}|j|d}|j|dS(Ns	reduce(a)sreduce(a, b=42)sreduce(a, b, c, d)sreduce(**c)sreduce()(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjes



(R9R.R
RmRnRoRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRkRs
			t
Test_printcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZRS(tprintcCs d}d}|j||dS(Nsprint 1,   1+1,   1+1+1sprint(1,   1+1,   1+1+1)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhxscCs*d}|j|d}|j|dS(Nsprint()s	print('')(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_idempotency}s
cCsOtj|jj_d}|j|d}|j|d}|j|dS(Nsprint(1, 1+1, 1+1+1)sprint()s	print('')(Rt!python_grammar_no_print_statementRtdrivertgrammarR&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt"test_idempotency_print_as_functions

cCs d}d}|j||dS(Nsprint 1, 1+1, 1+1+1sprint(1, 1+1, 1+1+1)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Ns
print 1, 2sprint(1, 2)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(NRqsprint()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Nsprint whatever; printsprint(whatever); print()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGscCs d}d}|j||dS(Nsprint; print whatever;sprint(); print(whatever);(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRHscCs d}d}|j||dS(Nsprint (a, b, c)sprint((a, b, c))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_tuplescCs d}d}|j||dS(Nsprint 1, 2, 3,sprint(1, 2, 3, end=' ')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_trailing_comma_1scCs d}d}|j||dS(Nsprint 1, 2,sprint(1, 2, end=' ')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_trailing_comma_2scCs d}d}|j||dS(Nsprint 1,sprint(1, end=' ')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_trailing_comma_3scCs d}d}|j||dS(Nsprint >>sys.stderr, 1, 2, 3sprint(1, 2, 3, file=sys.stderr)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt!test_vargs_without_trailing_commascCs d}d}|j||dS(Nsprint >>sys.stderr, 1, 2,s%print(1, 2, end=' ', file=sys.stderr)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_with_trailing_commascCs d}d}|j||dS(Nsprint >>sys.stderr, 1+1sprint(1+1, file=sys.stderr)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_no_trailing_commascCs d}d}|j||dS(Nsprint >>  sys.stderrsprint(file=sys.stderr)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_spaces_before_filescCs3d}|j|d}d}|j||dS(Ns<from __future__ import print_function
print('Hai!', end=' ')sprint 'Hello, world!'sprint('Hello, world!')(R&R!(RRYR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_with_future_print_functions

(R9R.R
RhRrRvRDRERFRGRHRwRxRyRzR{R|R}R~R(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRpus$																t	Test_execcBsheZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZRS(texeccCs d}d}|j||dS(Ns  exec code in ns1,   ns2s  exec(code, ns1,   ns2)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhscCs d}d}|j||dS(Ns	exec codes
exec(code)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR?scCs d}d}|j||dS(Nsexec code in nssexec(code, ns)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_with_globalsscCs d}d}|j||dS(Nsexec code in ns1, ns2sexec(code, ns1, ns2)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_with_globals_localsscCs d}d}|j||dS(Nsexec (a.b()) in nssexec((a.b()), ns)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRQscCs d}d}|j||dS(Nsexec a.b() + c in nssexec(a.b() + c, ns)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRRscCsd}|j|dS(Ns
exec(code)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRZscCsd}|j|dS(Nsexec (code)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR[scCsd}|j|dS(Nsexec(code, ns)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR\
scCsd}|j|dS(Nsexec(code, ns1, ns2)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR]s(
R9R.R
RhR?RRRQRRRZR[R\R](((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs									t	Test_reprcBsMeZdZdZdZdZdZdZdZdZ	RS(treprcCs d}d}|j||dS(Ns
x =   `1 + 2`sx =   repr(1 + 2)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhscCs d}d}|j||dS(Nsx = `1 + 2`sx = repr(1 + 2)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_simple_1scCs d}d}|j||dS(Nsy = `x`sy = repr(x)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_simple_2scCs d}d}|j||dS(Nsz = `y`.__repr__()sz = repr(y).__repr__()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_complex$scCs d}d}|j||dS(Ns
x = `1, 2, 3`sx = repr((1, 2, 3))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRw)scCs d}d}|j||dS(Ns
x = `1 + `2``sx = repr(1 + repr(2))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_nested.scCs d}d}|j||dS(Nsx = `1, 2 + `3, 4``sx = repr((1, 2 + repr((3, 4))))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_nested_tuples3s(
R9R.R
RhRRRRwRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs						tTest_exceptcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZRS(texceptcCs d}d}|j||dS(Nsq
            try:
                pass
            except (RuntimeError, ImportError),    e:
                passss
            try:
                pass
            except (RuntimeError, ImportError) as    e:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRh;scCs d}d}|j||dS(NsV
            try:
                pass
            except Foo, e:
                passsX
            try:
                pass
            except Foo as e:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_simpleHscCs d}d}|j||dS(NsU
            try:
                pass
            except Foo,e:
                passsX
            try:
                pass
            except Foo as e:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt"test_simple_no_space_before_targetUscCs d}d}|j||dS(Ns
            def foo():
                try:
                    pass
                except Exception, (f, e):
                    pass
                except ImportError, e:
                    passs
            def foo():
                try:
                    pass
                except Exception as xxx_todo_changeme:
                    (f, e) = xxx_todo_changeme.args
                    pass
                except ImportError as e:
                    pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_tuple_unpackbs
cCs d}d}|j||dS(Nsn
            try:
                pass
            except (RuntimeError, ImportError), e:
                passsp
            try:
                pass
            except (RuntimeError, ImportError) as e:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_multi_classwscCs d}d}|j||dS(Nsa
            try:
                pass
            except Exception, [a, b]:
                passs
            try:
                pass
            except Exception as xxx_todo_changeme:
                [a, b] = xxx_todo_changeme.args
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_list_unpackscCs d}d}|j||dS(Ns_
            try:
                pass
            except Exception, d[5]:
                passs
            try:
                pass
            except Exception as xxx_todo_changeme:
                d[5] = xxx_todo_changeme
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_weird_target_1scCs d}d}|j||dS(Ns`
            try:
                pass
            except Exception, a.foo:
                passs
            try:
                pass
            except Exception as xxx_todo_changeme:
                a.foo = xxx_todo_changeme
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_weird_target_2scCs d}d}|j||dS(Nsb
            try:
                pass
            except Exception, a().foo:
                passs
            try:
                pass
            except Exception as xxx_todo_changeme:
                a().foo = xxx_todo_changeme
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_weird_target_3scCs d}d}|j||dS(Ns
            try:
                pass
            except Exception, a:
                pass
            except:
                passs
            try:
                pass
            except Exception as a:
                pass
            except:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bare_exceptscCs d}d}|j||dS(Ns
            try:
                pass
            except Exception, a:
                pass
            except:
                pass
            else:
                pass
            finally:
                passs
            try:
                pass
            except Exception as a:
                pass
            except:
                pass
            else:
                pass
            finally:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt!test_bare_except_and_else_finallyscCs d}d}|j||dS(Ns
            try:
                pass
            except TypeError, b:
                pass
            except Exception, a:
                pass
            except:
                passs
            try:
                pass
            except TypeError as b:
                pass
            except Exception as a:
                pass
            except:
                pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt+test_multi_fixed_excepts_before_bare_excepts	
cCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(	Nsd
            try: raise TypeError
            except TypeError, e:
                pass
            sf
            try: raise TypeError
            except TypeError as e:
                pass
            sd
            try:
                raise TypeError
            except TypeError, e: pass
            sf
            try:
                raise TypeError
            except TypeError as e: pass
            sT
            try: raise TypeError
            except TypeError, e: pass
            sV
            try: raise TypeError
            except TypeError as e: pass
            s
            try: raise TypeError
            except TypeError, e: pass
            else: function()
            finally: done()
            s
            try: raise TypeError
            except TypeError as e: pass
            else: function()
            finally: done()
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_one_line_suitesscCsd}|j|dS(NsO
            try:
                pass
            except:
                pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRZ3scCsd}|j|dS(NsY
            try:
                pass
            except Exception:
                pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR[;scCsd}|j|dS(Nsg
            try:
                pass
            except (Exception, SystemExit):
                pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR\Cs(R9R.R
RhRRRRRRRRRRRRRZR[R\(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR8s"	
	
	
										0		t
Test_raisecBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZRS(traisecCs d}d}|j||dS(Nsraise Exception, 5sraise Exception(5)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR?NscCs<d}d}|j||d}d}|j||dS(Nsraise Exception,5sraise Exception(5)sraise   Exception,    5sraise   Exception(5)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhSscCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsraise Exception, 5 # foosraise Exception(5) # foosraise E, (5, 6) % (a, b) # foosraise E((5, 6) % (a, b)) # foos:def foo():
                    raise Exception, 5, 6 # foosIdef foo():
                    raise Exception(5).with_traceback(6) # foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_with_comments\scCs d}d}|j||dS(Nsraise Exception(5), None, tbs%raise Exception(5).with_traceback(tb)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_None_valuekscCs d}d}|j||dS(Nsraise Exception, (5, 6, 7)sraise Exception(5, 6, 7)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_tuple_valuepscCs d}d}|j||dS(Nsraise E, (5, 6) % (a, b)sraise E((5, 6) % (a, b))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_tuple_detectionuscCs d}d}|j||dS(Nsraise (((E1, E2), E3), E4), Vsraise E1(V)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_tuple_exc_1zscCs d}d}|j||dS(Nsraise (E1, (E2, E3), E4), Vsraise E1(V)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_tuple_exc_2scCsd}|j|ddS(Nsraise 'foo's+Python 3 does not support string exceptions(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_string_excscCsd}|j|ddS(Nsraise "foo", 5s+Python 3 does not support string exceptions(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_string_exc_valscCsd}|j|ddS(Nsraise "foo", 5, 6s+Python 3 does not support string exceptions(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_string_exc_val_tbscCs d}d}|j||dS(Ns4def foo():
                    raise Exception, 5, 6sCdef foo():
                    raise Exception(5).with_traceback(6)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_1scCs d}d}|j||dS(Nshdef foo():
                    a = 5
                    raise Exception, 5, 6
                    b = 6swdef foo():
                    a = 5
                    raise Exception(5).with_traceback(6)
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_2scCs d}d}|j||dS(Ns2def foo():
                    raise Exception,5,6sCdef foo():
                    raise Exception(5).with_traceback(6)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_3scCs d}d}|j||dS(Nsfdef foo():
                    a = 5
                    raise Exception,5,6
                    b = 6swdef foo():
                    a = 5
                    raise Exception(5).with_traceback(6)
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_4scCs d}d}|j||dS(Ns<def foo():
                    raise Exception, (5, 6, 7), 6sIdef foo():
                    raise Exception(5, 6, 7).with_traceback(6)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_5scCs d}d}|j||dS(Nspdef foo():
                    a = 5
                    raise Exception, (5, 6, 7), 6
                    b = 6s}def foo():
                    a = 5
                    raise Exception(5, 6, 7).with_traceback(6)
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_6s(R9R.R
R?RhRRRRRRRRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRKs$																	t
Test_throwcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZRS(tthrowcCs d}d}|j||dS(Nsg.throw(Exception, 5)sg.throw(Exception(5))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Nsg.throw(Exception,5)sg.throw(Exception(5))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Nsg.throw(Exception, (5, 6, 7))sg.throw(Exception(5, 6, 7))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Ns5 + g.throw(Exception, 5)s5 + g.throw(Exception(5))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGscCsd}|j|ddS(Nsg.throw("foo")s+Python 3 does not support string exceptions(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_warn_1scCsd}|j|ddS(Nsg.throw("foo", 5)s+Python 3 does not support string exceptions(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_warn_2scCsd}|j|ddS(Nsg.throw("foo", 5, 6)s+Python 3 does not support string exceptions(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_warn_3scCsd}|j|dS(Nsg.throw(Exception)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_untouched_1scCsd}|j|dS(Nsg.throw(Exception(5, 6))(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_untouched_2scCsd}|j|dS(Ns5 + g.throw(Exception(5, 6))(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_untouched_3scCs d}d}|j||dS(Ns7def foo():
                    g.throw(Exception, 5, 6)sFdef foo():
                    g.throw(Exception(5).with_traceback(6))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Nskdef foo():
                    a = 5
                    g.throw(Exception, 5, 6)
                    b = 6szdef foo():
                    a = 5
                    g.throw(Exception(5).with_traceback(6))
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Ns5def foo():
                    g.throw(Exception,5,6)sFdef foo():
                    g.throw(Exception(5).with_traceback(6))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Nsidef foo():
                    a = 5
                    g.throw(Exception,5,6)
                    b = 6szdef foo():
                    a = 5
                    g.throw(Exception(5).with_traceback(6))
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Ns?def foo():
                    g.throw(Exception, (5, 6, 7), 6)sLdef foo():
                    g.throw(Exception(5, 6, 7).with_traceback(6))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR#scCs d}d}|j||dS(Nssdef foo():
                    a = 5
                    g.throw(Exception, (5, 6, 7), 6)
                    b = 6sdef foo():
                    a = 5
                    g.throw(Exception(5, 6, 7).with_traceback(6))
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR*scCs d}d}|j||dS(Ns;def foo():
                    a + g.throw(Exception, 5, 6)sJdef foo():
                    a + g.throw(Exception(5).with_traceback(6))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_75scCs d}d}|j||dS(Nsodef foo():
                    a = 5
                    a + g.throw(Exception, 5, 6)
                    b = 6s~def foo():
                    a = 5
                    a + g.throw(Exception(5).with_traceback(6))
                    b = 6(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_tb_8<s(R9R.R
RDRERFRGRRRRRRRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs&																	t	Test_longcBs;eZdZdZdZdZdZdZRS(tlongcCs d}d}|j||dS(Nsx = long(x)s
x = int(x)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDJscCs d}d}|j||dS(Nsy = isinstance(x, long)sy = isinstance(x, int)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREOscCs d}d}|j||dS(Nsz = type(x) in (int, long)sz = type(x) in (int, int)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFTscCsd}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|dS(Nslong = Trues
s.long = Truesdef long(): passsclass long(): passsdef f(long): passsdef f(g, long): passsdef f(x, long=True): pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjYs





cCs d}d}|j||dS(Nsx =   long(  x  )sx =   int(  x  )(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhos(R9R.R
RDRERFRjRh(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGs				t
Test_execfilecBs eZdZdZdZRS(texecfilecCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||d}d}|j||dS(
Nsexecfile("fn")s4exec(compile(open("fn", "rb").read(), "fn", 'exec'))sexecfile("fn", glob)s:exec(compile(open("fn", "rb").read(), "fn", 'exec'), glob)sexecfile("fn", glob, loc)s?exec(compile(open("fn", "rb").read(), "fn", 'exec'), glob, loc)sexecfile("fn", globals=glob)sBexec(compile(open("fn", "rb").read(), "fn", 'exec'), globals=glob)sexecfile("fn", locals=loc)s@exec(compile(open("fn", "rb").read(), "fn", 'exec'), locals=loc)s(execfile("fn", globals=glob, locals=loc)sNexec(compile(open("fn", "rb").read(), "fn", 'exec'), globals=glob, locals=loc)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_conversionxs$cCs<d}d}|j||d}d}|j||dS(Nsexecfile( "fn" )s6exec(compile(open( "fn", "rb" ).read(), "fn", 'exec'))sexecfile("fn",  globals = glob)sEexec(compile(open("fn", "rb").read(), "fn", 'exec'),  globals = glob)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_spacings(R9R.R
RR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRus	tTest_isinstancecBs)eZdZdZdZdZRS(t
isinstancecCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(	Nsisinstance(x, (int, int, int))sisinstance(x, int)s,isinstance(x, (int, float, int, int, float))sisinstance(x, (int, float))s1isinstance(x, (int, float, int, int, float, str))s isinstance(x, (int, float, str))s4isinstance(foo() + bar(), (x(), y(), x(), int, int))s/isinstance(foo() + bar(), (x(), y(), x(), int))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_remove_multiple_itemsscCs d}d}|j||dS(Ns4if    isinstance(  foo(), (  bar, bar, baz )) : passs/if    isinstance(  foo(), (  bar, baz )) : pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhscCs|jddS(Nsisinstance(x, (str, int))(R&(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs(R9R.R
RRhRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs		t	Test_dictcBsIeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%RS($tdictcCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||d}d}|j||dS(Nsif   d. keys  (  )  : passs if   list(d. keys  (  ))  : passsif   d. items  (  )  : passs!if   list(d. items  (  ))  : passsif   d. iterkeys  ( )  : passsif   iter(d. keys  ( ))  : passs"[i for i in    d.  iterkeys(  )  ]s[i for i in    d.  keys(  )  ]sif   d. viewkeys  ( )  : passsif   d. keys  ( )  : passs"[i for i in    d.  viewkeys(  )  ](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhs$cCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d}|j||dS(
Nsd.keys() # fooslist(d.keys()) # foosd.items()  # fooslist(d.items())  # foosd.iterkeys()  # foositer(d.keys())  # foos/[i for i in d.iterkeys() # foo
               ]s+[i for i in d.keys() # foo
               ]sd.viewitems()  # foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_trailing_comments$cCs]xVtjD]K}d|}|j|d|}|j|d|}|j|q
WdS(Nss = %s(d.keys())ss = %s(d.values())ss = %s(d.items())(Rtconsuming_callsR&(RtwrapperRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs




cCs<d}d}|j||d}d}|j||dS(Nsd.keys()slist(d.keys())sa[0].foo().keys()slist(a[0].foo().keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_01scCs d}d}|j||dS(Ns	d.items()slist(d.items())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_02scCs d}d}|j||dS(Ns
d.values()slist(d.values())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_03	scCs d}d}|j||dS(Nsd.iterkeys()siter(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_04scCs d}d}|j||dS(Ns
d.iteritems()siter(d.items())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_05scCs d}d}|j||dS(Nsd.itervalues()siter(d.values())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_06scCsd}|j|dS(Nslist(d.keys())(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_07scCsd}|j|dS(Nssorted(d.keys())(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_08!scCs d}d}|j||dS(Nsiter(d.keys())siter(list(d.keys()))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_09%scCs d}d}|j||dS(Ns
foo(d.keys())sfoo(list(d.keys()))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRM*scCs d}d}|j||dS(Nsfor i in d.keys(): print is for i in list(d.keys()): print i(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRN/scCs d}d}|j||dS(Nsfor i in d.iterkeys(): print isfor i in d.keys(): print i(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_124scCs d}d}|j||dS(Ns[i for i in d.keys()]s for i in list(d.keys())](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_139scCs d}d}|j||dS(Ns[i for i in d.iterkeys()]s[i for i in d.keys()](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_14>scCs d}d}|j||dS(Ns(i for i in d.keys())s(i for i in list(d.keys()))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_15CscCs d}d}|j||dS(Ns(i for i in d.iterkeys())s(i for i in d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_16HscCs d}d}|j||dS(Nsiter(d.iterkeys())siter(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_17MscCs d}d}|j||dS(Nslist(d.iterkeys())slist(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_18RscCs d}d}|j||dS(Nssorted(d.iterkeys())ssorted(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_19WscCs d}d}|j||dS(Nsfoo(d.iterkeys())sfoo(iter(d.keys()))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_20\scCs d}d}|j||dS(Nsprint h.iterkeys().next()sprint iter(h.keys()).next()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_21ascCs d}d}|j||dS(Nsprint h.keys()[0]sprint list(h.keys())[0](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_22fscCs d}d}|j||dS(Nsprint list(h.iterkeys().next())s!print list(iter(h.keys()).next())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_23kscCs d}d}|j||dS(Nsfor x in h.keys()[0]: print xs#for x in list(h.keys())[0]: print x(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_24pscCs d}d}|j||dS(Nsd.viewkeys()sd.keys()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_25uscCs d}d}|j||dS(Ns
d.viewitems()s	d.items()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_26zscCs d}d}|j||dS(Nsd.viewvalues()s
d.values()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_27scCs d}d}|j||dS(Ns[i for i in d.viewkeys()]s[i for i in d.keys()](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_28scCs d}d}|j||dS(Ns(i for i in d.viewkeys())s(i for i in d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_29scCs d}d}|j||dS(Nsiter(d.viewkeys())siter(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_30scCs d}d}|j||dS(Nslist(d.viewkeys())slist(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_31scCs d}d}|j||dS(Nssorted(d.viewkeys())ssorted(d.keys())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_32s(&R9R.R
RhRRjRRRRRRRRRRMRNRRRRRRRRRRRRRRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRsH																																			tTest_xrangecBs_eZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
txrangecCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsx =    xrange(  10  )sx =    range(  10  )sx = xrange(  1  ,  10   )sx = range(  1  ,  10   )sx = xrange(  0  ,  10 ,  2 )sx = range(  0  ,  10 ,  2 )(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhscCs d}d}|j||dS(Nsx = xrange(10)s
x = range(10)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_single_argscCs d}d}|j||dS(Nsx = xrange(1, 10)sx = range(1, 10)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_two_argsscCs d}d}|j||dS(Nsx = xrange(0, 10, 2)sx = range(0, 10, 2)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_three_argsscCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||dS(Nsx = range(10, 3, 9)sx = list(range(10, 3, 9))sx = foo(range(10, 3, 9))sx = foo(list(range(10, 3, 9)))sx = range(10, 3, 9) + [4]sx = list(range(10, 3, 9)) + [4]sx = range(10)[::-1]sx = list(range(10))[::-1]sx = range(10)  [3]sx = list(range(10))  [3](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_wrap_in_listscCs<d}d}|j||d}d}|j||dS(Nsfor i in xrange(10):
    j=isfor i in range(10):
    j=is[i for i in xrange(10)]s[i for i in range(10)](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_xrange_in_forscCs|jd|jddS(Nsfor i in range(10): passs[i for i in range(10)](R&(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_range_in_fors
cCs|jddS(Nsx in range(10, 3, 9)(R&(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_in_contains_testscCs)x"tjD]}|jd|q
WdS(Nsa = %s(range(10))(RRR&(Rtcall((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_in_consuming_contexts(R9R.R
RhRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs	
								tTest_xrange_with_reducecBseZdZdZRS(cCs tt|jddgdS(NRRl(tsuperRR(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Nsreduce(x, xrange(5))s0from functools import reduce
reduce(x, range(5))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_double_transforms(R9R.RR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs	tTest_raw_inputcBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	t	raw_inputcCs<d}d}|j||d}d}|j||dS(Nsx =    raw_input(   )sx =    input(   )sx = raw_input(   ''   )sx = input(   ''   )(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhscCs d}d}|j||dS(Nsx = raw_input()sx = input()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Nsx = raw_input('')s
x = input('')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Nsx = raw_input('prompt')sx = input('prompt')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Nsx = raw_input(foo(a) + 6)sx = input(foo(a) + 6)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGscCs d}d}|j||dS(Nsx = raw_input(invite).split()sx = input(invite).split()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRHscCs d}d}|j||dS(Ns x = raw_input(invite) . split ()sx = input(invite) . split ()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRIscCs d}d}|j||dS(Nsx = int(raw_input())sx = int(input())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRKs(R9R.R
RhRDRERFRGRHRIRK(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs								tTest_funcattrscBs;eZdZdddddddgZdZd	ZRS(
t	funcattrstclosuretdoctnametdefaultstcodetglobalsRcCs`xY|jD]N}d|}d|}|j||d|}d|}|j||q
WdS(Ns	a.func_%ssa.__%s__sself.foo.func_%s.foo_barsself.foo.__%s__.foo_bar(tattrsR!(RtattrR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRi$s



cCs]xV|jD]K}d|}|j|d|}|j|d|}|j|q
WdS(Nsfoo(func_%s + 5)s
f(foo.__%s__)sf(foo.__%s__.foo)(RR&(RRRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRj.s




(R9R.R
RRiRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs	
tTest_xreadlinescBs)eZdZdZdZdZRS(t
xreadlinescCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsfor x in f.xreadlines(): passsfor x in f: passs!for x in foo().xreadlines(): passsfor x in foo(): passs'for x in (5 + foo()).xreadlines(): passsfor x in (5 + foo()): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRV<scCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsfoo(f.xreadlines + 5)sfoo(f.__iter__ + 5)sfoo(f().xreadlines + 5)sfoo(f().__iter__ + 5)sfoo((5 + f()).xreadlines + 5)sfoo((5 + f()).__iter__ + 5)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_attr_refIscCsPd}|j|d}|j|d}|j|d}|j|dS(Nsfor x in f.xreadlines(5): passs for x in f.xreadlines(k=5): passs$for x in f.xreadlines(*k, **v): passsfoo(xreadlines)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjVs


(R9R.R
RVRRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR9s	
	
tImportsFixerTestscBs>eZdZdZdZdZdZdZRS(cCslxe|jjD]T\}}d|}d|}|j||d|}d|}|j||qWdS(Ns	import %ssimport foo, %s, bar(tmodulestitemsR!(RtoldtnewR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_modulefs



cCsx|jjD]x\}}d|}d|}|j||d|}d|}|j||d|}d|}|j||qWdS(Nsfrom %s import foosfrom %s import foo, barsfrom %s import (yes, no)(RRR!(RRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_fromps





cCslxe|jjD]T\}}d|}d|}|j||d|}d|}|j||qWdS(Nsimport %s as foo_bar(RRR!(RRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_module_as~s



cCsHxA|jjD]0\}}d|}d|}|j||qWdS(Nsfrom %s import foo as bar(RRR!(RRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_from_ass

cCsHxA|jjD]0\}}d|}d|}|j||qWdS(Nsfrom %s import *(RRR!(RRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_stars

cCsx|jjD]\}}d||f}d||f}|j||d||f}d||f}|j||d|f}|j|d|||f}d|||f}|j||d||f}d||f}|j||qWdS(NsG
                import %s
                foo(%s.bar)
                sJ
                from %s import x
                %s = 23
                sJ
                def f():
                    %s.method()
                sJ
                import %s
                %s.bar(%s.foo)
                s@
                import %s
                x.%s
                (RRR!R&(RRRR=R>RY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_module_usages

(R9R.RRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRds	
		
		tTest_importscBs0eZdZddlmZdZdZRS(timportsi(tMAPPINGcCs d}d}|j||dS(Nsimport urlparse, cStringIOsimport urllib.parse, io(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_multiple_importsscCs d}d}|j||dS(Nsv
            import copy_reg as bar, HTMLParser as foo, urlparse
            s = urlparse.spam(bar.foo())
            s~
            import copyreg as bar, html.parser as foo, urllib.parse
            s = urllib.parse.spam(bar.foo())
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_multiple_imports_ass(R9R.R
tfixes.fix_importsR
RRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs	t
Test_imports2cBseZdZddlmZRS(timports2i(R
(R9R.R
tfixes.fix_imports2R
R(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRstTest_imports_fixer_ordercBseZdZdZRS(cCsqtt|jddgddlm}|j|_ddlm}xd	D]}|||j|<qRWdS(
NR	Ri(R
tdbhashtdumbdbmtdbmtgdbm(RRRR(RRRRR
tcopyRR
(Rtmapping2tmapping1tkey((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs
cCs+x$dD]}||_|jdqWdS(NR	Rtimport(R	R(R
R8(Rtfix((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt$test_after_local_imports_refactorings
	(R9R.RR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs	tTest_urllibcBs]eZdZddlmZdZdZdZdZ	dZ
dZd	ZRS(
turllibi(R
cCs`xY|jjD]H\}}d|}ddjttd|}|j||qWdS(Ns	import %ss, i(RRR$tmapRR!(RRtchangesR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs
"c
Cslxe|jjD]T\}}g}x|D]\}}xb|D]Z}|j|d||f}d||f}|j||d|}	|j|	q<Wd|dj|f}d|dj|f}|j||ddj|}	|j|	q)Wd|dj|f}djg|D]%\}}d|dj|f^q&}|j||qWdS(Nsfrom %s import %ssfrom foo import %ss, s
(RRtappendR!R&R$(
RRR tall_membersRtmemberstmemberR=R>RY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs&


	2cCs2x+|jD] }d|}|j|dq
WdS(Nsimport %s as foos#This module is now multiple modules(RR)(RRRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs
cCsx|jjD]\}}x|D]\}}xt|D]l}d||f}d||f}|j||d|||f}d|||f}|j||q6Wq#WqWdS(Nsfrom %s import %s as foo_barsfrom %s import %s as blah, %s(RRR!(RRR RR#R$R=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs
cCs2x+|jD] }d|}|j|dq
WdS(Nsfrom %s import *sCannot handle star imports(RR)(RRRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR$s
cCs<d}d}|j||d}d}|j||dS(Ns6
def foo():
    from urllib import urlencode, urlopen
sZ
def foo():
    from urllib.parse import urlencode
    from urllib.request import urlopen
sB
def foo():
    other()
    from urllib import urlencode, urlopen
sf
def foo():
    other()
    from urllib.parse import urlencode
    from urllib.request import urlopen
(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_indented)sc	Csx|jjD]\}}x|D]\}}x|D]}djg|j|D]\}}|^qP}d|||f}	d|||f}
|j|	|
d|||||f}	d|||||f}
|j|	|
q6Wq#WqWdS(Ns, s^
                        import %s
                        foo(%s.%s)
                        s`
                        import %s
                        %s.%s(%s.%s)
                        (RRR$R!(RRR RR#R$R6tmemst
new_importR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDs
	&(
R9R.R
tfixes.fix_urllibR
RRRRRRR%R(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs						t
Test_inputcBsMeZdZdZdZdZdZdZdZdZ	RS(tinputcCs<d}d}|j||d}d}|j||dS(Nsx =   input(   )sx =   eval(input(   ))sx = input(   ''   )sx = eval(input(   ''   ))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhascCs d}d}|j||dS(Nsx = input()  #  foosx = eval(input())  #  foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjscCs=d}|j|d}|j|d}|j|dS(Nsx = eval(input())sx = eval(input(''))sx = eval(input(foo(5) + 9))(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRros

cCs d}d}|j||dS(Nsx = input()sx = eval(input())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDyscCs d}d}|j||dS(Ns
x = input('')sx = eval(input(''))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRE~scCs d}d}|j||dS(Nsx = input('prompt')sx = eval(input('prompt'))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Nsx = input(foo(5) + 9)sx = eval(input(foo(5) + 9))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGs(
R9R.R
RhRRrRDRERFRG(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR)^s				
			tTest_tuple_paramscBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZRS(ttuple_paramscCsd}|j|dS(Nsdef foo(): pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRZscCsd}|j|dS(Nsdef foo(a, b, c): pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR[scCsd}|j|dS(Nsdef foo(a=3, b=4, c=5): pass(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR\scCs d}d}|j||dS(Ns8
            def foo(((a, b), c)):
                x = 5sn
            def foo(xxx_todo_changeme):
                ((a, b), c) = xxx_todo_changeme
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Ns;
            def foo(((a, b), c), d):
                x = 5sq
            def foo(xxx_todo_changeme, d):
                ((a, b), c) = xxx_todo_changeme
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Ns@
            def foo(((a, b), c), d) -> e:
                x = 5sv
            def foo(xxx_todo_changeme, d) -> e:
                ((a, b), c) = xxx_todo_changeme
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Ns/
            def foo(((a, b), c)): x = 5; y = 7sV
            def foo(xxx_todo_changeme): ((a, b), c) = xxx_todo_changeme; x = 5; y = 7(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_semicolonscCs d}d}|j||dS(NsE
            def foo(((a, b), c), d, e=5) -> z:
                x = 5s{
            def foo(xxx_todo_changeme, d, e=5) -> z:
                ((a, b), c) = xxx_todo_changeme
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_keywordsscCs d}d}|j||dS(NsR
            def foo(((a, b), c), d, *vargs, **kwargs) -> z:
                x = 5s
            def foo(xxx_todo_changeme, d, *vargs, **kwargs) -> z:
                ((a, b), c) = xxx_todo_changeme
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_varargsscCs d}d}|j||dS(NsH
            def foo(((a, b), c), (d, e, f)) -> z:
                x = 5s
            def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z:
                ((a, b), c) = xxx_todo_changeme
                (d, e, f) = xxx_todo_changeme1
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_multi_1scCs d}d}|j||dS(NsQ
            def foo(x, ((a, b), c), d, (e, f, g), y) -> z:
                x = 5s
            def foo(x, xxx_todo_changeme, d, xxx_todo_changeme1, y) -> z:
                ((a, b), c) = xxx_todo_changeme
                (e, f, g) = xxx_todo_changeme1
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_multi_2scCs d}d}|j||dS(Nsj
            def foo(((a, b), c), (d, e, f)) -> z:
                "foo foo foo foo"
                x = 5s
            def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z:
                "foo foo foo foo"
                ((a, b), c) = xxx_todo_changeme
                (d, e, f) = xxx_todo_changeme1
                x = 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_docstringscCsd}|j|dS(Nslambda x: x + 5(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_no_changescCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(Nslambda (x): x + 5slambda x: x + 5slambda(x): x + 5slambda ((((x)))): x + 5slambda((((x)))): x + 5(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_parens_single_argscCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(Nslambda (x, y): x + f(y)slambda x_y: x_y[0] + f(x_y[1])slambda(x, y): x + f(y)slambda (((x, y))): x + f(y)slambda(((x, y))): x + f(y)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_simplescCs<d}d}|j||d}d}|j||dS(Nslambda (x,): x + f(x)slambda x1: x1[0] + f(x1[0])slambda (((x,))): x + f(x)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_one_tuple'scCs d}d}|j||dS(Nslambda (x, y): x + x + f(x) + xs0lambda x_y: x_y[0] + x_y[0] + f(x_y[0]) + x_y[0](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_simple_multi_use0scCs d}d}|j||dS(Nslambda (x, y): y + xslambda x_y: x_y[1] + x_y[0](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_simple_reverse5scCs<d}d}|j||d}d}|j||dS(Nslambda (x, (y, z)): x + y + zs2lambda x_y_z: x_y_z[0] + x_y_z[1][0] + x_y_z[1][1]s!lambda (((x, (y, z)))): x + y + z(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_nested:scCs d}d}|j||dS(Ns lambda (x, (y, z)): x + y + f(y)s5lambda x_y_z: x_y_z[0] + x_y_z[1][0] + f(x_y_z[1][0])(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_lambda_nested_multi_useCs(R9R.R
RZR[R\RDRERFR-R.R/R0R1R2R3R4R5R6R7R8R9R:(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR+s*																					tTest_methodattrscBs/eZdZdddgZdZdZRS(tmethodattrstfuncRtclasscCsx|jD]x}d|}|dkr/d}n
d|}|j||d|}|dkrhd}n
d|}|j||q
WdS(Nsa.im_%sR>sa.__self__.__class__sa.__%s__sself.foo.im_%s.foo_bars#self.foo.__self__.__class__.foo_barsself.foo.__%s__.foo_bar(RR!(RRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRiMs
	

	
cCs]xV|jD]K}d|}|j|d|}|j|d|}|j|q
WdS(Nsfoo(im_%s + 5)s
f(foo.__%s__)sf(foo.__%s__.foo)(RR&(RRRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRj]s




(R9R.R
RRiRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR;Hs	t	Test_nextcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/RS(.tnextcCs d}d}|j||dS(Ns	it.next()snext(it)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDkscCs d}d}|j||dS(Nsa.b.c.d.next()s
next(a.b.c.d)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREpscCs d}d}|j||dS(Ns(a + b).next()s
next((a + b))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFuscCs d}d}|j||dS(Ns
a().next()s	next(a())(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGzscCs d}d}|j||dS(Nsa().next() + bs
next(a()) + b(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRHscCs d}d}|j||dS(Nsc(      a().next() + b)sc(      next(a()) + b)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRIscCs d}d}|j||dS(NsU
            for a in b:
                foo(a)
                a.next()
            sT
            for a in b:
                foo(a)
                next(a)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation_1scCs d}d}|j||dS(Nsq
            for a in b:
                foo(a) # abc
                # def
                a.next()
            sp
            for a in b:
                foo(a) # abc
                # def
                next(a)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation_2scCs&d}d}|j||dtdS(Nsj
            next = 5
            for a in b:
                foo(a)
                a.next()
            sn
            next = 5
            for a in b:
                foo(a)
                a.__next__()
            R (R!R((RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation_3scCs&d}d}|j||dtdS(Ns
            next = 5
            for a in b:
                foo(a) # abc
                # def
                a.next()
            s
            next = 5
            for a in b:
                foo(a) # abc
                # def
                a.__next__()
            R (R!R((RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation_4scCs&d}d}|j||dtdS(Nsz
            next = 5
            for a in b:
                foo(foo(a), # abc
                    a.next())
            s~
            next = 5
            for a in b:
                foo(foo(a), # abc
                    a.__next__())
            R (R!R((RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation_5scCs d}d}|j||dS(Nse
            for a in b:
                foo(foo(a), # abc
                    a.next())
            sd
            for a in b:
                foo(foo(a), # abc
                    next(a))
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix_preservation_6scCs d}d}|j||dS(Ns[
            class A:
                def next(self):
                    pass
            s_
            class A:
                def __next__(self):
                    pass
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_method_1scCs d}d}|j||dS(Nsc
            class A(object):
                def next(self):
                    pass
            sg
            class A(object):
                def __next__(self):
                    pass
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_method_2scCs d}d}|j||dS(NsX
            class A:
                def next(x):
                    pass
            s\
            class A:
                def __next__(x):
                    pass
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_method_3scCs d}d}|j||dS(Ns
            class A:
                def __init__(self, foo):
                    self.foo = foo

                def next(self):
                    pass

                def __iter__(self):
                    return self
            s
            class A:
                def __init__(self, foo):
                    self.foo = foo

                def __next__(self):
                    pass

                def __iter__(self):
                    return self
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_method_4	scCsd}|j|dS(Nsa
            class A:
                def next(self, a, b):
                    pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_method_unchanged!	scCsd}|j|ddS(Nsy
            next = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_assign_simple)	scCsd}|j|ddS(Ns~
            (next, a) = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_assign_tuple_13	scCsd}|j|ddS(Ns
            (a, (b, (next, c)), a) = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_assign_tuple_2=	scCsd}|j|ddS(Ns~
            [next, a] = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_assign_list_1G	scCsd}|j|ddS(Ns
            [a, [b, [next, c]], a] = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_assign_list_2Q	scCsd}|j|ddS(Ns
            def foo():
                __builtin__.next = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_builtin_assign[	scCsd}|j|ddS(Ns
            def foo():
                (a, __builtin__.next) = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_builtin_assign_in_tuplef	scCsd}|j|ddS(Ns
            def foo():
                [a, __builtin__.next] = foo

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_builtin_assign_in_listq	scCsd}|j|dS(Ns
            def foo():
                A.next = foo

            class A:
                def next(self, a, b):
                    pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_assign_to_next|	scCsd}|j|dS(Ns
            def foo():
                (a, A.next) = foo

            class A:
                def next(self, a, b):
                    pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_assign_to_next_in_tuple	scCsd}|j|dS(Ns
            def foo():
                [a, A.next] = foo

            class A:
                def next(self, a, b):
                    pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_assign_to_next_in_list	scCsd}|j|ddS(Ns
            import foo.bar as next

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_1	scCsd}|j|ddS(Ns
            import bar, bar.foo as next

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_2	scCsd}|j|ddS(Ns
            import bar, bar.foo as next, baz

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_3	scCsd}|j|ddS(Ns
            from x import next

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_from_1	scCsd}|j|ddS(Ns
            from x.a import next

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_from_2	scCsd}|j|ddS(Ns
            from x import a, next, b

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_from_3	scCsd}|j|ddS(Ns
            from x.a import a, next, b

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_import_from_4	scCsd}|j|ddS(Ns
            def next(a):
                pass

            class A:
                def next(self, a, b):
                    pass
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_funcdef_1	scCs#d}d}|j||ddS(Ns
            def next(a):
                pass

            class A:
                def next(self):
                    pass

            it.next()
            s
            def next(a):
                pass

            class A:
                def __next__(self):
                    pass

            it.__next__()
            s)Calls to builtin next() possibly shadowed(R'(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_funcdef_2	s

cCsd}|j|ddS(NsW
            def f():
                global next
                next = 5
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_global_1
scCsd}|j|ddS(Ns]
            def f():
                global a, next, b
                next = 5
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_global_2
scCsd}|j|ddS(Nse
            for next in it():
                pass

            b = 5
            c = 6
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_for_simple
scCsd}|j|ddS(Nsh
            for next, b in it():
                pass

            b = 5
            c = 6
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_for_tuple_1
scCsd}|j|ddS(Nsp
            for a, (next, c), b in it():
                pass

            b = 5
            c = 6
            s)Calls to builtin next() possibly shadowed(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_shadowing_for_tuple_2)
scCs d}d}|j||dS(Nsgnext = g.nextsgnext = g.__next__(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_noncall_access_13
scCs d}d}|j||dS(Ns
f(g.next + 5)sf(g.__next__ + 5)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_noncall_access_28
scCs d}d}|j||dS(Nsf(g().next + 5)sf(g().__next__ + 5)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_noncall_access_3=
s(0R9R.R
RDRERFRGRHRIRARBRCRDRERFRGRHRIRJRKRLRMRNRORPRQRRRSRTRURVRWRXRYRZR[R\R]R^R_R`RaRbRcRdReRfRg(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR?hs\							
					
	
	
	
			
	
	
	
	
							
	
	
	
	
	
	
					
	
	
		tTest_nonzerocBs;eZdZdZdZdZdZdZRS(tnonzerocCs d}d}|j||dS(Nsb
            class A:
                def __nonzero__(self):
                    pass
            s_
            class A:
                def __bool__(self):
                    pass
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDE
scCs d}d}|j||dS(Nsj
            class A(object):
                def __nonzero__(self):
                    pass
            sg
            class A(object):
                def __bool__(self):
                    pass
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRER
scCsd}|j|dS(Nsg
            class A(object):
                def __bool__(self):
                    pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRZ_
scCsd}|j|dS(Nsm
            class A(object):
                def __nonzero__(self, a):
                    pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR[g
scCsd}|j|dS(NsE
            def __nonzero__(self):
                pass
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_funco
s(R9R.R
RDRERZR[Rj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhB
s	
	
		tTest_numliteralscBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZRS(tnumliteralscCs d}d}|j||dS(Nt0755t0o755(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_octal_1y
scCs d}d}|j||dS(Nsa = 12Lsa = 12(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_long_int_1~
scCs d}d}|j||dS(Nsa = 12lsa = 12(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_long_int_2
scCs d}d}|j||dS(Ns	b = 0x12lsb = 0x12(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_long_hex
scCs<d}d}|j||d}d}|j||dS(Nsb =   0x12Ls
b =   0x12sb = 0755 # spamsb = 0o755 # spam(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_comments_and_spacing
scCsd}|j|dS(Nt5(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_int
scCsd}|j|dS(Ns5.0(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_float
scCsd}|j|dS(NRn(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_octal
scCsd}|j|dS(Nt0xABC(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_hex
scCsd}|j|dS(Ns5.0e10(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_exp
scCsd}|j|dS(Ns5 + 4j(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_complex_int
scCsd}|j|dS(Ns
5.4 + 4.9j(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_complex_float
scCs*d}|j|d}|j|dS(Nt4js4.4j(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_complex_bare
s
(R9R.R
RoRpRqRrRsRuRvRwRyRzR{R|R~(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRkv
s													tTest_renamescBs?eZdZidd6ZdZdZdZdZRS(	trenamestmaxinttmaxsizetsyscCsqxj|jjD]Y\}\}}d||f}d||f}|j||d|}|j|qWdS(Nsfrom %s import %ssfrom foo import %s(RRR!R&(RtmodRRR=R>RY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s"
cCsZxS|jjD]B\}\}}d||f}d||f}|j||qWdS(Nsfrom %s import %s as foo_bar(RRR!(RRRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s"cCsfx_|jjD]N\}\}}d||||f}d||||f}|j||qWdS(NsJ
                import %s
                foo(%s, %s.%s)
                (RRR!(RRRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s"cCsfx_|jjD]N\}\}}d||||f}d||||f}|j||qWdS(NsO
                from %s import %s
                foo(%s, %s)
                (RRR!(RRRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytXXX_test_from_import_usage
s"(RR(R9R.R
RRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s
				tTest_unicodecBsheZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZRS(RcCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsunicode( x)sstr( x)s unicode(x )s str(x )s u'h's 'h'(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_whitespace
scCs d}d}|j||dS(Nsunicode(x, y, z)sstr(x, y, z)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unicode_call
scCs d}d}|j||dS(Nsunichr(u'h')schr('h')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unichr
scCs d}d}|j||dS(Nsu"x"s"x"(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unicode_literal_1scCs d}d}|j||dS(Nsur'x'sr'x'(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unicode_literal_2scCs d}d}|j||dS(Ns
UR'''x''' s	R'''x''' (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unicode_literal_3
scCs<d}d}|j||d}d}|j||dS(Ns'\\\u20ac\U0001d121\\u20ac's'\\\\u20ac\\U0001d121\\u20ac'sr'\\\u20ac\U0001d121\\u20ac'(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_native_literal_escape_uscCs<d}d}|j||d}d}|j||dS(Nsb'\\\u20ac\U0001d121\\u20ac'sbr'\\\u20ac\U0001d121\\u20ac'(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bytes_literal_escape_uscCs<d}d}|j||d}d}|j||dS(Nsu'\\\u20ac\U0001d121\\u20ac's'\\\u20ac\U0001d121\\u20ac'sur'\\\u20ac\U0001d121\\u20ac'sr'\\\u20ac\U0001d121\\u20ac'(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unicode_literal_escape_u!scCsRd}|d}|d}|j|||d}|d}|j||dS(Ns(from __future__ import unicode_literals
s'\\\u20ac\U0001d121\\u20ac'sr'\\\u20ac\U0001d121\\u20ac'(R!(RtfR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt$test_native_unicode_literal_escape_u*s



(
R9R.R
RRRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s	
											tTest_filtercBs2eZdZdZdZdZdZRS(tfiltercCs<d}d}|j||d}d}|j||dS(Ns#x =   filter(    foo,     'abc'   )s)x =   list(filter(    foo,     'abc'   ))sx =   filter(  None , 'abc'  )s x =   [_f for _f in 'abc' if _f](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRh8scCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(Nsx = filter(None, 'abc')sx = [_f for _f in 'abc' if _f]sx = len(filter(f, 'abc'))sx = len(list(filter(f, 'abc')))s)x = filter(lambda x: x%2 == 0, range(10))s&x = [x for x in range(10) if x%2 == 0]s+x = filter(lambda (x): x%2 == 0, range(10))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_filter_basicAscCsmd}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d	}|j|d
}|j|d}|j|d}|j|d
}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|dS(Nsb.join(filter(f, 'abc'))s#(a + foo(5)).join(filter(f, 'abc'))siter(filter(f, 'abc'))slist(filter(f, 'abc'))slist(filter(f, 'abc'))[0]sset(filter(f, 'abc'))sset(filter(f, 'abc')).pop()stuple(filter(f, 'abc'))sany(filter(f, 'abc'))sall(filter(f, 'abc'))ssum(filter(f, 'abc'))ssorted(filter(f, 'abc'))s"sorted(filter(f, 'abc'), key=blah)s%sorted(filter(f, 'abc'), key=blah)[0]senumerate(filter(f, 'abc'))s$enumerate(filter(f, 'abc'), start=1)sfor i in filter(f, 'abc'): passs[x for x in filter(f, 'abc')]s(x for x in filter(f, 'abc'))(R&(RR>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_filter_nochangeXsL

















cCsFd}|j|d}d}|j||d}|j|dS(Ns:from future_builtins import spam, filter; filter(f, 'ham')s6from future_builtins import spam; x = filter(f, 'abc')s<from future_builtins import spam; x = list(filter(f, 'abc'))s/from future_builtins import *; filter(f, 'ham')(R&R!(RR>R=((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_future_builtinss
(R9R.R
RhRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR5s
				(tTest_mapcBsMeZdZdZdZdZdZdZdZdZ	RS(RcCs1|jd||tt|j||dS(Ns!from future_builtins import map; (R&RRR!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR!scCs d}d}|j||dS(Nsx =    map(   f,    'abc'   )s#x =    list(map(   f,    'abc'   ))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRhscCs d}d}|j||dS(Nsx = map(f, 'abc')   #   foos!x = list(map(f, 'abc'))   #   foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCsd}|j|ddS(Nsx = map(None, a, b, c)s5cannot convert map(None, ...) with multiple arguments(R)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt!test_None_with_multiple_argumentsscCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d}|j||d
}d}|j||ddS(
Nsx = map(f, 'abc')sx = list(map(f, 'abc'))sx = len(map(f, 'abc', 'def'))s#x = len(list(map(f, 'abc', 'def')))sx = map(None, 'abc')sx = list('abc')s x = map(lambda x: x+1, range(4))sx = [x+1 for x in range(4)]s"x = map(lambda (x): x+1, range(4))sG
            foo()
            # foo
            map(f, x)
            sM
            foo()
            # foo
            list(map(f, x))
            sYou should use a for loop here(R!R'(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_map_basics$cCsmd}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d	}|j|d
}|j|d}|j|d}|j|d
}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|dS(Nsb.join(map(f, 'abc'))s (a + foo(5)).join(map(f, 'abc'))siter(map(f, 'abc'))slist(map(f, 'abc'))slist(map(f, 'abc'))[0]sset(map(f, 'abc'))sset(map(f, 'abc')).pop()stuple(map(f, 'abc'))sany(map(f, 'abc'))sall(map(f, 'abc'))ssum(map(f, 'abc'))ssorted(map(f, 'abc'))ssorted(map(f, 'abc'), key=blah)s"sorted(map(f, 'abc'), key=blah)[0]senumerate(map(f, 'abc'))s!enumerate(map(f, 'abc'), start=1)sfor i in map(f, 'abc'): passs[x for x in map(f, 'abc')]s(x for x in map(f, 'abc'))(R&(RR>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_map_nochangesL

















cCsFd}|j|d}d}|j||d}|j|dS(Ns:from future_builtins import spam, map, eggs; map(f, 'ham')s9from future_builtins import spam, eggs; x = map(f, 'abc')s?from future_builtins import spam, eggs; x = list(map(f, 'abc'))s,from future_builtins import *; map(f, 'ham')(R&R!(RR>R=((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs
(
R9R.R
R!RhRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs					'	(tTest_zipcBs2eZdZdZdZdZdZRS(tzipcCs1|jd||tt|j||dS(Ns!from future_builtins import zip; (R&RRR!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR!scCs<d}d}|j||d}d}|j||dS(Nsx = zip(a, b, c)sx = list(zip(a, b, c))sx = len(zip(a, b))sx = len(list(zip(a, b)))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_zip_basicscCsmd}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d	}|j|d
}|j|d}|j|d}|j|d
}|j|d}|j|d}|j|d}|j|d}|j|d}|j|d}|j|dS(Nsb.join(zip(a, b))s(a + foo(5)).join(zip(a, b))siter(zip(a, b))slist(zip(a, b))slist(zip(a, b))[0]sset(zip(a, b))sset(zip(a, b)).pop()stuple(zip(a, b))sany(zip(a, b))sall(zip(a, b))ssum(zip(a, b))ssorted(zip(a, b))ssorted(zip(a, b), key=blah)ssorted(zip(a, b), key=blah)[0]senumerate(zip(a, b))senumerate(zip(a, b), start=1)sfor i in zip(a, b): passs[x for x in zip(a, b)]s(x for x in zip(a, b))(R&(RR>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_zip_nochangesL

















cCsFd}|j|d}d}|j||d}|j|dS(Ns6from future_builtins import spam, zip, eggs; zip(a, b)s5from future_builtins import spam, eggs; x = zip(a, b)s;from future_builtins import spam, eggs; x = list(zip(a, b))s(from future_builtins import *; zip(a, b)(R&R!(RR>R=((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR3s
(R9R.R
R!RRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs
				(tTest_standarderrorcBseZdZdZRS(t
standarderrorcCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsx =    StandardError()sx =    Exception()sx = StandardError(a, b, c)sx = Exception(a, b, c)sf(2 + StandardError(a, b, c))sf(2 + Exception(a, b, c))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRiAs(R9R.R
Ri(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR>st
Test_typescBseZdZdZRS(ttypescCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d}|j||d
}d}|j||d}d
}|j||dS(Nstypes.StringTypetbytesstypes.DictTypeRstypes . IntTypetintstypes.ListTypetliststypes.LongTypestypes.NoneTypes
type(None)stypes.StringTypess(str,)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_basic_types_convertQs*(R9R.R
R(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRNstTest_idiomscBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZRS(tidiomscCsXd}d}|j||d}d}|j||d}d}|j||dS(Nswhile 1: foo()swhile True: foo()swhile   1: foo()swhile   True: foo()s8
            while 1:
                foo()
            s;
            while True:
                foo()
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_whileqscCsPd}|j|d}|j|d}|j|d}|j|dS(Nswhile 11: foo()swhile 0: foo()swhile foo(): foo()swhile []: foo()(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_while_unchangeds


cCs<d}d}|j||d}d}|j||dS(Nstype(x) == Tsisinstance(x, T)sif   type(x) == T: passsif   isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_eq_simplescCs<d}d}|j||d}d}|j||dS(NsT == type(x)sisinstance(x, T)sif   T == type(x): passsif   isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_eq_reversescCs<d}d}|j||d}d}|j||dS(Nstype(x+y) == d.get('T')sisinstance(x+y, d.get('T'))stype(   x  +  y) == d.get('T')sisinstance(x  +  y, d.get('T'))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_eq_expressionscCs<d}d}|j||d}d}|j||dS(Nstype(x) is Tsisinstance(x, T)sif   type(x) is T: passsif   isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_is_simplescCs<d}d}|j||d}d}|j||dS(NsT is type(x)sisinstance(x, T)sif   T is type(x): passsif   isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_is_reversescCs<d}d}|j||d}d}|j||dS(Nstype(x+y) is d.get('T')sisinstance(x+y, d.get('T'))stype(   x  +  y) is d.get('T')sisinstance(x  +  y, d.get('T'))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_is_expressionscCs<d}d}|j||d}d}|j||dS(Nstype(x) is not Tsnot isinstance(x, T)sif   type(x) is not T: passsif   not isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_is_not_simplescCs<d}d}|j||d}d}|j||dS(NsT is not type(x)snot isinstance(x, T)sif   T is not type(x): passsif   not isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_is_not_reversescCs<d}d}|j||d}d}|j||dS(Nstype(x+y) is not d.get('T')snot isinstance(x+y, d.get('T'))s"type(   x  +  y) is not d.get('T')s#not isinstance(x  +  y, d.get('T'))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_is_not_expressionscCs<d}d}|j||d}d}|j||dS(Nstype(x) != Tsnot isinstance(x, T)sif   type(x) != T: passsif   not isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_ne_simplescCs<d}d}|j||d}d}|j||dS(NsT != type(x)snot isinstance(x, T)sif   T != type(x): passsif   not isinstance(x, T): pass(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_ne_reversescCs<d}d}|j||d}d}|j||dS(Nstype(x+y) != d.get('T')snot isinstance(x+y, d.get('T'))stype(   x  +  y) != d.get('T')s#not isinstance(x  +  y, d.get('T'))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_ne_expressionscCsd}|j|dS(Nstype(x).__name__(R&(RR>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_type_unchangedscCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||d}d}|j||d
}d}|j||d}d}|j||dS(NsM
            v = list(t)
            v.sort()
            foo(v)
            s:
            v = sorted(t)
            foo(v)
            sV
            v = list(foo(b) + d)
            v.sort()
            foo(v)
            sC
            v = sorted(foo(b) + d)
            foo(v)
            sn
            while x:
                v = list(t)
                v.sort()
                foo(v)
            sW
            while x:
                v = sorted(t)
                foo(v)
            s_
            v = list(t)
            # foo
            v.sort()
            foo(v)
            sL
            v = sorted(t)
            # foo
            foo(v)
            sP
            v = list(   t)
            v.sort()
            foo(v)
            s=
            v = sorted(   t)
            foo(v)
            sl
            try:
                m = list(s)
                m.sort()
            except: pass
            sU
            try:
                m = sorted(s)
            except: pass
            s
            try:
                m = list(s)
                # foo
                m.sort()
            except: pass
            sk
            try:
                m = sorted(s)
                # foo
            except: pass
            sI
            m = list(s)
            # more comments
            m.sort()s6
            m = sorted(s)
            # more comments(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_sort_list_call
s0cCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||d}d}|j||d
}d}|j||dS(NsG
            v = t
            v.sort()
            foo(v)
            s:
            v = sorted(t)
            foo(v)
            sL
            v = foo(b)
            v.sort()
            foo(v)
            s?
            v = sorted(foo(b))
            foo(v)
            sN
            v = b.keys()
            v.sort()
            foo(v)
            sA
            v = sorted(b.keys())
            foo(v)
            sP
            v = foo(b) + d
            v.sort()
            foo(v)
            sC
            v = sorted(foo(b) + d)
            foo(v)
            sh
            while x:
                v = t
                v.sort()
                foo(v)
            sW
            while x:
                v = sorted(t)
                foo(v)
            sY
            v = t
            # foo
            v.sort()
            foo(v)
            sL
            v = sorted(t)
            # foo
            foo(v)
            sI
            v =   t
            v.sort()
            foo(v)
            s<
            v =   sorted(t)
            foo(v)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_sort_simple_expre
s*cCs*d}|j|d}|j|dS(NsM
            v = list(t)
            w.sort()
            foo(w)
            sN
            v = list(t)
            v.sort(u)
            foo(v)
            (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_sort_unchanged
s
(R9R.R
RRRRRRRRRRRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRns&		
																										d	RtTest_basestringcBseZdZdZRS(t
basestringcCs d}d}|j||dS(Nsisinstance(x, basestring)sisinstance(x, str)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_basestring
s(R9R.R
R(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
stTest_buffercBs eZdZdZdZRS(tbuffercCs d}d}|j||dS(Ns
x = buffer(y)sx = memoryview(y)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_buffer
scCs d}d}|j||dS(Nsbuffer(y)[4:5]smemoryview(y)[4:5](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_slicing
s(R9R.R
RR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s	tTest_futurecBs eZdZdZdZRS(tfuturecCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsfrom __future__ import bracesR"s'# comment
from __future__ import bracess
# comment
s'from __future__ import braces
# comments

# comment(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_future
scCs|jddS(NRq(R8(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_run_order
s(R9R.R
RR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s	
tTest_itertoolscBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	t	itertoolscCsRxKdD]C}x:dD]2}||d|}||}|j||qWqWdS(	Ns
itertools.R"RRRti(s
itertools.R"(RRR(R!(RRRRRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytcheckall
s



cCs d}d}|j||dS(Nsitertools.izip(a, b)s	zip(a, b)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_0
scCs d}d}|j||dS(Ns%s(f, a)(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs<d}d}|j||d}d}|j||dS(Nsitertools.ifilterfalse(a, b)sitertools.filterfalse(a, b)sitertools.izip_longest(a, b)sitertools.zip_longest(a, b)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_qualifiedscCs<d}d}|j||d}d}|j||dS(Nsifilterfalse(a, b)sfilterfalse(a, b)sizip_longest(a, b)szip_longest(a, b)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Ns    %s(f, a)(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRdscCs<d}d}|j||d}d}|j||dS(Ns     itertools.ifilterfalse(a, b)s    itertools.filterfalse(a, b)s     itertools.izip_longest(a, b)s    itertools.zip_longest(a, b)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRescCs|jddddS(NRRR(R8(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR's(R9R.R
RRRDRRERdReR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
s	
									tTest_itertools_importscBsMeZdZdZdZdZdZdZdZdZ	RS(titertools_importscCsXd}d}|j||d}d}|j||d}d}|j||dS(Ns%from itertools import imap, izip, foosfrom itertools import foos*from itertools import bar, imap, izip, foosfrom itertools import bar, foos'from itertools import chain, imap, izipsfrom itertools import chain(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_reduced.scCs d}d}|j||dS(Ns%#foo
from itertools import imap, izips#foo
(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_comments;scCs<d}d}|j||d}d}|j||dS(Ns from itertools import imap, izipR"sfrom itertools import izip(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_none@scCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d}|j|dS(Ns-from itertools import izip, bar as bang, imaps!from itertools import bar as bangs-from itertools import izip as _zip, imap, barsfrom itertools import bars"from itertools import imap as _mapR"s0from itertools import imap as _map, izip as _zip(R!R&(RR=R>RY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_asIscCsxd	D]}d|f}d|f}|j||d|f}d|f}|j||d|f}d|f}|j||qWdS(
Ntfilterfalsetzip_longestsfrom itertools import i%ssfrom itertools import %ss$from itertools import imap, i%s, foosfrom itertools import %s, foos#from itertools import bar, i%s, foos"from itertools import bar, %s, foo(RR(R!(RRR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_ifilter_and_zip_longest]s






cCsd}|j|dS(Nsfrom itertools import *(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_starkscCsd}|j|dS(Nsfrom itertools import foo(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjps(
R9R.R
RRRRRRRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR+s	
						tTest_importcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZRS(Rcs]ttjg_t_t_fd}ddlm	}||_
dS(Ncs&jj|jp%|jkS(N(t
files_checkedR!t
always_existst
present_files(R(R(s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytfake_existssi(t
fix_import(RRRRtsetRR(Rt
lib2to3.fixesRtexists(RRR((Rs5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRxs		cCs#ddlm}tjj|_dS(Ni(R(RRtostpathR(RR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttearDownscCsEt|_tt|j||t|_tt|j|dS(N(R(RRRR!R:R&(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
check_boths		csd}t|_tdg|_dtjjddddf}|dd	|d
f}x|D]g|_|_|j	dtjj
rtjj
dnd
tfd|D}|jd|jt|j|qdWdS(NcSstjjj|jdS(Nt/(RRtpathsepR$tsplit(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pytpss__init__.pys.pys.pycs.sos.sls.pyds
/spam/eggs.pysni.pys../../shrubbery.pys
import jams/jamtjamc3s|]}|VqdS(N((t.0text(R(s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pys	<genexpr>s(
R:RRRRRtsepRR
R&tdirnametaddR(RRtexpected_extensionst
names_to_testtexpected_checks((Rs5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_files_checkeds		
		

cCs2d}t|_tdg|_|j|dS(Ns
import barsbar.py(R:RRRR&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_not_in_packages	cCs5d}t|_tddg|_|j|dS(Ns1from __future__ import absolute_import
import bars__init__.pysbar.py(R:RRRR&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt!test_with_absolute_import_enableds	cCs>d}d}t|_tddg|_|j||dS(Ns
import barsfrom . import bars__init__.pysbar.py(R:RRRR!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_in_packages
	cCsHd}d}t|_tddtjjg|_|j||dS(Ns
import barsfrom . import bars__init__.pytbar(R:RRRRRRR!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_import_from_packages
	cCsd}|j|dS(Nsfrom . import bar(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_already_relative_importscCs d}d}|j||dS(Nsimport bar # Foosfrom . import bar # Foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_comments_and_indentscCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsfrom foo import bar, bazsfrom .foo import bar, bazsfrom foo import barsfrom .foo import barsfrom foo import (bar, baz)sfrom .foo import (bar, baz)(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_fromscCs d}d}|j||dS(Nsfrom green.eggs import hamsfrom .green.eggs import ham(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_dotted_fromscCs d}d}|j||dS(Ns"from green.eggs import ham as spams#from .green.eggs import ham as spam(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_from_asscCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(	Ns
import foosfrom . import foosimport foo, barsfrom . import foo, barsimport foo, bar, xsfrom . import foo, bar, xsimport x, y, zsfrom . import x, y, z(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_importscCs<d}d}|j||d}d}|j||dS(Nsimport foo as xsfrom . import foo as xsimport a as b, b as c, c as ds$from . import a as b, b as c, c as d(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs8t|_tddg|_d}|j|ddS(Nsfoo.pys__init__.pysimport foo, bars#absolute and local imports together(R:RRRR)(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_local_and_absolutes	cCs d}d}|j||dS(Nsimport foo.barsfrom . import foo.bar(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_dotted_importscCs d}d}|j||dS(Nsimport foo.bar as bangsfrom . import foo.bar as bang(R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_dotted_import_asscCs d}d}|j||dS(Ns1
        # prefix
        import foo.bar
        s8
        # prefix
        from . import foo.bar
        (R(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_prefix
s(R9R.R
RRRRRRRRRRRRRRRRRRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRus(											
								tTest_set_literalcBs;eZdZdZdZdZdZdZRS(tset_literalcCsd}d}|j||d}d}|j||d}d}|j||d}|j||d}d}|j||d	}|j||d
}d}|j||d}d
}|j||d}d}|j||dS(Nsset([1, 2, 3])s	{1, 2, 3}sset((1, 2, 3))s	set((1,))s{1}sset([1])sset((a, b))s{a, b}sset([a, b])sset((a*234, f(args=23)))s{a*234, f(args=23)}sset([a*23, f(23)])s
{a*23, f(23)}sset([a-234**23])s{a-234**23}(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR?s2cCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(	Nsset([x for x in y])s{x for x in y}sset([x for x in y if x == m])s{x for x in y if x == m}sset([x for x in y for a in b])s{x for x in y for a in b}sset([f(x) - 23 for x in y])s{f(x) - 23 for x in y}(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_listcomps@scCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||d}d}|j||d
}d}|j||dS(Nsset( [1, 2])s{1, 2}s
set([1 ,  2])s{1 ,  2}s
set([ 1 ])s{ 1 }s
set( [1] )s{1}sset([  1,  2  ])s{  1,  2  }sset([x  for x in y ])s{x  for x in y }s<set(
                   [1, 2]
               )
            s{1, 2}
(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRQs*cCs<d}d}|j||d}d}|j||dS(Nsset((1, 2)) # His{1, 2} # HisZ
            # Foo
            set( # Bar
               (1, 2)
            )
            s2
            # Foo
            {1, 2}
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRqscCsvd}|j|d}|j|d}|j|d}|j|d}|j|d}|j|dS(Nsset()sset(a)sset(a, b, c)sset(x for x in y)sset(x for x in y if z)sset(a*823-23**2 + f(23))(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs




(R9R.R
R?RRRRj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs	#		 	tTest_sys_exccBsDeZdZdZdZdZdZdZdZRS(tsys_exccCs d}d}|j||dS(Nssys.exc_typessys.exc_info()[0](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Ns
sys.exc_valuessys.exc_info()[1](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Nssys.exc_tracebackssys.exc_info()[2](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Nssys.exc_type # Foossys.exc_info()[0] # Foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Nssys.  exc_typessys.  exc_info()[0](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGscCs d}d}|j||dS(Nssys  .exc_typessys  .exc_info()[0](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRHs(	R9R.R
RRDRERFRGRH(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs					t
Test_parencBszeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZRS(
tparencCs d}d}|j||dS(Ns[i for i in 1, 2 ]s[i for i in (1, 2) ](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRscCs d}d}|j||dS(Ns[i for i in 1, 2, ]s[i for i in (1, 2,) ](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRDscCs d}d}|j||dS(Ns[i for i  in     1, 2 ]s[i for i  in     (1, 2) ](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyREscCs d}d}|j||dS(Ns[i for i in 1, 2 if i]s[i for i in (1, 2) if i](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRFscCs d}d}|j||dS(Ns[i for i in 1,    2    ]s[i for i in (1,    2)    ](R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRGscCs d}d}|j||dS(Ns(i for i in 1, 2)s(i for i in (1, 2))(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRHscCs d}d}|j||dS(Ns(i for i in 1   ,2   if i)s(i for i in (1   ,2)   if i)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRIscCsd}|j|dS(Ns[i for i in (1, 2)](R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_unchanged_0scCsd}|j|dS(Ns[i for i in foo()](R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRZscCsd}|j|dS(Ns[i for i in (1, 2) if nothing](R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR[scCsd}|j|dS(Ns(i for i in (1, 2))(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR\scCsd}|j|dS(Ns[i for i in m](R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR]s(R9R.R
RRDRERFRGRHRIRRZR[R\R](((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs											tTest_metaclasscBs)eZdZdZdZdZRS(t	metaclasscCs|jd|jd|jd|jd|jd|jd|jdd}|j|d	}|j|dS(
Nsclass X(): passsclass X(object): passsclass X(object1, object2): passs(class X(object1, object2, object3): passsclass X(metaclass=Meta): passs'class X(b, arg=23, metclass=Meta): passs2class X(b, arg=23, metaclass=Meta, other=42): passsD
        class X:
            def __metaclass__(self): pass
        s1
        class X:
            a[23] = 74
        (R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs







cCs<d}d}|j||d}d}|j||dS(NsQ
        class X:
            # hi
            __metaclass__ = AppleMeta
        sQ
        class X(metaclass=AppleMeta):
            # hi
            pass
        sR
        class X:
            __metaclass__ = Meta
            # Bedtime!
        sR
        class X(metaclass=Meta):
            pass
            # Bedtime!
        (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR
scCs8d}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d}|j||d
}d}|j||d}d
}|j||d}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(NsK
        class X():
            __metaclass__ = Q
            pass
        s8
        class X(metaclass=Q):
            pass
        s"class X(object): __metaclass__ = Qs"class X(object, metaclass=Q): passsW
        class X(object):
            __metaclass__ = Meta
            bar = 7
        sF
        class X(object, metaclass=Meta):
            bar = 7
        sJ
        class X:
            __metaclass__ = Meta; x = 4; g = 23
        sD
        class X(metaclass=Meta):
            x = 4; g = 23
        sW
        class X(object):
            bar = 7
            __metaclass__ = Meta
        sl
        class X():
            __metaclass__ = A
            __metaclass__ = B
            bar = 7
        s;
        class X(metaclass=B):
            bar = 7
        s[
        class X(clsA, clsB):
            __metaclass__ = Meta
            bar = 7
        sJ
        class X(clsA, clsB, metaclass=Meta):
            bar = 7
        s(class m(a, arg=23): __metaclass__ = Metas(class m(a, arg=23, metaclass=Meta): passsN
        class X(expression(2 + 4)):
            __metaclass__ = Meta
        sN
        class X(expression(2 + 4), metaclass=Meta):
            pass
        sT
        class X(expression(2 + 4), x**4):
            __metaclass__ = Meta
        sT
        class X(expression(2 + 4), x**4, metaclass=Meta):
            pass
        sT
        class X:
            __metaclass__ = Meta
            save.py = 23
        sC
        class X(metaclass=Meta):
            save.py = 23
        (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt	test_meta&sB(R9R.R
RjRR
(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs		tTest_getcwducBs;eZdZdZdZdZdZdZRS(tgetcwducCstd}d}|j||d}d}|j||d}d}|j||d}d}|j||dS(	Ns
os.getcwdus	os.getcwdsos.getcwdu()sos.getcwd()smeth = os.getcwdusmeth = os.getcwdsos.getcwdu(args)sos.getcwd(args)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR?scCs d}d}|j||dS(Nsos.getcwdu() # Foosos.getcwd() # Foo(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_commentscCs=d}|j|d}|j|d}|j|dS(Nsos.getcwd()s	getcwdu()sos.getcwdb()(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs

cCs d}d}|j||dS(Ns<
            if 1:
                os.getcwdu()
            s;
            if 1:
                os.getcwd()
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_indentationscCsXd}d}|j||d}d}|j||d}d}|j||dS(Ns
os .getcwdu()sos .getcwd()sos.  getcwdusos.  getcwdsos.getcwdu (  )sos.getcwd (  )(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_multilations(R9R.R
R?R
RjRR(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs			
	t
Test_operatorcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZRS(toperatorcCs d}d}|j||dS(Nsoperator.isCallable(x)shasattr(x, '__call__')(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_isCallablescCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsoperator.sequenceIncludes(x, y)soperator.contains(x, y)s operator .sequenceIncludes(x, y)soperator .contains(x, y)s!operator.  sequenceIncludes(x, y)soperator.  contains(x, y)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_sequenceIncludesscCs d}d}|j||dS(Nsoperator.isSequenceType(x)s6import collections
isinstance(x, collections.Sequence)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_isSequenceTypescCs d}d}|j||dS(Nsoperator.isMappingType(x)s5import collections
isinstance(x, collections.Mapping)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_isMappingTypescCs d}d}|j||dS(Nsoperator.isNumberType(x)s,import numbers
isinstance(x, numbers.Number)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_isNumberTypescCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsoperator.repeat(x, n)soperator.mul(x, n)soperator .repeat(x, n)soperator .mul(x, n)soperator.  repeat(x, n)soperator.  mul(x, n)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_repeatscCsXd}d}|j||d}d}|j||d}d}|j||dS(Nsoperator.irepeat(x, n)soperator.imul(x, n)soperator .irepeat(x, n)soperator .imul(x, n)soperator.  irepeat(x, n)soperator.  imul(x, n)(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_operator_irepeatscCs d}d}|j||dS(Ns
isCallable(x)s-You should use 'hasattr(x, '__call__')' here.(R)(RRYtt((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bare_isCallablescCs d}d}|j||dS(NssequenceIncludes(x, y)s.You should use 'operator.contains(x, y)' here.(R)(RRYR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bare_sequenceIncludesscCs d}d}|j||dS(NsisSequenceType(z)s:You should use 'isinstance(z, collections.Sequence)' here.(R)(RRYR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt!test_bare_operator_isSequenceTypescCs d}d}|j||dS(NsisMappingType(x)s9You should use 'isinstance(x, collections.Mapping)' here.(R)(RRYR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt test_bare_operator_isMappingType$scCs d}d}|j||dS(NsisNumberType(y)s4You should use 'isinstance(y, numbers.Number)' here.(R)(RRYR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bare_operator_isNumberType)scCs d}d}|j||dS(Nsrepeat(x, n)s)You should use 'operator.mul(x, n)' here.(R)(RRYR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bare_operator_repeat.scCs d}d}|j||dS(Nsirepeat(y, 187)s,You should use 'operator.imul(y, 187)' here.(R)(RRYR((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_bare_operator_irepeat3s(R9R.R
RRRRRRRRRRRRRR (((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRs		
				
	
						t
Test_exitfunccBsMeZdZdZdZdZdZdZdZdZ	RS(texitfunccCs d}d}|j||dS(NsI
            import sys
            sys.exitfunc = my_atexit
            se
            import sys
            import atexit
            atexit.register(my_atexit)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR=scCs d}d}|j||dS(NsO
            import sys, crumbs
            sys.exitfunc = my_func
            sY
            import sys, crumbs, atexit
            atexit.register(my_func)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_names_importIscCs d}d}|j||dS(Nsh
            import sys
            sys.exitfunc = do(d)/a()+complex(f=23, g=23)*expression
            s
            import sys
            import atexit
            atexit.register(do(d)/a()+complex(f=23, g=23)*expression)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_complex_expressionTscCs<d}d}|j||d}d}|j||dS(NsN
            import sys # Foo
            sys.exitfunc = f # Blah
            sj
            import sys
            import atexit # Foo
            atexit.register(f) # Blah
            so
            import apples, sys, crumbs, larry # Pleasant comments
            sys.exitfunc = func
            sy
            import apples, sys, crumbs, larry, atexit # Pleasant comments
            atexit.register(func)
            (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR`scCs d}d}|j||dS(Ns]
            import sys
            def f():
                sys.exitfunc = func
            sz
            import sys
            import atexit
            def f():
                atexit.register(func)
             (R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_in_a_functionvscCs)d}d}d}|j|||dS(Nssys.exitfunc = fsatexit.register(f)sKCan't find sys import; Please add an atexit import at the top of your file.(R'(RR=R>tmsg((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_no_sys_importscCsd}|j|dS(Nsf(sys.exitfunc)(R&(RRY((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs(
R9R.R
RR#R$RR%R'Rj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR!9s						tTest_assertscBs)eZdZdZdZdZRS(tassertsc
CsUddddddddddddg}x$|D]\}}|j||q1WdS( Nsself.assert_(True)sself.assertTrue(True)sself.assertEquals(2, 2)sself.assertEqual(2, 2)sself.assertNotEquals(2, 3)sself.assertNotEqual(2, 3)sself.assertAlmostEquals(2, 3)sself.assertAlmostEqual(2, 3)s self.assertNotAlmostEquals(2, 8)sself.assertNotAlmostEqual(2, 8)sself.failUnlessEqual(2, 2)sself.failIfEqual(2, 3)s self.failUnlessAlmostEqual(2, 3)sself.failIfAlmostEqual(2, 8)sself.failUnless(True)sself.failUnlessRaises(foo)sself.assertRaises(foo)sself.failIf(False)sself.assertFalse(False)(sself.assert_(True)sself.assertTrue(True)(sself.assertEquals(2, 2)sself.assertEqual(2, 2)(sself.assertNotEquals(2, 3)sself.assertNotEqual(2, 3)(sself.assertAlmostEquals(2, 3)sself.assertAlmostEqual(2, 3)(s self.assertNotAlmostEquals(2, 8)sself.assertNotAlmostEqual(2, 8)(sself.failUnlessEqual(2, 2)sself.assertEqual(2, 2)(sself.failIfEqual(2, 3)sself.assertNotEqual(2, 3)(s self.failUnlessAlmostEqual(2, 3)sself.assertAlmostEqual(2, 3)(sself.failIfAlmostEqual(2, 8)sself.assertNotAlmostEqual(2, 8)(sself.failUnless(True)sself.assertTrue(True)(sself.failUnlessRaises(foo)sself.assertRaises(foo)(sself.failIf(False)sself.assertFalse(False)(R!(RttestsR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyttest_deprecated_namess	cCsd}d}|j||d}d}|j||d}d}|j||d}d}|j||d	}d
}|j||d}d}|j||d
}d}|j||dS(Nseq = self.assertEqualsseq = self.assertEquals#self.assertEquals(2, 3, msg="fail")s"self.assertEqual(2, 3, msg="fail")s)self.assertEquals(2, 3, msg="fail") # foos(self.assertEqual(2, 3, msg="fail") # foosself.assertEquals (2, 3)sself.assertEqual (2, 3)s  self.assertEquals (2, 3)s  self.assertEqual (2, 3)s0with self.failUnlessRaises(Explosion): explode()s,with self.assertRaises(Explosion): explode()s6with self.failUnlessRaises(Explosion) as cm: explode()s2with self.assertRaises(Explosion) as cm: explode()(R!(RR=R>((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt
test_variantss*cCs|jd|jddS(Nsself.assertEqualsOnSaturdays!self.assertEqualsOnSaturday(3, 5)(R&(R((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyRjs
(R9R.R
R+R,Rj(((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyR(s		(Et__doc__RtunittestRRRRRRRRRt
lib2to3.testsRtTestCaseRR;RBRORfRkRpRRRRRRRRRRRRRRRRRRRR)R+R;R?RhRkRRRRRRRRRRRRRRRRRRRRR!R((((s5/usr/local/lib/python2.7/lib2to3/tests/test_fixers.pyt<module>s~"9:1#j3&}.&H/+bn/ 4B.OVpC Y
=J":=cX

Zerion Mini Shell 1.0