
vQc           @   s!  d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l m Z m	 Z	 m
 Z
 m Z d d l m Z d e j f d     YZ d	 e f d
     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d      YZ d! e f d"     YZ d# e f d$     YZ d% e f d&     YZ d' e f d(     YZ d) e f d*     YZ  d+ e f d,     YZ! d- e f d.     YZ" d/ e f d0     YZ# d1 f  d2     YZ$ d3 e e$ f d4     YZ% d5 e e$ f d6     YZ& d7 e e$ f d8     YZ' d9 e f d:     YZ( d; e f d<     YZ) d= e f d>     YZ* d? e f d@     YZ+ dA e f dB     YZ, dC e f dD     YZ- dE e f dF     YZ. dG e f dH     YZ/ dI e f dJ     YZ0 dK e f dL     YZ1 dM e f dN     YZ2 dO e f dP     YZ3 dQ e f dR     YZ4 dS e f dT     YZ5 dU e f dV     YZ6 dW e f dX     YZ7 dY e f dZ     YZ8 d[ e f d\     YZ9 d] e f d^     YZ: d_ e f d`     YZ; da e f db     YZ< dc e f dd     YZ= de e f df     YZ> dg e f dh     YZ? di e f dj     YZ@ dk e f dl     YZA dm e f dn     YZB do e f dp     YZC dq e f dr     YZD d S(s   s"    Test suite for the fixer modules iN(   t   chain(   t
   itemgetter(   t   pygramt   pytreet   refactort
   fixer_util(   t   supportt   FixerTestCasec           B   sY   e  Z d d  d d  Z d   Z e d  Z e d  Z d   Z e d  Z	 d   Z
 RS(	   t   lib2to3c         C   s{   | d  k r |  j g } n  t j | | |  |  _ g  |  _ d |  _ x/ t |  j j |  j j	  D] } |  j | _
 qa Wd  S(   Nu   <string>(   t   Nonet   fixerR   t   get_refactorerR   t	   fixer_logt   filenameR    t	   pre_ordert
   post_ordert   log(   t   selft   fix_listt	   fixer_pkgt   optionsR
   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   setUp   s    		c         C   sP   t  j |  } t  j |  } |  j j | |  j  } |  j | t |   | S(   N(   R   t   reformatR   t   refactor_stringR   t   assertEqualt   unicode(   R   t   beforet   aftert   tree(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   _check   s
    c         C   sB   |  j  | |  } |  j | j  | s> |  j |  j g   n  d  S(   N(   R   t
   assertTruet   was_changedR   R   (   R   R   R   t   ignore_warningsR   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   check$   s    c         C   sN   |  j  | |  } |  j | d j |  j  k  | sJ |  j | j  n  d  S(   Nt    (   R   R   t   joinR   R   (   R   R   R   t   messaget	   unchangedR   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   warns*   s    c         C   s   |  j  | | | d t d  S(   NR%   (   R&   t   True(   R   R   R$   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   warns_unchanged0   s    c         C   s0   |  j  | |  | s, |  j |  j g   n  d  S(   N(   R   R   R   (   R   R   R    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR%   3   s    c      	   G   s   |  j  g } | j |  t j d |  } | j   \ } } d |  j  } | rm | d j j j |  rm d  S| r | d j j j |  r | r d  S|  j d d j	 g  | | D] } | j j ^ q  | f  d  S(   NR   t   fix_is5   Fixer run order (%s) is incorrect; %s should be last.s   , (
   R
   t   extendR   R   t
   get_fixerst	   __class__t
   __module__t   endswitht   failR#   (   R   t   namest   fixest   rt   pret   postt   nt   x(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   assert_runs_after8   s    &	N(   t   __name__R-   R	   R   R   t   FalseR!   R&   R(   R%   R7   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR      s   		t   Test_nec           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   t   nec         C   s    d } d } |  j  | |  d  S(   Ns   if x <> y:
            passs   if x != y:
            pass(   R!   (   R   t   bt   a(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt
   test_basicJ   s    c         C   s    d } d } |  j  | |  d  S(   Ns   if x<>y:
            passs   if x!=y:
            pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_no_spacesR   s    c         C   s    d } d } |  j  | |  d  S(   Ns   if x<>y<>z:
            passs   if x!=y!=z:
            pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_chainedZ   s    (   R8   R-   R
   R>   R?   R@   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR:   G   s   		t   Test_has_keyc           B   sq   e  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(   t   has_keyc         C   s    d } d } |  j  | |  d  S(   Ns$   x = d.has_key("x") or d.has_key("y")s   x = "x" in d or "y" in d(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_1e   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = a.b.c.d.has_key("x") ** 3s   x = ("x" in a.b.c.d) ** 3(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_2j   s    c         C   s    d } d } |  j  | |  d  S(   Ns!   x = a.b.has_key(1 + 2).__repr__()s   x = (1 + 2 in a.b).__repr__()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_3o   s    c         C   s    d } d } |  j  | |  d  S(   Ns,   x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4s(   x = (1 + 2 in a.b).__repr__() ** -3 ** 4(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_4t   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = a.has_key(f or g)s   x = (f or g) in a(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_5y   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = a + b.has_key(c)s   x = a + (c in b)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_6~   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = a.has_key(lambda: 12)s   x = (lambda: 12) in a(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_7   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = a.has_key(a for a in b)s   x = (a for a in b) in a(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_8   s    c         C   s    d } d } |  j  | |  d  S(   Ns   if not a.has_key(b): passs   if b not in a: pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_9   s    c         C   s    d } d } |  j  | |  d  S(   Ns$   if not a.has_key(b).__repr__(): passs    if not (b in a).__repr__(): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_10   s    c         C   s    d } d } |  j  | |  d  S(   Ns   if not a.has_key(b) ** 2: passs   if not (b in a) ** 2: pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_11   s    (   R8   R-   R
   RC   RD   RE   RF   RG   RH   RI   RJ   RK   RL   RM   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRA   b   s   										t
   Test_applyc           B   s   e  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 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(   t   applyc         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f, g + h)s   x = f(*g + h)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC      s    c         C   s    d } d } |  j  | |  d  S(   Ns   y = apply(f, g, h)s   y = f(*g, **h)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD      s    c         C   s    d } d } |  j  | |  d  S(   Ns    z = apply(fs[0], g or h, h or g)s   z = fs[0](*g or h, **h or g)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE      s    c         C   s    d } d } |  j  | |  d  S(   Ns   apply(f, (x, y) + t)s   f(*(x, y) + t)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF      s    c         C   s    d } d } |  j  | |  d  S(   Ns   apply(f, args,)s   f(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRG      s    c         C   s    d } d } |  j  | |  d  S(   Ns   apply(f, args, kwds,)s   f(*args, **kwds)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRH      s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f+g, args)s   x = (f+g)(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_complex_1   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f*g, args)s   x = (f*g)(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_complex_2   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f**g, args)s   x = (f**g)(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_complex_3   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f.g, args)s   x = f.g(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_dotted_name   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f[x], args)s   x = f[x](*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_subscript   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = apply(f(), args)s   x = f()(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_call   s    c         C   s    d } d } |  j  | |  d  S(   Ns"   x = apply(a.b.c.d.e.f, args, kwds)s   x = a.b.c.d.e.f(*args, **kwds)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_extreme   s    c         C   s    d } d } |  j  | |  d  S(   Ns1   apply(   # foo
          f, # bar
          args)s   f(*args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_weird_comments   s    c         C   s   d } |  j  |  d  S(   Ns   apply()(   R%   (   R   t   s(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_1   s    c         C   s   d } |  j  |  d  S(   Ns   apply(f)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_2   s    c         C   s   d } |  j  |  d  S(   Ns	   apply(f,)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_3   s    c         C   s   d } |  j  |  d  S(   Ns   apply(f, args, kwds, extras)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_4   s    c         C   s   d } |  j  |  d  S(   Ns   apply(f, *args, **kwds)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_5   s    c         C   s   d } |  j  |  d  S(   Ns   apply(f, *args)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_6  s    c         C   s   d } |  j  |  d  S(   Ns#   apply(func=f, args=args, kwds=kwds)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_7  s    c         C   s   d } |  j  |  d  S(   Ns   apply(f, args=args, kwds=kwds)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_8  s    c         C   s   d } |  j  |  d  S(   Ns   apply(f, args, kwds=kwds)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_9  s    c         C   s    d } d } |  j  | |  d  S(   Ns   apply(  f,  args,   kwds)s   f(*args, **kwds)(   R!   (   R   R=   R<   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_space_1  s    c         C   s    d } d } |  j  | |  d  S(   Ns   apply(  f  ,args,kwds   )s   f(*args, **kwds)(   R!   (   R   R=   R<   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_space_2  s    (   R8   R-   R
   RC   RD   RE   RF   RG   RH   RP   RQ   RR   RS   RT   RU   RV   RW   RY   RZ   R[   R\   R]   R^   R_   R`   Ra   Rb   Rc   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRN      s4   																									t   Test_internc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   t   internc         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x =   intern(  a  )s"   import sys
x =   sys.intern(  a  )s%   y = intern("b" # test
              )s4   import sys
y = sys.intern("b" # test
              )s   z = intern(a+b+c.d,   )s&   import sys
z = sys.intern(a+b+c.d,   )(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation   s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x = intern(a)s   import sys
x = sys.intern(a)s   z = intern(a+b+c.d,)s#   import sys
z = sys.intern(a+b+c.d,)s"   intern("y%s" % 5).replace("y", "")s1   import sys
sys.intern("y%s" % 5).replace("y", "")(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test/  s    c         C   sc   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   intern(a=1)s   intern(f, g)s
   intern(*h)s   intern(**i)s   intern()(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged>  s    (   R8   R-   R
   Rf   Rg   Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRd     s   		t   Test_reducec           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   t   reducec         C   s    d } d } |  j  | |  d  S(   Ns   reduce(a, b, c)s,   from functools import reduce
reduce(a, b, c)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_simple_callQ  s    c         C   s    d } d } |  j  | |  d  S(   Ns   def x(arg): reduce(sum, [])s8   from functools import reduce
def x(arg): reduce(sum, [])(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bug_7253V  s    c         C   s    d } d } |  j  | |  d  S(   Ns   reduce(lambda x, y: x + y, seq)s<   from functools import reduce
reduce(lambda x, y: x + y, seq)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_call_with_lambda\  s    c         C   sc   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns	   reduce(a)s   reduce(a, b=42)s   reduce(a, b, c, d)s   reduce(**c)s   reduce()(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh   a  s    (   R8   R-   R
   Rk   Rl   Rm   Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRi   N  s
   			t
   Test_printc           B   s   e  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 d   Z d   Z d   Z d   Z d   Z RS(   t   printc         C   s    d } d } |  j  | |  d  S(   Ns   print 1,   1+1,   1+1+1s   print(1,   1+1,   1+1+1)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf   t  s    c         C   s*   d } |  j  |  d } |  j  |  d  S(   Ns   print()s	   print('')(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_idempotencyy  s    c         C   sO   t  j |  j j _ d } |  j |  d } |  j |  d } |  j |  d  S(   Ns   print(1, 1+1, 1+1+1)s   print()s	   print('')(   R   t!   python_grammar_no_print_statementR   t   drivert   grammarR%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt"   test_idempotency_print_as_function  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print 1, 1+1, 1+1+1s   print(1, 1+1, 1+1+1)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC     s    c         C   s    d } d } |  j  | |  d  S(   Ns
   print 1, 2s   print(1, 2)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD     s    c         C   s    d } d } |  j  | |  d  S(   NRo   s   print()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   Ns   print whatever; prints   print(whatever); print()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF     s    c         C   s    d } d } |  j  | |  d  S(   Ns   print; print whatever;s   print(); print(whatever);(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRG     s    c         C   s    d } d } |  j  | |  d  S(   Ns   print (a, b, c)s   print((a, b, c))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt
   test_tuple  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print 1, 2, 3,s   print(1, 2, 3, end=' ')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_trailing_comma_1  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print 1, 2,s   print(1, 2, end=' ')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_trailing_comma_2  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print 1,s   print(1, end=' ')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_trailing_comma_3  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print >>sys.stderr, 1, 2, 3s   print(1, 2, 3, file=sys.stderr)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt!   test_vargs_without_trailing_comma  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print >>sys.stderr, 1, 2,s%   print(1, 2, end=' ', file=sys.stderr)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_with_trailing_comma  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print >>sys.stderr, 1+1s   print(1+1, file=sys.stderr)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_no_trailing_comma  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print >>  sys.stderrs   print(file=sys.stderr)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_spaces_before_file  s    c         C   s3   d } |  j  |  d } d } |  j | |  d  S(   Ns<   from __future__ import print_function
print('Hai!', end=' ')s   print 'Hello, world!'s   print('Hello, world!')(   R%   R!   (   R   RX   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_with_future_print_function  s
    (   R8   R-   R
   Rf   Rp   Rt   RC   RD   RE   RF   RG   Ru   Rv   Rw   Rx   Ry   Rz   R{   R|   R}   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRn   q  s$   																t	   Test_execc           B   sh   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z RS(   t   execc         C   s    d } d } |  j  | |  d  S(   Ns     exec code in ns1,   ns2s     exec(code, ns1,   ns2)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s    d } d } |  j  | |  d  S(   Ns	   exec codes
   exec(code)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR>     s    c         C   s    d } d } |  j  | |  d  S(   Ns   exec code in nss   exec(code, ns)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_with_globals  s    c         C   s    d } d } |  j  | |  d  S(   Ns   exec code in ns1, ns2s   exec(code, ns1, ns2)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_with_globals_locals  s    c         C   s    d } d } |  j  | |  d  S(   Ns   exec (a.b()) in nss   exec((a.b()), ns)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRP     s    c         C   s    d } d } |  j  | |  d  S(   Ns   exec a.b() + c in nss   exec(a.b() + c, ns)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRQ     s    c         C   s   d } |  j  |  d  S(   Ns
   exec(code)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRY     s    c         C   s   d } |  j  |  d  S(   Ns   exec (code)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRZ     s    c         C   s   d } |  j  |  d  S(   Ns   exec(code, ns)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR[     s    c         C   s   d } |  j  |  d  S(   Ns   exec(code, ns1, ns2)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR\   
  s    (   R8   R-   R
   Rf   R>   R   R   RP   RQ   RY   RZ   R[   R\   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR~     s   									t	   Test_reprc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   t   reprc         C   s    d } d } |  j  | |  d  S(   Ns   x =   `1 + 2`s   x =   repr(1 + 2)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = `1 + 2`s   x = repr(1 + 2)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_simple_1  s    c         C   s    d } d } |  j  | |  d  S(   Ns   y = `x`s   y = repr(x)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_simple_2  s    c         C   s    d } d } |  j  | |  d  S(   Ns   z = `y`.__repr__()s   z = repr(y).__repr__()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_complex   s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = `1, 2, 3`s   x = repr((1, 2, 3))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRu   %  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = `1 + `2``s   x = repr(1 + repr(2))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_nested*  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = `1, 2 + `3, 4``s   x = repr((1, 2 + repr((3, 4))))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_nested_tuples/  s    (
   R8   R-   R
   Rf   R   R   R   Ru   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s   						t   Test_exceptc           B   s   e  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 d   Z d   Z d   Z d   Z RS(   t   exceptc         C   s    d } d } |  j  | |  d  S(   Nsq   
            try:
                pass
            except (RuntimeError, ImportError),    e:
                passss   
            try:
                pass
            except (RuntimeError, ImportError) as    e:
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf   7  s    c         C   s    d } d } |  j  | |  d  S(   NsV   
            try:
                pass
            except Foo, e:
                passsX   
            try:
                pass
            except Foo as e:
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_simpleD  s    c         C   s    d } d } |  j  | |  d  S(   NsU   
            try:
                pass
            except Foo,e:
                passsX   
            try:
                pass
            except Foo as e:
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt"   test_simple_no_space_before_targetQ  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_tuple_unpack^  s    
c         C   s    d } d } |  j  | |  d  S(   Nsn   
            try:
                pass
            except (RuntimeError, ImportError), e:
                passsp   
            try:
                pass
            except (RuntimeError, ImportError) as e:
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_multi_classs  s    c         C   s    d } d } |  j  | |  d  S(   Nsa   
            try:
                pass
            except Exception, [a, b]:
                passs   
            try:
                pass
            except Exception as xxx_todo_changeme:
                [a, b] = xxx_todo_changeme.args
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_list_unpack  s    c         C   s    d } d } |  j  | |  d  S(   Ns_   
            try:
                pass
            except Exception, d[5]:
                passs   
            try:
                pass
            except Exception as xxx_todo_changeme:
                d[5] = xxx_todo_changeme
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_weird_target_1  s    c         C   s    d } d } |  j  | |  d  S(   Ns`   
            try:
                pass
            except Exception, a.foo:
                passs   
            try:
                pass
            except Exception as xxx_todo_changeme:
                a.foo = xxx_todo_changeme
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_weird_target_2  s    c         C   s    d } d } |  j  | |  d  S(   Nsb   
            try:
                pass
            except Exception, a().foo:
                passs   
            try:
                pass
            except Exception as xxx_todo_changeme:
                a().foo = xxx_todo_changeme
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_weird_target_3  s    c         C   s    d } d } |  j  | |  d  S(   Ns   
            try:
                pass
            except Exception, a:
                pass
            except:
                passs   
            try:
                pass
            except Exception as a:
                pass
            except:
                pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bare_except  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt!   test_bare_except_and_else_finally  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt+   test_multi_fixed_excepts_before_bare_except  s    	
c         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(	   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_one_line_suites  s    c         C   s   d } |  j  |  d  S(   NsO   
            try:
                pass
            except:
                pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRY   /  s    c         C   s   d } |  j  |  d  S(   NsY   
            try:
                pass
            except Exception:
                pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRZ   7  s    c         C   s   d } |  j  |  d  S(   Nsg   
            try:
                pass
            except (Exception, SystemExit):
                pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR[   ?  s    (   R8   R-   R
   Rf   R   R   R   R   R   R   R   R   R   R   R   R   RY   RZ   R[   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   4  s"   													0		t
   Test_raisec           B   s   e  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 d   Z d   Z d   Z d   Z d   Z RS(   t   raisec         C   s    d } d } |  j  | |  d  S(   Ns   raise Exception, 5s   raise Exception(5)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR>   J  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   raise Exception,5s   raise Exception(5)s   raise   Exception,    5s   raise   Exception(5)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf   O  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   raise Exception, 5 # foos   raise Exception(5) # foos   raise E, (5, 6) % (a, b) # foos   raise E((5, 6) % (a, b)) # foos:   def foo():
                    raise Exception, 5, 6 # foosI   def foo():
                    raise Exception(5).with_traceback(6) # foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_with_commentsX  s    c         C   s    d } d } |  j  | |  d  S(   Ns   raise Exception(5), None, tbs%   raise Exception(5).with_traceback(tb)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_None_valueg  s    c         C   s    d } d } |  j  | |  d  S(   Ns   raise Exception, (5, 6, 7)s   raise Exception(5, 6, 7)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_tuple_valuel  s    c         C   s    d } d } |  j  | |  d  S(   Ns   raise E, (5, 6) % (a, b)s   raise E((5, 6) % (a, b))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_tuple_detectionq  s    c         C   s    d } d } |  j  | |  d  S(   Ns   raise (((E1, E2), E3), E4), Vs   raise E1(V)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_tuple_exc_1v  s    c         C   s    d } d } |  j  | |  d  S(   Ns   raise (E1, (E2, E3), E4), Vs   raise E1(V)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_tuple_exc_2{  s    c         C   s   d } |  j  | d  d  S(   Ns   raise 'foo's+   Python 3 does not support string exceptions(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_string_exc  s    c         C   s   d } |  j  | d  d  S(   Ns   raise "foo", 5s+   Python 3 does not support string exceptions(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_string_exc_val  s    c         C   s   d } |  j  | d  d  S(   Ns   raise "foo", 5, 6s+   Python 3 does not support string exceptions(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_string_exc_val_tb  s    c         C   s    d } d } |  j  | |  d  S(   Ns4   def foo():
                    raise Exception, 5, 6sC   def foo():
                    raise Exception(5).with_traceback(6)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_1  s    c         C   s    d } d } |  j  | |  d  S(   Nsh   def foo():
                    a = 5
                    raise Exception, 5, 6
                    b = 6sw   def foo():
                    a = 5
                    raise Exception(5).with_traceback(6)
                    b = 6(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_2  s    c         C   s    d } d } |  j  | |  d  S(   Ns2   def foo():
                    raise Exception,5,6sC   def foo():
                    raise Exception(5).with_traceback(6)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_3  s    c         C   s    d } d } |  j  | |  d  S(   Nsf   def foo():
                    a = 5
                    raise Exception,5,6
                    b = 6sw   def foo():
                    a = 5
                    raise Exception(5).with_traceback(6)
                    b = 6(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_4  s    c         C   s    d } d } |  j  | |  d  S(   Ns<   def foo():
                    raise Exception, (5, 6, 7), 6sI   def foo():
                    raise Exception(5, 6, 7).with_traceback(6)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_5  s    c         C   s    d } d } |  j  | |  d  S(   Nsp   def 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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_6  s    (   R8   R-   R
   R>   Rf   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   G  s$   																	t
   Test_throwc           B   s   e  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 d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   throwc         C   s    d } d } |  j  | |  d  S(   Ns   g.throw(Exception, 5)s   g.throw(Exception(5))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC     s    c         C   s    d } d } |  j  | |  d  S(   Ns   g.throw(Exception,5)s   g.throw(Exception(5))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD     s    c         C   s    d } d } |  j  | |  d  S(   Ns   g.throw(Exception, (5, 6, 7))s   g.throw(Exception(5, 6, 7))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   Ns   5 + g.throw(Exception, 5)s   5 + g.throw(Exception(5))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF     s    c         C   s   d } |  j  | d  d  S(   Ns   g.throw("foo")s+   Python 3 does not support string exceptions(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_warn_1  s    c         C   s   d } |  j  | d  d  S(   Ns   g.throw("foo", 5)s+   Python 3 does not support string exceptions(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_warn_2  s    c         C   s   d } |  j  | d  d  S(   Ns   g.throw("foo", 5, 6)s+   Python 3 does not support string exceptions(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_warn_3  s    c         C   s   d } |  j  |  d  S(   Ns   g.throw(Exception)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_untouched_1  s    c         C   s   d } |  j  |  d  S(   Ns   g.throw(Exception(5, 6))(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_untouched_2  s    c         C   s   d } |  j  |  d  S(   Ns   5 + g.throw(Exception(5, 6))(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_untouched_3  s    c         C   s    d } d } |  j  | |  d  S(   Ns7   def foo():
                    g.throw(Exception, 5, 6)sF   def foo():
                    g.throw(Exception(5).with_traceback(6))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Nsk   def foo():
                    a = 5
                    g.throw(Exception, 5, 6)
                    b = 6sz   def foo():
                    a = 5
                    g.throw(Exception(5).with_traceback(6))
                    b = 6(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns5   def foo():
                    g.throw(Exception,5,6)sF   def foo():
                    g.throw(Exception(5).with_traceback(6))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Nsi   def foo():
                    a = 5
                    g.throw(Exception,5,6)
                    b = 6sz   def foo():
                    a = 5
                    g.throw(Exception(5).with_traceback(6))
                    b = 6(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns?   def foo():
                    g.throw(Exception, (5, 6, 7), 6)sL   def foo():
                    g.throw(Exception(5, 6, 7).with_traceback(6))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Nss   def foo():
                    a = 5
                    g.throw(Exception, (5, 6, 7), 6)
                    b = 6s   def foo():
                    a = 5
                    g.throw(Exception(5, 6, 7).with_traceback(6))
                    b = 6(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   &  s    c         C   s    d } d } |  j  | |  d  S(   Ns;   def foo():
                    a + g.throw(Exception, 5, 6)sJ   def foo():
                    a + g.throw(Exception(5).with_traceback(6))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_71  s    c         C   s    d } d } |  j  | |  d  S(   Nso   def 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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_tb_88  s    (   R8   R-   R
   RC   RD   RE   RF   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s&   																	t	   Test_longc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   t   longc         C   s    d } d } |  j  | |  d  S(   Ns   x = long(x)s
   x = int(x)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC   F  s    c         C   s    d } d } |  j  | |  d  S(   Ns   y = isinstance(x, long)s   y = isinstance(x, int)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD   K  s    c         C   s    d } d } |  j  | |  d  S(   Ns   z = type(x) in (int, long)s   z = type(x) in (int, int)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE   P  s    c         C   s   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   long = Trues   s.long = Trues   def long(): passs   class long(): passs   def f(long): passs   def f(g, long): passs   def f(x, long=True): pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh   U  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x =   long(  x  )s   x =   int(  x  )(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf   k  s    (   R8   R-   R
   RC   RD   RE   Rh   Rf   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   C  s   				t   Test_execfilec           B   s    e  Z d  Z d   Z d   Z RS(   t   execfilec         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d
 } |  j  | |  d } d } |  j  | |  d  S(   Ns   execfile("fn")s.   exec(compile(open("fn").read(), "fn", 'exec'))s   execfile("fn", glob)s4   exec(compile(open("fn").read(), "fn", 'exec'), glob)s   execfile("fn", glob, loc)s9   exec(compile(open("fn").read(), "fn", 'exec'), glob, loc)s   execfile("fn", globals=glob)s<   exec(compile(open("fn").read(), "fn", 'exec'), globals=glob)s   execfile("fn", locals=loc)s:   exec(compile(open("fn").read(), "fn", 'exec'), locals=loc)s(   execfile("fn", globals=glob, locals=loc)sH   exec(compile(open("fn").read(), "fn", 'exec'), globals=glob, locals=loc)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_conversiont  s$    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   execfile( "fn" )s0   exec(compile(open( "fn" ).read(), "fn", 'exec'))s   execfile("fn",  globals = glob)s?   exec(compile(open("fn").read(), "fn", 'exec'),  globals = glob)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_spacing  s    (   R8   R-   R
   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   q  s   	t   Test_isinstancec           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   t
   isinstancec         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(	   Ns   isinstance(x, (int, int, int))s   isinstance(x, int)s,   isinstance(x, (int, float, int, int, float))s   isinstance(x, (int, float))s1   isinstance(x, (int, float, int, int, float, str))s    isinstance(x, (int, float, str))s4   isinstance(foo() + bar(), (x(), y(), x(), int, int))s/   isinstance(foo() + bar(), (x(), y(), x(), int))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_remove_multiple_items  s    c         C   s    d } d } |  j  | |  d  S(   Ns4   if    isinstance(  foo(), (  bar, bar, baz )) : passs/   if    isinstance(  foo(), (  bar, baz )) : pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s   |  j  d  d  S(   Ns   isinstance(x, (str, int))(   R%   (   R   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh     s    (   R8   R-   R
   R   Rf   Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s   		t	   Test_dictc           B   sI  e  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 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 d   Z d   Z d   Z d   Z  d   Z d    Z d!   Z d"   Z d#   Z RS($   t   dictc         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d
 } |  j  | |  d } d } |  j  | |  d  S(   Ns   if   d. keys  (  )  : passs    if   list(d. keys  (  ))  : passs   if   d. items  (  )  : passs!   if   list(d. items  (  ))  : passs   if   d. iterkeys  ( )  : passs   if   iter(d. keys  ( ))  : passs"   [i for i in    d.  iterkeys(  )  ]s   [i for i in    d.  keys(  )  ]s   if   d. viewkeys  ( )  : passs   if   d. keys  ( )  : passs"   [i for i in    d.  viewkeys(  )  ](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s$    c         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d } |  j  | |  d  S(
   Ns   d.keys() # foos   list(d.keys()) # foos   d.items()  # foos   list(d.items())  # foos   d.iterkeys()  # foos   iter(d.keys())  # foos/   [i for i in d.iterkeys() # foo
               ]s+   [i for i in d.keys() # foo
               ]s   d.viewitems()  # foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_trailing_comment  s$    c         C   s]   xV t  j D]K } d | } |  j |  d | } |  j |  d | } |  j |  q
 Wd  S(   Ns   s = %s(d.keys())s   s = %s(d.values())s   s = %s(d.items())(   R   t   consuming_callsR%   (   R   t   wrapperRX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh     s    


c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   d.keys()s   list(d.keys())s   a[0].foo().keys()s   list(a[0].foo().keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_01  s    c         C   s    d } d } |  j  | |  d  S(   Ns	   d.items()s   list(d.items())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_02   s    c         C   s    d } d } |  j  | |  d  S(   Ns
   d.values()s   list(d.values())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_03  s    c         C   s    d } d } |  j  | |  d  S(   Ns   d.iterkeys()s   iter(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_04
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   d.iteritems()s   iter(d.items())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_05  s    c         C   s    d } d } |  j  | |  d  S(   Ns   d.itervalues()s   iter(d.values())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_06  s    c         C   s   d } |  j  |  d  S(   Ns   list(d.keys())(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_07  s    c         C   s   d } |  j  |  d  S(   Ns   sorted(d.keys())(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_08  s    c         C   s    d } d } |  j  | |  d  S(   Ns   iter(d.keys())s   iter(list(d.keys()))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_09!  s    c         C   s    d } d } |  j  | |  d  S(   Ns   foo(d.keys())s   foo(list(d.keys()))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRL   &  s    c         C   s    d } d } |  j  | |  d  S(   Ns   for i in d.keys(): print is    for i in list(d.keys()): print i(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRM   +  s    c         C   s    d } d } |  j  | |  d  S(   Ns   for i in d.iterkeys(): print is   for i in d.keys(): print i(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_120  s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in d.keys()]s   [i for i in list(d.keys())](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_135  s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in d.iterkeys()]s   [i for i in d.keys()](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_14:  s    c         C   s    d } d } |  j  | |  d  S(   Ns   (i for i in d.keys())s   (i for i in list(d.keys()))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_15?  s    c         C   s    d } d } |  j  | |  d  S(   Ns   (i for i in d.iterkeys())s   (i for i in d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_16D  s    c         C   s    d } d } |  j  | |  d  S(   Ns   iter(d.iterkeys())s   iter(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_17I  s    c         C   s    d } d } |  j  | |  d  S(   Ns   list(d.iterkeys())s   list(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_18N  s    c         C   s    d } d } |  j  | |  d  S(   Ns   sorted(d.iterkeys())s   sorted(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_19S  s    c         C   s    d } d } |  j  | |  d  S(   Ns   foo(d.iterkeys())s   foo(iter(d.keys()))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_20X  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print h.iterkeys().next()s   print iter(h.keys()).next()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_21]  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print h.keys()[0]s   print list(h.keys())[0](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_22b  s    c         C   s    d } d } |  j  | |  d  S(   Ns   print list(h.iterkeys().next())s!   print list(iter(h.keys()).next())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_23g  s    c         C   s    d } d } |  j  | |  d  S(   Ns   for x in h.keys()[0]: print xs#   for x in list(h.keys())[0]: print x(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_24l  s    c         C   s    d } d } |  j  | |  d  S(   Ns   d.viewkeys()s   d.keys()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_25q  s    c         C   s    d } d } |  j  | |  d  S(   Ns   d.viewitems()s	   d.items()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_26v  s    c         C   s    d } d } |  j  | |  d  S(   Ns   d.viewvalues()s
   d.values()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_27{  s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in d.viewkeys()]s   [i for i in d.keys()](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns   (i for i in d.viewkeys())s   (i for i in d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns   iter(d.viewkeys())s   iter(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns   list(d.viewkeys())s   list(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns   sorted(d.viewkeys())s   sorted(d.keys())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    (!   R8   R-   R
   Rf   R   Rh   R   R   R   R   R   R   R   R   R   RL   RM   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     sH   																																			t   Test_xrangec           B   s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   t   xrangec         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x =    xrange(  10  )s   x =    range(  10  )s   x = xrange(  1  ,  10   )s   x = range(  1  ,  10   )s   x = xrange(  0  ,  10 ,  2 )s   x = range(  0  ,  10 ,  2 )(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = xrange(10)s   x = range(10)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_single_arg  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = xrange(1, 10)s   x = range(1, 10)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_two_args  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = xrange(0, 10, 2)s   x = range(0, 10, 2)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_three_args  s    c         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d
 } |  j  | |  d  S(   Ns   x = range(10, 3, 9)s   x = list(range(10, 3, 9))s   x = foo(range(10, 3, 9))s   x = foo(list(range(10, 3, 9)))s   x = range(10, 3, 9) + [4]s   x = list(range(10, 3, 9)) + [4]s   x = range(10)[::-1]s   x = list(range(10))[::-1]s   x = range(10)  [3]s   x = list(range(10))  [3](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_wrap_in_list  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   for i in xrange(10):
    j=is   for i in range(10):
    j=is   [i for i in xrange(10)]s   [i for i in range(10)](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_xrange_in_for  s    c         C   s   |  j  d  |  j  d  d  S(   Ns   for i in range(10): passs   [i for i in range(10)](   R%   (   R   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_range_in_for  s    c         C   s   |  j  d  d  S(   Ns   x in range(10, 3, 9)(   R%   (   R   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_in_contains_test  s    c         C   s)   x" t  j D] } |  j d |  q
 Wd  S(   Ns   a = %s(range(10))(   R   R   R%   (   R   t   call(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_in_consuming_context  s    (   R8   R-   R
   Rf   R   R   R   R   R   R   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s   									t   Test_xrange_with_reducec           B   s   e  Z d    Z d   Z RS(   c         C   s    t  t |   j d d g  d  S(   NR   Rj   (   t   superR   R   (   R   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s    d } d } |  j  | |  d  S(   Ns   reduce(x, xrange(5))s0   from functools import reduce
reduce(x, range(5))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_double_transform  s    (   R8   R-   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s   	t   Test_raw_inputc           B   sV   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   t	   raw_inputc         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x =    raw_input(   )s   x =    input(   )s   x = raw_input(   ''   )s   x = input(   ''   )(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = raw_input()s   x = input()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = raw_input('')s   x = input('')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = raw_input('prompt')s   x = input('prompt')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = raw_input(foo(a) + 6)s   x = input(foo(a) + 6)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = raw_input(invite).split()s   x = input(invite).split()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRG     s    c         C   s    d } d } |  j  | |  d  S(   Ns    x = raw_input(invite) . split ()s   x = input(invite) . split ()(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRH     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = int(raw_input())s   x = int(input())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRJ     s    (   R8   R-   R
   Rf   RC   RD   RE   RF   RG   RH   RJ   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s   								t   Test_funcattrsc           B   s;   e  Z d  Z d d d d d d d g Z d   Z d	   Z RS(
   t	   funcattrst   closuret   doct   namet   defaultst   codet   globalsR   c         C   s`   xY |  j  D]N } d | } d | } |  j | |  d | } d | } |  j | |  q
 Wd  S(   Ns	   a.func_%ss   a.__%s__s   self.foo.func_%s.foo_bars   self.foo.__%s__.foo_bar(   t   attrsR!   (   R   t   attrR<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRg      s    



c         C   s]   xV |  j  D]K } d | } |  j |  d | } |  j |  d | } |  j |  q
 Wd  S(   Ns   foo(func_%s + 5)s   f(foo.__%s__)s   f(foo.__%s__.foo)(   R   R%   (   R   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh   *  s    


(   R8   R-   R
   R   Rg   Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s   	
t   Test_xreadlinesc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   t
   xreadlinesc         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   for x in f.xreadlines(): passs   for x in f: passs!   for x in foo().xreadlines(): passs   for x in foo(): passs'   for x in (5 + foo()).xreadlines(): passs   for x in (5 + foo()): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRU   8  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   foo(f.xreadlines + 5)s   foo(f.__iter__ + 5)s   foo(f().xreadlines + 5)s   foo(f().__iter__ + 5)s   foo((5 + f()).xreadlines + 5)s   foo((5 + f()).__iter__ + 5)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_attr_refE  s    c         C   sP   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   for x in f.xreadlines(5): passs    for x in f.xreadlines(k=5): passs$   for x in f.xreadlines(*k, **v): passs   foo(xreadlines)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh   R  s    (   R8   R-   R
   RU   R   Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   5  s   		t   ImportsFixerTestsc           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   sl   xe |  j  j   D]T \ } } d | } d | } |  j | |  d | } d | } |  j | |  q Wd  S(   Ns	   import %ss   import foo, %s, bar(   t   modulest   itemsR!   (   R   t   oldt   newR<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_moduleb  s    



c         C   s   x |  j  j   D]x \ } } d | } d | } |  j | |  d | } d | } |  j | |  d | } d | } |  j | |  q Wd  S(   Ns   from %s import foos   from %s import foo, bars   from %s import (yes, no)(   R   R   R!   (   R   R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_froml  s    





c         C   sl   xe |  j  j   D]T \ } } d | } d | } |  j | |  d | } d | } |  j | |  q Wd  S(   Ns   import %s as foo_bar(   R   R   R!   (   R   R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_module_asz  s    



c         C   sH   xA |  j  j   D]0 \ } } d | } d | } |  j | |  q Wd  S(   Ns   from %s import foo as bar(   R   R   R!   (   R   R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_from_as  s    

c         C   sH   xA |  j  j   D]0 \ } } d | } d | } |  j | |  q Wd  S(   Ns   from %s import *(   R   R   R!   (   R   R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_star  s    

c         C   s  x |  j  j   D] \ } } d | | f } d | | f } |  j | |  d | | f } d | | f } |  j | |  d | f } |  j |  d | | | f } d | | | f } |  j | |  d | | f } d | | f } |  j | |  q Wd  S(   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
                (   R   R   R!   R%   (   R   R   R   R<   R=   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_module_usage  s    (   R8   R-   R   R   R   R   R   R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   `  s   	
		
		t   Test_importsc           B   s0   e  Z d  Z d d l m Z d   Z d   Z RS(   t   importsi   (   t   MAPPINGc         C   s    d } d } |  j  | |  d  S(   Ns   import urlparse, cStringIOs   import urllib.parse, io(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_multiple_imports  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_multiple_imports_as  s    (   R8   R-   R
   t   fixes.fix_importsR  R   R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   	t   Test_imports2c           B   s   e  Z d  Z d d l m Z RS(   t   imports2i   (   R  (   R8   R-   R
   t   fixes.fix_imports2R  R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   t   Test_imports_fixer_orderc           B   s   e  Z d    Z d   Z RS(   c         C   sq   t  t |   j d d g  d d l m } | j   |  _ d d l m } x d	 D] } | | |  j | <qR Wd  S(
   NR  R  i   (   R  t   dbhasht   dumbdbmt   dbmt   gdbm(   R  R  R  R  (   R   R
  R   R	  R  t   copyR   R  (   R   t   mapping2t   mapping1t   key(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s+   x$ d D] } | |  _  |  j d  q Wd  S(   NR  R  t   import(   s   importss   imports2(   R
   R7   (   R   t   fix(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt$   test_after_local_imports_refactoring  s    	(   R8   R-   R   R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR
    s   	t   Test_urllibc           B   s]   e  Z d  Z d d l m Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z RS(
   t   urllibi   (   R  c         C   s`   xY |  j  j   D]H \ } } d | } d d j t t d  |   } |  j | |  q Wd  S(   Ns	   import %ss   , i    (   R   R   R#   t   mapR   R!   (   R   R   t   changesR<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    
"c   
      C   sl  xe|  j  j   D]T\ } } g  } x | D] \ } } xb | D]Z } | j |  d | | f } d | | f } |  j | |  d | }	 |  j |	  q< Wd | d j |  f } d | d j |  f } |  j | |  d d j |  }	 |  j |	  q) Wd | d j |  f } d j g  | D]% \ } } d | d j |  f ^ q& } |  j | |  q Wd  S(   Ns   from %s import %ss   from foo import %ss   , s   
(   R   R   t   appendR!   R%   R#   (
   R   R   R  t   all_membersR   t   memberst   memberR<   R=   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s&    
	2c         C   s2   x+ |  j  D]  } d | } |  j | d  q
 Wd  S(   Ns   import %s as foos#   This module is now multiple modules(   R   R(   (   R   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    
c         C   s   x |  j  j   D] \ } } x | D] \ } } xt | D]l } d | | f } d | | f } |  j | |  d | | | f } d | | | f } |  j | |  q6 Wq# Wq Wd  S(   Ns   from %s import %s as foo_bars   from %s import %s as blah, %s(   R   R   R!   (   R   R   R  R   R  R  R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s2   x+ |  j  D]  } d | } |  j | d  q
 Wd  S(   Ns   from %s import *s   Cannot handle star imports(   R   R(   (   R   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR      s    
c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_indented%  s    c      	   C   s   x |  j  j   D] \ } } x | D] \ } } x | D] } d j g  |  j  | D] \ } } | ^ qP  } d | | | f }	 d | | | f }
 |  j |	 |
  d | | | | | f }	 d | | | | | f }
 |  j |	 |
  q6 Wq# Wq Wd  S(   Ns   , s^   
                        import %s
                        foo(%s.%s)
                        s`   
                        import %s
                        %s.%s(%s.%s)
                        (   R   R   R#   R!   (   R   R   R  R   R  R  R5   t   memst
   new_importR<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   @  s    	&(   R8   R-   R
   t   fixes.fix_urllibR  R   R   R   R   R   R   R  R   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   						t
   Test_inputc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   t   inputc         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x =   input(   )s   x =   eval(input(   ))s   x = input(   ''   )s   x = eval(input(   ''   ))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf   ]  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = input()  #  foos   x = eval(input())  #  foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   f  s    c         C   s=   d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   x = eval(input())s   x = eval(input(''))s   x = eval(input(foo(5) + 9))(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRp   k  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = input()s   x = eval(input())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC   u  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = input('')s   x = eval(input(''))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD   z  s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = input('prompt')s   x = eval(input('prompt'))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = input(foo(5) + 9)s   x = eval(input(foo(5) + 9))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF     s    (
   R8   R-   R
   Rf   R   Rp   RC   RD   RE   RF   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR"  Z  s   				
			t   Test_tuple_paramsc           B   s   e  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 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   tuple_paramsc         C   s   d } |  j  |  d  S(   Ns   def foo(): pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRY     s    c         C   s   d } |  j  |  d  S(   Ns   def foo(a, b, c): pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRZ     s    c         C   s   d } |  j  |  d  S(   Ns   def foo(a=3, b=4, c=5): pass(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR[     s    c         C   s    d } d } |  j  | |  d  S(   Ns8   
            def foo(((a, b), c)):
                x = 5sn   
            def foo(xxx_todo_changeme):
                ((a, b), c) = xxx_todo_changeme
                x = 5(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC     s    c         C   s    d } d } |  j  | |  d  S(   Ns;   
            def foo(((a, b), c), d):
                x = 5sq   
            def foo(xxx_todo_changeme, d):
                ((a, b), c) = xxx_todo_changeme
                x = 5(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD     s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_semicolon  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_keywords  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_varargs  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_multi_1  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_multi_2  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_docstring  s    c         C   s   d } |  j  |  d  S(   Ns   lambda x: x + 5(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_no_change  s    c         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   lambda (x): x + 5s   lambda x: x + 5s   lambda(x): x + 5s   lambda ((((x)))): x + 5s   lambda((((x)))): x + 5(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_parens_single_arg  s    c         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   lambda (x, y): x + f(y)s   lambda x_y: x_y[0] + f(x_y[1])s   lambda(x, y): x + f(y)s   lambda (((x, y))): x + f(y)s   lambda(((x, y))): x + f(y)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_simple  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   lambda (x,): x + f(x)s   lambda x1: x1[0] + f(x1[0])s   lambda (((x,))): x + f(x)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_one_tuple#  s    c         C   s    d } d } |  j  | |  d  S(   Ns   lambda (x, y): x + x + f(x) + xs0   lambda x_y: x_y[0] + x_y[0] + f(x_y[0]) + x_y[0](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_simple_multi_use,  s    c         C   s    d } d } |  j  | |  d  S(   Ns   lambda (x, y): y + xs   lambda x_y: x_y[1] + x_y[0](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_simple_reverse1  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   lambda (x, (y, z)): x + y + zs2   lambda 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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_nested6  s    c         C   s    d } d } |  j  | |  d  S(   Ns    lambda (x, (y, z)): x + y + f(y)s5   lambda x_y_z: x_y_z[0] + x_y_z[1][0] + f(x_y_z[1][0])(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_lambda_nested_multi_use?  s    (   R8   R-   R
   RY   RZ   R[   RC   RD   RE   R&  R'  R(  R)  R*  R+  R,  R-  R.  R/  R0  R1  R2  R3  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR$    s*   																					t   Test_methodattrsc           B   s/   e  Z d  Z d d d g Z d   Z d   Z RS(   t   methodattrst   funcR   t   classc         C   s   x |  j  D]x } d | } | d k r/ d } n
 d | } |  j | |  d | } | d k rh d } n
 d | } |  j | |  q
 Wd  S(   Ns   a.im_%sR7  s   a.__self__.__class__s   a.__%s__s   self.foo.im_%s.foo_bars#   self.foo.__self__.__class__.foo_bars   self.foo.__%s__.foo_bar(   R   R!   (   R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRg   I  s    
	

	
c         C   s]   xV |  j  D]K } d | } |  j |  d | } |  j |  d | } |  j |  q
 Wd  S(   Ns   foo(im_%s + 5)s   f(foo.__%s__)s   f(foo.__%s__.foo)(   R   R%   (   R   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh   Y  s    


(   R8   R-   R
   R   Rg   Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR4  D  s   	t	   Test_nextc           B   s  e  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 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 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* d)   Z+ d*   Z, d+   Z- d,   Z. d-   Z/ RS(.   t   nextc         C   s    d } d } |  j  | |  d  S(   Ns	   it.next()s   next(it)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC   g  s    c         C   s    d } d } |  j  | |  d  S(   Ns   a.b.c.d.next()s   next(a.b.c.d)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD   l  s    c         C   s    d } d } |  j  | |  d  S(   Ns   (a + b).next()s   next((a + b))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE   q  s    c         C   s    d } d } |  j  | |  d  S(   Ns
   a().next()s	   next(a())(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF   v  s    c         C   s    d } d } |  j  | |  d  S(   Ns   a().next() + bs   next(a()) + b(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRG   {  s    c         C   s    d } d } |  j  | |  d  S(   Ns   c(      a().next() + b)s   c(      next(a()) + b)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRH     s    c         C   s    d } d } |  j  | |  d  S(   NsU   
            for a in b:
                foo(a)
                a.next()
            sT   
            for a in b:
                foo(a)
                next(a)
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation_1  s    c         C   s    d } d } |  j  | |  d  S(   Nsq   
            for a in b:
                foo(a) # abc
                # def
                a.next()
            sp   
            for a in b:
                foo(a) # abc
                # def
                next(a)
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation_2  s    c         C   s&   d } d } |  j  | | d t d  S(   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'   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation_3  s    c         C   s&   d } d } |  j  | | d t d  S(   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'   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation_4  s    c         C   s&   d } d } |  j  | | d t d  S(   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'   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation_5  s    c         C   s    d } d } |  j  | |  d  S(   Nse   
            for a in b:
                foo(foo(a), # abc
                    a.next())
            sd   
            for a in b:
                foo(foo(a), # abc
                    next(a))
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix_preservation_6  s    c         C   s    d } d } |  j  | |  d  S(   Ns[   
            class A:
                def next(self):
                    pass
            s_   
            class A:
                def __next__(self):
                    pass
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_method_1  s    c         C   s    d } d } |  j  | |  d  S(   Nsc   
            class A(object):
                def next(self):
                    pass
            sg   
            class A(object):
                def __next__(self):
                    pass
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_method_2  s    c         C   s    d } d } |  j  | |  d  S(   NsX   
            class A:
                def next(x):
                    pass
            s\   
            class A:
                def __next__(x):
                    pass
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_method_3  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_method_4	  s    c         C   s   d } |  j  |  d  S(   Nsa   
            class A:
                def next(self, a, b):
                    pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_method_unchanged	  s    c         C   s   d } |  j  | d  d  S(   Nsy   
            next = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_assign_simple%	  s    c         C   s   d } |  j  | d  d  S(   Ns~   
            (next, a) = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_assign_tuple_1/	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            (a, (b, (next, c)), a) = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_assign_tuple_29	  s    c         C   s   d } |  j  | d  d  S(   Ns~   
            [next, a] = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_assign_list_1C	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            [a, [b, [next, c]], a] = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_assign_list_2M	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            def foo():
                __builtin__.next = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_builtin_assignW	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            def foo():
                (a, __builtin__.next) = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_builtin_assign_in_tupleb	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            def foo():
                [a, __builtin__.next] = foo

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_builtin_assign_in_listm	  s    c         C   s   d } |  j  |  d  S(   Ns   
            def foo():
                A.next = foo

            class A:
                def next(self, a, b):
                    pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_assign_to_nextx	  s    c         C   s   d } |  j  |  d  S(   Ns   
            def foo():
                (a, A.next) = foo

            class A:
                def next(self, a, b):
                    pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_assign_to_next_in_tuple	  s    c         C   s   d } |  j  |  d  S(   Ns   
            def foo():
                [a, A.next] = foo

            class A:
                def next(self, a, b):
                    pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_assign_to_next_in_list	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            import foo.bar as next

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_1	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            import bar, bar.foo as next

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_2	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            import bar, bar.foo as next, baz

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_3	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            from x import next

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_from_1	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            from x.a import next

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_from_2	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            from x import a, next, b

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_from_3	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            from x.a import a, next, b

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_import_from_4	  s    c         C   s   d } |  j  | d  d  S(   Ns   
            def next(a):
                pass

            class A:
                def next(self, a, b):
                    pass
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_funcdef_1	  s    c         C   s#   d } d } |  j  | | d  d  S(   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&   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_funcdef_2	  s    

c         C   s   d } |  j  | d  d  S(   NsW   
            def f():
                global next
                next = 5
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_global_1
  s    c         C   s   d } |  j  | d  d  S(   Ns]   
            def f():
                global a, next, b
                next = 5
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_global_2	
  s    c         C   s   d } |  j  | d  d  S(   Nse   
            for next in it():
                pass

            b = 5
            c = 6
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_for_simple
  s    c         C   s   d } |  j  | d  d  S(   Nsh   
            for next, b in it():
                pass

            b = 5
            c = 6
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_for_tuple_1
  s    c         C   s   d } |  j  | d  d  S(   Nsp   
            for a, (next, c), b in it():
                pass

            b = 5
            c = 6
            s)   Calls to builtin next() possibly shadowed(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_shadowing_for_tuple_2%
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   gnext = g.nexts   gnext = g.__next__(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_noncall_access_1/
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   f(g.next + 5)s   f(g.__next__ + 5)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_noncall_access_24
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   f(g().next + 5)s   f(g().__next__ + 5)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_noncall_access_39
  s    (0   R8   R-   R
   RC   RD   RE   RF   RG   RH   R:  R;  R<  R=  R>  R?  R@  RA  RB  RC  RD  RE  RF  RG  RH  RI  RJ  RK  RL  RM  RN  RO  RP  RQ  RR  RS  RT  RU  RV  RW  RX  RY  RZ  R[  R\  R]  R^  R_  R`  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR8  d  s\   																		
	
	
	
	
							
	
	
	
	
	
	
					
	
	
		t   Test_nonzeroc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   t   nonzeroc         C   s    d } d } |  j  | |  d  S(   Nsb   
            class A:
                def __nonzero__(self):
                    pass
            s_   
            class A:
                def __bool__(self):
                    pass
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC   A
  s    c         C   s    d } d } |  j  | |  d  S(   Nsj   
            class A(object):
                def __nonzero__(self):
                    pass
            sg   
            class A(object):
                def __bool__(self):
                    pass
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD   N
  s    c         C   s   d } |  j  |  d  S(   Nsg   
            class A(object):
                def __bool__(self):
                    pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRY   [
  s    c         C   s   d } |  j  |  d  S(   Nsm   
            class A(object):
                def __nonzero__(self, a):
                    pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRZ   c
  s    c         C   s   d } |  j  |  d  S(   NsE   
            def __nonzero__(self):
                pass
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_funck
  s    (   R8   R-   R
   RC   RD   RY   RZ   Rc  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRa  >
  s   				t   Test_numliteralsc           B   s   e  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 d   Z RS(   t   numliteralsc         C   s    d } d } |  j  | |  d  S(   Nt   0755t   0o755(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_octal_1u
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   a = 12Ls   a = 12(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_long_int_1z
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   a = 12ls   a = 12(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_long_int_2
  s    c         C   s    d } d } |  j  | |  d  S(   Ns	   b = 0x12ls   b = 0x12(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_long_hex
  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   b =   0x12Ls
   b =   0x12s   b = 0755 # spams   b = 0o755 # spam(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_comments_and_spacing
  s    c         C   s   d } |  j  |  d  S(   Nt   5(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_int
  s    c         C   s   d } |  j  |  d  S(   Ns   5.0(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_float
  s    c         C   s   d } |  j  |  d  S(   NRg  (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_octal
  s    c         C   s   d } |  j  |  d  S(   Nt   0xABC(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_hex
  s    c         C   s   d } |  j  |  d  S(   Ns   5.0e10(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_exp
  s    c         C   s   d } |  j  |  d  S(   Ns   5 + 4j(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_complex_int
  s    c         C   s   d } |  j  |  d  S(   Ns
   5.4 + 4.9j(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_complex_float
  s    c         C   s*   d } |  j  |  d } |  j  |  d  S(   Nt   4js   4.4j(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_complex_bare
  s    (   R8   R-   R
   Rh  Ri  Rj  Rk  Rl  Rn  Ro  Rp  Rr  Rs  Rt  Ru  Rw  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRd  r
  s   													t   Test_renamesc           B   s?   e  Z d  Z i d d 6Z d   Z d   Z d   Z d   Z RS(	   t   renamest   maxintt   maxsizet   sysc         C   sq   xj |  j  j   D]Y \ } \ } } d | | f } d | | f } |  j | |  d | } |  j |  q Wd  S(   Ns   from %s import %ss   from foo import %s(   R   R   R!   R%   (   R   t   modR   R   R<   R=   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   
  s    "
c         C   sZ   xS |  j  j   D]B \ } \ } } d | | f } d | | f } |  j | |  q Wd  S(   Ns   from %s import %s as foo_bar(   R   R   R!   (   R   R}  R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   
  s    "c         C   sf   x_ |  j  j   D]N \ } \ } } d | | | | f } d | | | | f } |  j | |  q Wd  S(   NsJ   
                import %s
                foo(%s, %s.%s)
                (   R   R   R!   (   R   R}  R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   
  s    "c         C   sf   x_ |  j  j   D]N \ } \ } } d | | | | f } d | | | | f } |  j | |  q Wd  S(   NsO   
                from %s import %s
                foo(%s, %s)
                (   R   R   R!   (   R   R}  R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   XXX_test_from_import_usage
  s    "(   s   maxints   maxsize(   R8   R-   R
   R   R   R   R   R~  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRx  
  s   				t   Test_unicodec           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   R   c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   unicode( x)s   str( x)s    unicode(x )s    str(x )s    u'h's    'h'(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_whitespace
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   unicode(x, y, z)s   str(x, y, z)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unicode_call
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   unichr(u'h')s   chr('h')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unichr
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   u"x"s   "x"(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unicode_literal_1
  s    c         C   s    d } d } |  j  | |  d  S(   Ns   ur'x's   r'x'(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unicode_literal_2  s    c         C   s    d } d } |  j  | |  d  S(   Ns
   UR'''x''' s	   R'''x''' (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unicode_literal_3  s    (	   R8   R-   R
   R  R  R  R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  
  s   					t   Test_callablec           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   t   callablec         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   callable(    x)s:   import collections
isinstance(    x, collections.Callable)s   if     callable(x): passsC   import collections
if     isinstance(x, collections.Callable): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s    d } d } |  j  | |  d  S(   Ns   callable(x)s6   import collections
isinstance(x, collections.Callable)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_callable_call  s    c         C   s   d d } d d } |  j  | |  d d } |  j  | |  d d } d d } |  j  | |  d d } d d } |  j  | |  d	 d } d
 d } |  j  | |  d  S(   Ns!   
def spam(foo):
    callable(foo)i   sL   
import collections
def spam(foo):
    isinstance(foo, collections.Callable)s4   
import collections
def spam(foo):
    callable(foo)s;   
from collections import *
def spam(foo):
    callable(foo)sf   
from collections import *
import collections
def spam(foo):
    isinstance(foo, collections.Callable)s;   
do_stuff()
do_some_other_stuff()
assert callable(do_stuff)sf   
import collections
do_stuff()
do_some_other_stuff()
assert isinstance(do_stuff, collections.Callable)s   
if isinstance(do_stuff, Callable):
    assert callable(do_stuff)
    do_stuff(do_stuff)
    if not callable(do_stuff):
        exit(1)
    else:
        assert callable(do_stuff)
else:
    assert not callable(do_stuff)sN  
import collections
if isinstance(do_stuff, Callable):
    assert isinstance(do_stuff, collections.Callable)
    do_stuff(do_stuff)
    if not isinstance(do_stuff, collections.Callable):
        exit(1)
    else:
        assert isinstance(do_stuff, collections.Callable)
else:
    assert not isinstance(do_stuff, collections.Callable)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_global_import  s    








c         C   sP   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   callable(*x)s   callable(x, y)s   callable(x, kw=y)s
   callable()(   R%   (   R   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_callable_should_not_change[  s    (   R8   R-   R
   Rf   R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s
   	
		>t   Test_filterc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   t   filterc         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns#   x =   filter(    foo,     'abc'   )s)   x =   list(filter(    foo,     'abc'   ))s   x =   filter(  None , 'abc'  )s    x =   [_f for _f in 'abc' if _f](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf   k  s    c         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x = filter(None, 'abc')s   x = [_f for _f in 'abc' if _f]s   x = len(filter(f, 'abc'))s   x = 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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_filter_basict  s    c         C   sm  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  |  d } |  j  |  d  S(   Ns   b.join(filter(f, 'abc'))s#   (a + foo(5)).join(filter(f, 'abc'))s   iter(filter(f, 'abc'))s   list(filter(f, 'abc'))s   list(filter(f, 'abc'))[0]s   set(filter(f, 'abc'))s   set(filter(f, 'abc')).pop()s   tuple(filter(f, 'abc'))s   any(filter(f, 'abc'))s   all(filter(f, 'abc'))s   sum(filter(f, 'abc'))s   sorted(filter(f, 'abc'))s"   sorted(filter(f, 'abc'), key=blah)s%   sorted(filter(f, 'abc'), key=blah)[0]s   enumerate(filter(f, 'abc'))s$   enumerate(filter(f, 'abc'), start=1)s   for i in filter(f, 'abc'): passs   [x for x in filter(f, 'abc')]s   (x for x in filter(f, 'abc'))(   R%   (   R   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_filter_nochange  sL    c         C   sF   d } |  j  |  d } d } |  j | |  d } |  j  |  d  S(   Ns:   from future_builtins import spam, filter; filter(f, 'ham')s6   from 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!   (   R   R=   R<   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_future_builtins  s    (   R8   R-   R
   Rf   R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  h  s
   				(t   Test_mapc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   R  c         C   s1   |  j  d | |  t t |   j | |  d  S(   Ns!   from future_builtins import map; (   R%   R   R  R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR!     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x =    map(   f,    'abc'   )s#   x =    list(map(   f,    'abc'   ))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRf     s    c         C   s    d } d } |  j  | |  d  S(   Ns   x = map(f, 'abc')   #   foos!   x = list(map(f, 'abc'))   #   foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    c         C   s   d } |  j  | d  d  S(   Ns   x = map(None, a, b, c)s5   cannot convert map(None, ...) with multiple arguments(   R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt!   test_None_with_multiple_arguments  s    c         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d } |  j  | |  d
 } d } |  j | | d  d  S(   Ns   x = map(f, 'abc')s   x = list(map(f, 'abc'))s   x = len(map(f, 'abc', 'def'))s#   x = len(list(map(f, 'abc', 'def')))s   x = map(None, 'abc')s   x = list('abc')s    x = map(lambda x: x+1, range(4))s   x = [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))
            s   You should use a for loop here(   R!   R&   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_map_basic  s$    c         C   sm  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  |  d } |  j  |  d  S(   Ns   b.join(map(f, 'abc'))s    (a + foo(5)).join(map(f, 'abc'))s   iter(map(f, 'abc'))s   list(map(f, 'abc'))s   list(map(f, 'abc'))[0]s   set(map(f, 'abc'))s   set(map(f, 'abc')).pop()s   tuple(map(f, 'abc'))s   any(map(f, 'abc'))s   all(map(f, 'abc'))s   sum(map(f, 'abc'))s   sorted(map(f, 'abc'))s   sorted(map(f, 'abc'), key=blah)s"   sorted(map(f, 'abc'), key=blah)[0]s   enumerate(map(f, 'abc'))s!   enumerate(map(f, 'abc'), start=1)s   for i in map(f, 'abc'): passs   [x for x in map(f, 'abc')]s   (x for x in map(f, 'abc'))(   R%   (   R   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_map_nochange  sL    c         C   sF   d } |  j  |  d } d } |  j | |  d } |  j  |  d  S(   Ns:   from future_builtins import spam, map, eggs; map(f, 'ham')s9   from 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!   (   R   R=   R<   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  #  s    (
   R8   R-   R
   R!   Rf   R   R  R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   					'	(t   Test_zipc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   t   zipc         C   s1   |  j  d | |  t t |   j | |  d  S(   Ns!   from future_builtins import zip; (   R%   R   R  R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR!   1  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x = zip(a, b, c)s   x = list(zip(a, b, c))s   x = len(zip(a, b))s   x = len(list(zip(a, b)))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_zip_basic5  s    c         C   sm  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  |  d } |  j  |  d  S(   Ns   b.join(zip(a, b))s   (a + foo(5)).join(zip(a, b))s   iter(zip(a, b))s   list(zip(a, b))s   list(zip(a, b))[0]s   set(zip(a, b))s   set(zip(a, b)).pop()s   tuple(zip(a, b))s   any(zip(a, b))s   all(zip(a, b))s   sum(zip(a, b))s   sorted(zip(a, b))s   sorted(zip(a, b), key=blah)s   sorted(zip(a, b), key=blah)[0]s   enumerate(zip(a, b))s   enumerate(zip(a, b), start=1)s   for i in zip(a, b): passs   [x for x in zip(a, b)]s   (x for x in zip(a, b))(   R%   (   R   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_zip_nochange>  sL    c         C   sF   d } |  j  |  d } d } |  j | |  d } |  j  |  d  S(   Ns6   from future_builtins import spam, zip, eggs; zip(a, b)s5   from 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!   (   R   R=   R<   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  f  s    (   R8   R-   R
   R!   R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  .  s
   				(t   Test_standarderrorc           B   s   e  Z d  Z d   Z RS(   t   standarderrorc         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   x =    StandardError()s   x =    Exception()s   x = StandardError(a, b, c)s   x = Exception(a, b, c)s   f(2 + StandardError(a, b, c))s   f(2 + Exception(a, b, c))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRg   t  s    (   R8   R-   R
   Rg   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  q  s   t
   Test_typesc           B   s   e  Z d  Z d   Z RS(   t   typesc         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d } |  j  | |  d
 } d } |  j  | |  d  S(   Ns   types.StringTypet   bytess   types.DictTypeR   s   types . IntTypet   ints   types.ListTypet   lists   types.LongTypes   types.NoneTypes
   type(None)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_basic_types_convert  s$    (   R8   R-   R
   R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   t   Test_idiomsc           B   s   e  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 d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   idiomsc         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   while 1: foo()s   while True: foo()s   while   1: foo()s   while   True: foo()s8   
            while 1:
                foo()
            s;   
            while True:
                foo()
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt
   test_while  s    c         C   sP   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   while 11: foo()s   while 0: foo()s   while foo(): foo()s   while []: foo()(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_while_unchanged  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x) == Ts   isinstance(x, T)s   if   type(x) == T: passs   if   isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_eq_simple  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   T == type(x)s   isinstance(x, T)s   if   T == type(x): passs   if   isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_eq_reverse  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x+y) == d.get('T')s   isinstance(x+y, d.get('T'))s   type(   x  +  y) == d.get('T')s   isinstance(x  +  y, d.get('T'))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_eq_expression  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x) is Ts   isinstance(x, T)s   if   type(x) is T: passs   if   isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_is_simple  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   T is type(x)s   isinstance(x, T)s   if   T is type(x): passs   if   isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_is_reverse  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x+y) is d.get('T')s   isinstance(x+y, d.get('T'))s   type(   x  +  y) is d.get('T')s   isinstance(x  +  y, d.get('T'))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_is_expression  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x) is not Ts   not isinstance(x, T)s   if   type(x) is not T: passs   if   not isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_is_not_simple  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   T is not type(x)s   not isinstance(x, T)s   if   T is not type(x): passs   if   not isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_is_not_reverse  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x+y) is not d.get('T')s   not isinstance(x+y, d.get('T'))s"   type(   x  +  y) is not d.get('T')s#   not isinstance(x  +  y, d.get('T'))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_is_not_expression  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x) != Ts   not isinstance(x, T)s   if   type(x) != T: passs   if   not isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_ne_simple  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   T != type(x)s   not isinstance(x, T)s   if   T != type(x): passs   if   not isinstance(x, T): pass(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_ne_reverse  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   type(x+y) != d.get('T')s   not isinstance(x+y, d.get('T'))s   type(   x  +  y) != d.get('T')s#   not isinstance(x  +  y, d.get('T'))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_ne_expression#  s    c         C   s   d } |  j  |  d  S(   Ns   type(x).__name__(   R%   (   R   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_type_unchanged,  s    c         C   s   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  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_sort_list_call0  s0    c         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d
 } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_sort_simple_expr  s*    c         C   s*   d } |  j  |  d } |  j  |  d  S(   NsM   
            v = list(t)
            w.sort()
            foo(w)
            sN   
            v = list(t)
            v.sort(u)
            foo(v)
            (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_sort_unchanged  s    (   R8   R-   R
   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s&   																												d	Rt   Test_basestringc           B   s   e  Z d  Z d   Z RS(   t
   basestringc         C   s    d } d } |  j  | |  d  S(   Ns   isinstance(x, basestring)s   isinstance(x, str)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_basestring  s    (   R8   R-   R
   R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   t   Test_bufferc           B   s    e  Z d  Z d   Z d   Z RS(   t   bufferc         C   s    d } d } |  j  | |  d  S(   Ns   x = buffer(y)s   x = memoryview(y)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_buffer   s    c         C   s    d } d } |  j  | |  d  S(   Ns   buffer(y)[4:5]s   memoryview(y)[4:5](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_slicing  s    (   R8   R-   R
   R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   	t   Test_futurec           B   s    e  Z d  Z d   Z d   Z RS(   t   futurec         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   from __future__ import bracesR"   s'   # comment
from __future__ import bracess
   # comment
s'   from __future__ import braces
# comments
   
# comment(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_future  s    c         C   s   |  j  d  d  S(   NRo   (   R7   (   R   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_run_order  s    (   R8   R-   R
   R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  
  s   	t   Test_itertoolsc           B   sV   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   t	   itertoolsc         C   sR   xK d D]C } x: d D]2 } | | d | } | | } |  j  | |  q Wq Wd  S(	   Ns
   itertools.R"   R  R  R  t   i(   s
   itertools.R"   (   s   maps   filters   zip(   R!   (   R   R   R   R  t   fR<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   checkall   s
    
c         C   s    d } d } |  j  | |  d  S(   Ns   itertools.izip(a, b)s	   zip(a, b)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_0*  s    c         C   s    d } d } |  j  | |  d  S(   Ns   %s(f, a)(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC   1  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   itertools.ifilterfalse(a, b)s   itertools.filterfalse(a, b)s   itertools.izip_longest(a, b)s   itertools.zip_longest(a, b)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_qualified6  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   ifilterfalse(a, b)s   filterfalse(a, b)s   izip_longest(a, b)s   zip_longest(a, b)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD   ?  s    c         C   s    d } d } |  j  | |  d  S(   Ns       %s(f, a)(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRb   H  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns        itertools.ifilterfalse(a, b)s       itertools.filterfalse(a, b)s        itertools.izip_longest(a, b)s       itertools.zip_longest(a, b)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRc   M  s    c         C   s   |  j  d d d  d  S(   NR  R  R  (   R7   (   R   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  V  s    (   R8   R-   R
   R  R  RC   R  RD   Rb   Rc   R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   	
									t   Test_itertools_importsc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   t   itertools_importsc         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns%   from itertools import imap, izip, foos   from itertools import foos*   from itertools import bar, imap, izip, foos   from itertools import bar, foos'   from itertools import chain, imap, izips   from itertools import chain(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_reduced]  s    c         C   s    d } d } |  j  | |  d  S(   Ns%   #foo
from itertools import imap, izips   #foo
(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_commentsj  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns    from itertools import imap, izipR"   s   from itertools import izip(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_noneo  s    c         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } |  j |  d  S(   Ns-   from itertools import izip, bar as bang, imaps!   from itertools import bar as bangs-   from itertools import izip as _zip, imap, bars   from itertools import bars"   from itertools import imap as _mapR"   s0   from itertools import imap as _map, izip as _zip(   R!   R%   (   R   R<   R=   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_asx  s    c         C   s   x d	 D] } d | f } d | f } |  j  | |  d | f } d | f } |  j  | |  d | f } d | f } |  j  | |  q Wd  S(
   Nt   filterfalset   zip_longests   from itertools import i%ss   from itertools import %ss$   from itertools import imap, i%s, foos   from itertools import %s, foos#   from itertools import bar, i%s, foos"   from itertools import bar, %s, foo(   R  R  (   R!   (   R   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_ifilter_and_zip_longest  s    c         C   s   d } |  j  |  d  S(   Ns   from itertools import *(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_star  s    c         C   s   d } |  j  |  d  S(   Ns   from itertools import foo(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh     s    (
   R8   R-   R
   R  R  R  R  R  R  Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  Z  s   							t   Test_importc           B   s   e  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 d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   R  c            s]   t  t    j   g    _ t     _ t   _   f d   } d d l m	 } | | _
 d  S(   Nc            s&     j  j |     j p% |    j k S(   N(   t   files_checkedR  t   always_existst   present_files(   R   (   R   (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   fake_exists  s    i(   t
   fix_import(   R   R  R   R  t   setR  R'   R  t   lib2to3.fixesR  t   exists(   R   R  R  (    (   R   s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR     s    		c         C   s#   d d l  m } t j j | _ d  S(   Ni(   R  (   R  R  t   ost   pathR  (   R   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   tearDown  s    c         C   sE   t  |  _ t t |   j | |  t |  _ t t |   j |  d  S(   N(   R'   R  R   R  R!   R9   R%   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt
   check_both  s    		c            s  d   } t  |  _ t d g  |  _ d t j j d d d d f } | d  d	 | d
  f } x | D]   g  |  _   |  _ |  j	 d  t j j
    r t j j
    d   n d   t   f d   | D  } | j d  |  j t |  j  |  qd Wd  S(   Nc         S   s   t  j j j |  j d   S(   Nt   /(   R  R  t   pathsepR#   t   split(   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   p  s    s   __init__.pys   .pys   .pycs   .sos   .sls   .pyds   /spam/eggs.pys   ni.pys   ../../shrubbery.pys
   import jams   /jamt   jamc         3   s   |  ] }   | Vq d  S(   N(    (   t   .0t   ext(   R   (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pys	   <genexpr>  s    (   R9   R  R  R  R  R  t   sepR  R   R%   t   dirnamet   addR   (   R   R  t   expected_extensionst   names_to_testt   expected_checks(    (   R   s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_files_checked  s    				c         C   s2   d } t  |  _ t d g  |  _ |  j |  d  S(   Ns
   import bars   bar.py(   R9   R  R  R  R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_not_in_package  s    	c         C   s5   d } t  |  _ t d d g  |  _ |  j |  d  S(   Ns1   from __future__ import absolute_import
import bars   __init__.pys   bar.py(   R9   R  R  R  R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt!   test_with_absolute_import_enabled  s    	c         C   s>   d } d } t  |  _ t d d g  |  _ |  j | |  d  S(   Ns
   import bars   from . import bars   __init__.pys   bar.py(   R9   R  R  R  R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_in_package  s
    	c         C   sH   d } d } t  |  _ t d d t j j g  |  _ |  j | |  d  S(   Ns
   import bars   from . import bars   __init__.pyt   bar(   R9   R  R  R  R  R  R  R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import_from_package  s
    	c         C   s   d } |  j  |  d  S(   Ns   from . import bar(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_already_relative_import  s    c         C   s    d } d } |  j  | |  d  S(   Ns   import bar # Foos   from . import bar # Foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_comments_and_indent  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   from foo import bar, bazs   from .foo import bar, bazs   from foo import bars   from .foo import bars   from foo import (bar, baz)s   from .foo import (bar, baz)(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_from  s    c         C   s    d } d } |  j  | |  d  S(   Ns   from green.eggs import hams   from .green.eggs import ham(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_dotted_from  s    c         C   s    d } d } |  j  | |  d  S(   Ns"   from green.eggs import ham as spams#   from .green.eggs import ham as spam(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_from_as  s    c         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(	   Ns
   import foos   from . import foos   import foo, bars   from . import foo, bars   import foo, bar, xs   from . import foo, bar, xs   import x, y, zs   from . import x, y, z(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_import  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   import foo as xs   from . import foo as xs   import a as b, b as c, c as ds$   from . import a as b, b as c, c as d(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  "  s    c         C   s8   t  |  _ t d d g  |  _ d } |  j | d  d  S(   Ns   foo.pys   __init__.pys   import foo, bars#   absolute and local imports together(   R9   R  R  R  R(   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_local_and_absolute+  s    	c         C   s    d } d } |  j  | |  d  S(   Ns   import foo.bars   from . import foo.bar(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_dotted_import2  s    c         C   s    d } d } |  j  | |  d  S(   Ns   import foo.bar as bangs   from . import foo.bar as bang(   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_dotted_import_as7  s    c         C   s    d } d } |  j  | |  d  S(   Ns1   
        # prefix
        import foo.bar
        s8   
        # prefix
        from . import foo.bar
        (   R  (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_prefix<  s    (   R8   R-   R
   R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s(   																			t   Test_set_literalc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   t   set_literalc         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } |  j  | |  d } d } |  j  | |  d	 } |  j  | |  d
 } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   set([1, 2, 3])s	   {1, 2, 3}s   set((1, 2, 3))s	   set((1,))s   {1}s   set([1])s   set((a, b))s   {a, b}s   set([a, b])s   set((a*234, f(args=23)))s   {a*234, f(args=23)}s   set([a*23, f(23)])s   {a*23, f(23)}s   set([a-234**23])s   {a-234**23}(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR>   L  s2    c         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(	   Ns   set([x for x in y])s   {x for x in y}s   set([x for x in y if x == m])s   {x for x in y if x == m}s   set([x for x in y for a in b])s   {x for x in y for a in b}s   set([f(x) - 23 for x in y])s   {f(x) - 23 for x in y}(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_listcompso  s    c         C   s   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d	 } d
 } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   set( [1, 2])s   {1, 2}s   set([1 ,  2])s   {1 ,  2}s
   set([ 1 ])s   { 1 }s
   set( [1] )s   {1}s   set([  1,  2  ])s   {  1,  2  }s   set([x  for x in y ])s   {x  for x in y }s<   set(
                   [1, 2]
               )
            s   {1, 2}
(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s*    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   set((1, 2)) # His   {1, 2} # HisZ   
            # Foo
            set( # Bar
               (1, 2)
            )
            s2   
            # Foo
            {1, 2}
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s    c         C   sv   d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   set()s   set(a)s   set(a, b, c)s   set(x for x in y)s   set(x for x in y if z)s   set(a*823-23**2 + f(23))(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh     s    (   R8   R-   R
   R>   R  R  R  Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  H  s   	#		 	t   Test_sys_excc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   sys_excc         C   s    d } d } |  j  | |  d  S(   Ns   sys.exc_types   sys.exc_info()[0](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s    c         C   s    d } d } |  j  | |  d  S(   Ns   sys.exc_values   sys.exc_info()[1](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC     s    c         C   s    d } d } |  j  | |  d  S(   Ns   sys.exc_tracebacks   sys.exc_info()[2](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD     s    c         C   s    d } d } |  j  | |  d  S(   Ns   sys.exc_type # Foos   sys.exc_info()[0] # Foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   Ns   sys.  exc_types   sys.  exc_info()[0](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF     s    c         C   s    d } d } |  j  | |  d  S(   Ns   sys  .exc_types   sys  .exc_info()[0](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRG     s    (	   R8   R-   R
   R  RC   RD   RE   RF   RG   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   					t
   Test_parenc           B   sz   e  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(   t   parenc         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in 1, 2 ]s   [i for i in (1, 2) ](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in 1, 2, ]s   [i for i in (1, 2,) ](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRC     s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i  in     1, 2 ]s   [i for i  in     (1, 2) ](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRD     s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in 1, 2 if i]s   [i for i in (1, 2) if i](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRE     s    c         C   s    d } d } |  j  | |  d  S(   Ns   [i for i in 1,    2    ]s   [i for i in (1,    2)    ](   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRF      s    c         C   s    d } d } |  j  | |  d  S(   Ns   (i for i in 1, 2)s   (i for i in (1, 2))(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRG     s    c         C   s    d } d } |  j  | |  d  S(   Ns   (i for i in 1   ,2   if i)s   (i for i in (1   ,2)   if i)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRH   
  s    c         C   s   d } |  j  |  d  S(   Ns   [i for i in (1, 2)](   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_unchanged_0  s    c         C   s   d } |  j  |  d  S(   Ns   [i for i in foo()](   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRY     s    c         C   s   d } |  j  |  d  S(   Ns   [i for i in (1, 2) if nothing](   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRZ     s    c         C   s   d } |  j  |  d  S(   Ns   (i for i in (1, 2))(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR[     s    c         C   s   d } |  j  |  d  S(   Ns   [i for i in m](   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR\     s    (   R8   R-   R
   R  RC   RD   RE   RF   RG   RH   R  RY   RZ   R[   R\   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   											t   Test_metaclassc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   t	   metaclassc         C   s   |  j  d  |  j  d  |  j  d  |  j  d  |  j  d  |  j  d  |  j  d  d } |  j  |  d	 } |  j  |  d  S(
   Ns   class X(): passs   class X(object): passs   class X(object1, object2): passs(   class X(object1, object2, object3): passs   class X(metaclass=Meta): passs'   class X(b, arg=23, metclass=Meta): passs2   class X(b, arg=23, metaclass=Meta, other=42): passsD   
        class X:
            def __metaclass__(self): pass
        s1   
        class X:
            a[23] = 74
        (   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh   '  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  <  s    c         C   s8  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  | |  d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt	   test_metaU  sB    (   R8   R-   R
   Rh   R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  #  s   		t   Test_getcwduc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   t   getcwduc         C   st   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(	   Ns
   os.getcwdus	   os.getcwds   os.getcwdu()s   os.getcwd()s   meth = os.getcwdus   meth = os.getcwds   os.getcwdu(args)s   os.getcwd(args)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR>     s    c         C   s    d } d } |  j  | |  d  S(   Ns   os.getcwdu() # Foos   os.getcwd() # Foo(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_comment  s    c         C   s=   d } |  j  |  d } |  j  |  d } |  j  |  d  S(   Ns   os.getcwd()s	   getcwdu()s   os.getcwdb()(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh     s    c         C   s    d } d } |  j  | |  d  S(   Ns<   
            if 1:
                os.getcwdu()
            s;   
            if 1:
                os.getcwd()
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_indentation  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   os .getcwdu()s   os .getcwd()s   os.  getcwdus   os.  getcwds   os.getcwdu (  )s   os.getcwd (  )(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_multilation  s    (   R8   R-   R
   R>   R  Rh   R  R	  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s   			
	t   Test_operatorc           B   s   e  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 d   Z d   Z RS(   t   operatorc         C   s    d } d } |  j  | |  d  S(   Ns   operator.isCallable(x)s   hasattr(x, '__call__')(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_isCallable	  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   operator.sequenceIncludes(x, y)s   operator.contains(x, y)s    operator .sequenceIncludes(x, y)s   operator .contains(x, y)s!   operator.  sequenceIncludes(x, y)s   operator.  contains(x, y)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_sequenceIncludes  s    c         C   s    d } d } |  j  | |  d  S(   Ns   operator.isSequenceType(x)s6   import collections
isinstance(x, collections.Sequence)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_isSequenceType  s    c         C   s    d } d } |  j  | |  d  S(   Ns   operator.isMappingType(x)s5   import collections
isinstance(x, collections.Mapping)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_isMappingType   s    c         C   s    d } d } |  j  | |  d  S(   Ns   operator.isNumberType(x)s,   import numbers
isinstance(x, numbers.Number)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_isNumberType%  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   operator.repeat(x, n)s   operator.mul(x, n)s   operator .repeat(x, n)s   operator .mul(x, n)s   operator.  repeat(x, n)s   operator.  mul(x, n)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_repeat*  s    c         C   sX   d } d } |  j  | |  d } d } |  j  | |  d } d } |  j  | |  d  S(   Ns   operator.irepeat(x, n)s   operator.imul(x, n)s   operator .irepeat(x, n)s   operator .imul(x, n)s   operator.  irepeat(x, n)s   operator.  imul(x, n)(   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_operator_irepeat7  s    c         C   s    d } d } |  j  | |  d  S(   Ns   isCallable(x)s-   You should use 'hasattr(x, '__call__')' here.(   R(   (   R   RX   t   t(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bare_isCallableD  s    c         C   s    d } d } |  j  | |  d  S(   Ns   sequenceIncludes(x, y)s.   You should use 'operator.contains(x, y)' here.(   R(   (   R   RX   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bare_sequenceIncludesI  s    c         C   s    d } d } |  j  | |  d  S(   Ns   isSequenceType(z)s:   You should use 'isinstance(z, collections.Sequence)' here.(   R(   (   R   RX   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt!   test_bare_operator_isSequenceTypeN  s    c         C   s    d } d } |  j  | |  d  S(   Ns   isMappingType(x)s9   You should use 'isinstance(x, collections.Mapping)' here.(   R(   (   R   RX   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt    test_bare_operator_isMappingTypeS  s    c         C   s    d } d } |  j  | |  d  S(   Ns   isNumberType(y)s4   You should use 'isinstance(y, numbers.Number)' here.(   R(   (   R   RX   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bare_operator_isNumberTypeX  s    c         C   s    d } d } |  j  | |  d  S(   Ns   repeat(x, n)s)   You should use 'operator.mul(x, n)' here.(   R(   (   R   RX   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bare_operator_repeat]  s    c         C   s    d } d } |  j  | |  d  S(   Ns   irepeat(y, 187)s,   You should use 'operator.imul(y, 187)' here.(   R(   (   R   RX   R  (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_bare_operator_irepeatb  s    (   R8   R-   R
   R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR
    s   													t   Test_exitfuncc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   t   exitfuncc         C   s    d } d } |  j  | |  d  S(   NsI   
            import sys
            sys.exitfunc = my_atexit
            se   
            import sys
            import atexit
            atexit.register(my_atexit)
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR   l  s    c         C   s    d } d } |  j  | |  d  S(   NsO   
            import sys, crumbs
            sys.exitfunc = my_func
            sY   
            import sys, crumbs, atexit
            atexit.register(my_func)
            (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_names_importx  s    c         C   s    d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_complex_expression  s    c         C   s<   d } d } |  j  | |  d } d } |  j  | |  d  S(   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!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR    s    c         C   s    d } d } |  j  | |  d  S(   Ns]   
            import sys
            def f():
                sys.exitfunc = func
            sz   
            import sys
            import atexit
            def f():
                atexit.register(func)
             (   R!   (   R   R<   R=   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_in_a_function  s    c         C   s)   d } d } d } |  j  | | |  d  S(   Ns   sys.exitfunc = fs   atexit.register(f)sK   Can't find sys import; Please add an atexit import at the top of your file.(   R&   (   R   R<   R=   t   msg(    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   test_no_sys_import  s    c         C   s   d } |  j  |  d  S(   Ns   f(sys.exitfunc)(   R%   (   R   RX   (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyRh     s    (
   R8   R-   R
   R   R  R  R  R  R!  Rh   (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyR  h  s   						(E   t   __doc__R  t   unittestR  R    R  R   R   R   R   R   R   t   lib2to3.testsR   t   TestCaseR   R:   RA   RN   Rd   Ri   Rn   R~   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R
  R  R"  R$  R4  R8  Ra  Rd  Rx  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R
  R  (    (    (    s/   /sys/lib/python2.7/lib2to3/tests/test_fixers.pyt   <module>   s~   "9:1#j3& }.&H/+bn/  4B.)]VpC Y=J":=c