Current File : //usr/local/apps/python3/lib/python3.11/lib2to3/tests/__pycache__/test_fixers.cpython-311.opt-1.pyc
�

�Ke���X�dZddlZddlmZddlmZddlmZmZddl	m
Z
Gd�de
j��ZGd	�d
e��Z
Gd�de��ZGd
�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�d e��ZGd!�d"e��ZGd#�d$e��ZGd%�d&e��ZGd'�d(e��ZGd)�d*e��ZGd+�d,e��ZGd-�d.e��ZGd/�d0e��Z Gd1�d2e��Z!Gd3�d4��Z"Gd5�d6ee"��Z#Gd7�d8ee"��Z$Gd9�d:ee"��Z%Gd;�d<e��Z&Gd=�d>e��Z'Gd?�d@e��Z(GdA�dBe��Z)GdC�dDe��Z*GdE�dFe��Z+GdG�dHe��Z,GdI�dJe��Z-GdK�dLe��Z.GdM�dNe��Z/GdO�dPe��Z0GdQ�dRe��Z1GdS�dTe��Z2GdU�dVe��Z3GdW�dXe��Z4GdY�dZe��Z5Gd[�d\e��Z6Gd]�d^e��Z7Gd_�d`e��Z8Gda�dbe��Z9Gdc�dde��Z:Gde�dfe��Z;Gdg�dhe��Z<Gdi�dje��Z=Gdk�dle��Z>Gdm�dne��Z?Gdo�dpe��Z@Gdq�dre��ZAGds�dte��ZBdS)uz" Test suite for the fixer modules �N)�chain)�
itemgetter)�pygram�
fixer_util)�supportc�@�eZdZdd�Zd�Zdd�Zdd�Zd�Zdd	�Zd
�Z	dS)
�
FixerTestCaseN�lib2to3c���|�|jg}tj|||��|_g|_d|_t
|jj|jj��D]}|j|_	�dS)Nz<string>)
�fixerr�get_refactorer�refactor�	fixer_log�filenamer�	pre_order�
post_order�log)�self�fix_list�	fixer_pkg�optionsrs     �C/usr/local/apps/python3/lib/python3.11/lib2to3/tests/test_fixers.py�setUpzFixerTestCase.setUpsr�����
�|�H��.�y�(�G�L�L��
����"��
��4�=�2��=�3�5�5�	'�	'�E���E�I�I�	'�	'�c���tj|��}tj|��}|j�||j��}|�|t
|����|S�N)r�reformatr�refactor_stringr�assertEqual�str)r�before�after�trees    r�_checkzFixerTestCase._checks\���!�&�)�)��� ��'�'���}�,�,�V�T�]�C�C�������D�	�	�*�*�*��rFc��|�||��}|�|j��|s|�|jg��dSdSr)r$�
assertTrue�was_changedrr)rr!r"�ignore_warningsr#s     r�checkzFixerTestCase.check#sZ���{�{�6�5�)�)������(�)�)�)��	1����T�^�R�0�0�0�0�0�	1�	1rc���|�||��}|�|d�|j����|s|�|j��dSdS)N�)r$�assertIn�joinrr&r')rr!r"�message�	unchangedr#s      r�warnszFixerTestCase.warns)sd���{�{�6�5�)�)���
�
�g�r�w�w�t�~�6�6�7�7�7��	.��O�O�D�,�-�-�-�-�-�	.�	.rc�8�|�|||d���dS)NT�r/�r0)rr!r.s   r�warns_unchangedzFixerTestCase.warns_unchanged/s"���
�
�6�6�7�d�
�;�;�;�;�;rc�p�|�||��|s|�|jg��dSdSr)r$rr)rr!r(s   rr/zFixerTestCase.unchanged2sF�����F�F�#�#�#��	1����T�^�R�0�0�0�0�0�	1�	1rc���|jg}|�|��tjd|��}|���\}}d|jz}|r'|djj�|��rdS|r)|djj�|��r|sdS|�dd�	d�||zD�����d|�d���dS)	Nr
�fix_���zFixer run order (�, c�&�g|]}|jj��S�)�	__class__�
__module__)�.0�xs  r�
<listcomp>z3FixerTestCase.assert_runs_after.<locals>.<listcomp>Ds��G�G�G�q�A�K�2�G�G�Grz) is incorrect; z should be last.)
r�extendrr
�
get_fixersr<r=�endswith�failr-)r�names�fixes�r�pre�post�ns       r�assert_runs_afterzFixerTestCase.assert_runs_after7s������
���U�����"�9�e�4�4���l�l�n�n���d��T�Z����	�D��H�&�1�:�:�1�=�=�	��F��	�3�r�7�$�/�8�8��;�;�	�D�	��F��	�	�	����G�G�S��X�G�G�G�H�H�H�H�!�!�!�M�	N�	N�	N�	N�	Nr)Nr
N)F)
�__name__r=�__qualname__rr$r)r0r4r/rKr;rrr	r	
s�������	'�	'�	'�	'����1�1�1�1�.�.�.�.�<�<�<�1�1�1�1�

N�
N�
N�
N�
Nrr	c�$�eZdZdZd�Zd�Zd�ZdS)�Test_ne�nec�:�d}d}|�||��dS)Nzif x <> y:
            passzif x != y:
            pass�r)�r�b�as   r�
test_basiczTest_ne.test_basicI�*��
��
���
�
�1�a�����rc�:�d}d}|�||��dS)Nzif x<>y:
            passzif x!=y:
            passrRrSs   r�test_no_spaceszTest_ne.test_no_spacesQrWrc�:�d}d}|�||��dS)Nzif x<>y<>z:
            passzif x!=y!=z:
            passrRrSs   r�test_chainedzTest_ne.test_chainedYrWrN)rLr=rMrrVrYr[r;rrrOrOFsF�������E�����������rrOc�T�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
S)�Test_has_key�has_keyc�:�d}d}|�||��dS)Nz$x = d.has_key("x") or d.has_key("y")zx = "x" in d or "y" in drRrSs   r�test_1zTest_has_key.test_1ds&��6��*���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = a.b.c.d.has_key("x") ** 3zx = ("x" in a.b.c.d) ** 3rRrSs   r�test_2zTest_has_key.test_2i�&��/��+���
�
�1�a�����rc�:�d}d}|�||��dS)Nz!x = a.b.has_key(1 + 2).__repr__()zx = (1 + 2 in a.b).__repr__()rRrSs   r�test_3zTest_has_key.test_3ns&��3��/���
�
�1�a�����rc�:�d}d}|�||��dS)Nz,x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4z(x = (1 + 2 in a.b).__repr__() ** -3 ** 4rRrSs   r�test_4zTest_has_key.test_4ss&��>��:���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = a.has_key(f or g)zx = (f or g) in arRrSs   r�test_5zTest_has_key.test_5x�&��'��#���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = a + b.has_key(c)zx = a + (c in b)rRrSs   r�test_6zTest_has_key.test_6}�&��&��"���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = a.has_key(lambda: 12)zx = (lambda: 12) in arRrSs   r�test_7zTest_has_key.test_7��&��+��'���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = a.has_key(a for a in b)zx = (a for a in b) in arRrSs   r�test_8zTest_has_key.test_8�s&��-��)���
�
�1�a�����rc�:�d}d}|�||��dS)Nzif not a.has_key(b): passzif b not in a: passrRrSs   r�test_9zTest_has_key.test_9�s&��+��%���
�
�1�a�����rc�:�d}d}|�||��dS)Nz$if not a.has_key(b).__repr__(): passz if not (b in a).__repr__(): passrRrSs   r�test_10zTest_has_key.test_10�s&��6��2���
�
�1�a�����rc�:�d}d}|�||��dS)Nzif not a.has_key(b) ** 2: passzif not (b in a) ** 2: passrRrSs   r�test_11zTest_has_key.test_11�s&��0��,���
�
�1�a�����rN)rLr=rMrr`rbrergrirlrorrrtrvrxr;rrr]r]as��������E����
���
���
���
���
���
���
���
���
���
����rr]c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�
Test_apply�applyc�:�d}d}|�||��dS)Nzx = apply(f, g + h)z
x = f(*g + h)rRrSs   rr`zTest_apply.test_1�s&��%�����
�
�1�a�����rc�:�d}d}|�||��dS)Nzy = apply(f, g, h)zy = f(*g, **h)rRrSs   rrbzTest_apply.test_2�s&��$�� ���
�
�1�a�����rc�:�d}d}|�||��dS)Nz z = apply(fs[0], g or h, h or g)zz = fs[0](*g or h, **h or g)rRrSs   rrezTest_apply.test_3��&��2��.���
�
�1�a�����rc�:�d}d}|�||��dS)Nzapply(f, (x, y) + t)zf(*(x, y) + t)rRrSs   rrgzTest_apply.test_4��&��&�� ���
�
�1�a�����rc�:�d}d}|�||��dS)Nzapply(f, args,)�f(*args)rRrSs   rrizTest_apply.test_5�s&��!�����
�
�1�a�����rc�:�d}d}|�||��dS)Nzapply(f, args, kwds,)�f(*args, **kwds)rRrSs   rrlzTest_apply.test_6�s&��'��"���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = apply(f+g, args)zx = (f+g)(*args)rRrSs   r�test_complex_1zTest_apply.test_complex_1�rmrc�:�d}d}|�||��dS)Nzx = apply(f*g, args)zx = (f*g)(*args)rRrSs   r�test_complex_2zTest_apply.test_complex_2�rmrc�:�d}d}|�||��dS)Nzx = apply(f**g, args)zx = (f**g)(*args)rRrSs   r�test_complex_3zTest_apply.test_complex_3�rjrc�:�d}d}|�||��dS)Nzx = apply(f.g, args)zx = f.g(*args)rRrSs   r�test_dotted_namezTest_apply.test_dotted_name�r�rc�:�d}d}|�||��dS)Nzx = apply(f[x], args)zx = f[x](*args)rRrSs   r�test_subscriptzTest_apply.test_subscript�s&��'��!���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = apply(f(), args)zx = f()(*args)rRrSs   r�	test_callzTest_apply.test_call�r�rc�:�d}d}|�||��dS)Nz"x = apply(a.b.c.d.e.f, args, kwds)zx = a.b.c.d.e.f(*args, **kwds)rRrSs   r�test_extremezTest_apply.test_extreme�s&��4��0���
�
�1�a�����rc�:�d}d}|�||��dS)Nz1apply(   # foo
          f, # bar
          args)r�rRrSs   r�test_weird_commentszTest_apply.test_weird_comments�s*��
��
���
�
�1�a�����rc�4�d}|�|��dS)Nzapply()r2�r�ss  r�test_unchanged_1zTest_apply.test_unchanged_1�s�������q�����rc�4�d}|�|��dS)Nzapply(f)r2r�s  r�test_unchanged_2zTest_apply.test_unchanged_2�s�������q�����rc�4�d}|�|��dS)Nz	apply(f,)r2r�s  r�test_unchanged_3zTest_apply.test_unchanged_3�s�������q�����rc�4�d}|�|��dS)Nzapply(f, args, kwds, extras)r2r�s  r�test_unchanged_4zTest_apply.test_unchanged_4����.�����q�����rc�4�d}|�|��dS)Nzapply(f, *args, **kwds)r2r�s  r�test_unchanged_5zTest_apply.test_unchanged_5�s��)�����q�����rc�4�d}|�|��dS)Nzapply(f, *args)r2r�s  r�test_unchanged_6zTest_apply.test_unchanged_6���!�����q�����rc�4�d}|�|��dS)Nzapply(f, **kwds)r2r�s  r�test_unchanged_6bzTest_apply.test_unchanged_6b���"�����q�����rc�4�d}|�|��dS)Nz#apply(func=f, args=args, kwds=kwds)r2r�s  r�test_unchanged_7zTest_apply.test_unchanged_7
s��5�����q�����rc�4�d}|�|��dS)Nzapply(f, args=args, kwds=kwds)r2r�s  r�test_unchanged_8zTest_apply.test_unchanged_8���0�����q�����rc�4�d}|�|��dS)Nzapply(f, args, kwds=kwds)r2r�s  r�test_unchanged_9zTest_apply.test_unchanged_9s��+�����q�����rc�:�d}d}|�||��dS)Nzapply(  f,  args,   kwds)r�rR�rrUrTs   r�test_space_1zTest_apply.test_space_1�&��+��"���
�
�1�a�����rc�:�d}d}|�||��dS)Nzapply(  f  ,args,kwds   )r�rRr�s   r�test_space_2zTest_apply.test_space_2r�rN)rLr=rMrr`rbrergrirlr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;rrrzrz�s��������E����
���
���
���
���
������
���
������
���
������������������������������������������
����rrzc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�Test_reload�reloadc�:�d}d}|�||��dS)Nz	reload(a)z$import importlib
importlib.reload(a)rRrSs   r�testzTest_reload.test#s&����7���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzreload( a ) # commentz0import importlib
importlib.reload( a ) # commentzreload( a )  # commentz1import importlib
importlib.reload( a )  # commentrRrSs   r�test_commentzTest_reload.test_comment(sF��'��C���
�
�1�a����
)��D���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzreload( a )z&import importlib
importlib.reload( a )z
reload( a)z%import importlib
importlib.reload( a)z
reload(a )z%import importlib
importlib.reload(a )rRrSs   r�
test_spacezTest_reload.test_space2sb����9���
�
�1�a������8���
�
�1�a������8���
�
�1�a�����rc��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d	}|�|��dS)
Nzreload(a=1)zreload(f, g)z
reload(f, *h)zreload(f, *h, **i)zreload(f, **i)zreload(*h, **i)z
reload(*h)zreload(**i)zreload()r2r�s  r�test_unchangedzTest_reload.test_unchanged?s��������q���������q���������q����$�����q���� �����q����!�����q���������q���������q���������q�����rN)rLr=rMrr�r�r�r�r;rrr�r� sU�������E����
����������rr�c�$�eZdZdZd�Zd�Zd�ZdS)�Test_intern�internc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzx =   intern(  a  )z"import sys
x =   sys.intern(  a  )z%y = intern("b" # test
              )z4import sys
y = sys.intern("b" # test
              )zz = intern(a+b+c.d,   )z&import sys
z = sys.intern(a+b+c.d,   )rRrSs   r�test_prefix_preservationz$Test_intern.test_prefix_preservation^sf��%��5���
�
�1�a����
��
���
�
�1�a����)��9���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nz
x = intern(a)zimport sys
x = sys.intern(a)zz = intern(a+b+c.d,)z#import sys
z = sys.intern(a+b+c.d,)z"intern("y%s" % 5).replace("y", "")z1import sys
sys.intern("y%s" % 5).replace("y", "")rRrSs   rr�zTest_intern.testmsb����/���
�
�1�a����&��6���
�
�1�a����4��D���
�
�1�a�����rc���d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzintern(a=1)zintern(f, g)z
intern(*h)zintern(**i)zintern()r2r�s  rr�zTest_intern.test_unchanged|s{�������q���������q���������q���������q���������q�����rN)rLr=rMrr�r�r�r;rrr�r�[sF�������E�
�
�
��������rr�c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�Test_reduce�reducec�:�d}d}|�||��dS)Nzreduce(a, b, c)z,from functools import reduce
reduce(a, b, c)rRrSs   r�test_simple_callzTest_reduce.test_simple_call�s&����;���
�
�1�a�����rc�:�d}d}|�||��dS)Nzdef x(arg): reduce(sum, [])z8from functools import reduce
def x(arg): reduce(sum, [])rRrSs   r�
test_bug_7253zTest_reduce.test_bug_7253�s&��)��G���
�
�1�a�����rc�:�d}d}|�||��dS)Nzreduce(lambda x, y: x + y, seq)z<from functools import reduce
reduce(lambda x, y: x + y, seq)rRrSs   r�test_call_with_lambdaz!Test_reduce.test_call_with_lambda�s&��-��K���
�
�1�a�����rc���d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nz	reduce(a)zreduce(a, b=42)zreduce(a, b, c, d)zreduce(**c)zreduce()r2r�s  rr�zTest_reduce.test_unchanged�s{�������q���������q���� �����q���������q���������q�����rN)rLr=rMrr�r�r�r�r;rrr�r��sU�������E����
������
����rr�c�x�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZdS)�
Test_print�printc�:�d}d}|�||��dS)Nzprint 1,   1+1,   1+1+1zprint(1,   1+1,   1+1+1)rRrSs   rr�z#Test_print.test_prefix_preservation�s&��)��*���
�
�1�a�����rc�b�d}|�|��d}|�|��dS)N�print()�	print('')r2r�s  r�test_idempotencyzTest_print.test_idempotency�s6�������q���������q�����rc���tj|jj_d}|�|��d}|�|��d}|�|��dS)N�print(1, 1+1, 1+1+1)r�r�)r�!python_grammar_no_print_statementr�driver�grammarr/r�s  r�"test_idempotency_print_as_functionz-Test_print.test_idempotency_print_as_function�s]��'-�'O��
��$�&�����q���������q���������q�����rc�:�d}d}|�||��dS)Nzprint 1, 1+1, 1+1+1r�rRrSs   rr`zTest_print.test_1�s&��%��&���
�
�1�a�����rc�:�d}d}|�||��dS)Nz
print 1, 2zprint(1, 2)rRrSs   rrbzTest_print.test_2�s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nr�r�rRrSs   rrezTest_print.test_3�s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint whatever; printzprint(whatever); print()rRrSs   rrgzTest_print.test_4�s&��'��*���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint; print whatever;zprint(); print(whatever);rRrSs   rrizTest_print.test_5�s&��(��+���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint (a, b, c)zprint((a, b, c))rRrSs   r�
test_tuplezTest_print.test_tuple�s&��!��"���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint 1, 2, 3,zprint(1, 2, 3, end=' ')rRrSs   r�test_trailing_comma_1z Test_print.test_trailing_comma_1�s&�� ��)���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint 1, 2,zprint(1, 2, end=' ')rRrSs   r�test_trailing_comma_2z Test_print.test_trailing_comma_2�s&����&���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint 1,zprint(1, end=' ')rRrSs   r�test_trailing_comma_3z Test_print.test_trailing_comma_3�s&����#���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint >>sys.stderr, 1, 2, 3zprint(1, 2, 3, file=sys.stderr)rRrSs   r�!test_vargs_without_trailing_commaz,Test_print.test_vargs_without_trailing_comma�s&��-��1���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint >>sys.stderr, 1, 2,z%print(1, 2, end=' ', file=sys.stderr)rRrSs   r�test_with_trailing_commaz#Test_print.test_with_trailing_commas&��+��7���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint >>sys.stderr, 1+1zprint(1+1, file=sys.stderr)rRrSs   r�test_no_trailing_commaz!Test_print.test_no_trailing_commas&��)��-���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint >>  sys.stderrzprint(file=sys.stderr)rRrSs   r�test_spaces_before_filez"Test_print.test_spaces_before_file
s&��&��(���
�
�1�a�����rc�h�d}|�|��d}d}|�||��dS)Nz<from __future__ import print_function
print('Hai!', end=' ')zprint 'Hello, world!'zprint('Hello, world!')�r/r))rr�rTrUs    r�test_with_future_print_functionz*Test_print.test_with_future_print_functions?��
%�����q����#��$���
�
�1�a�����rN)rLr=rMrr�r�r�r`rbrergrir�r�r�r�r�r�r�r�r�r;rrr�r��s�������E����
���	�	�	����
���
���
������
������
���
������
���
���
���
����rr�c�N�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dS)
�	Test_exec�execc�:�d}d}|�||��dS)Nz  exec code in ns1,   ns2z  exec(code, ns1,   ns2)rRrSs   rr�z"Test_exec.test_prefix_preservations&��+��*���
�
�1�a�����rc�:�d}d}|�||��dS)Nz	exec code�
exec(code)rRrSs   rrVzTest_exec.test_basic!s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzexec code in ns�exec(code, ns)rRrSs   r�test_with_globalszTest_exec.test_with_globals&s&��!�� ���
�
�1�a�����rc�:�d}d}|�||��dS)Nzexec code in ns1, ns2�exec(code, ns1, ns2)rRrSs   r�test_with_globals_localsz"Test_exec.test_with_globals_locals+s&��'��&���
�
�1�a�����rc�:�d}d}|�||��dS)Nzexec (a.b()) in nszexec((a.b()), ns)rRrSs   rr�zTest_exec.test_complex_10�&��$��#���
�
�1�a�����rc�:�d}d}|�||��dS)Nzexec a.b() + c in nszexec(a.b() + c, ns)rRrSs   rr�zTest_exec.test_complex_25�&��&��%���
�
�1�a�����rc�4�d}|�|��dS)Nr�r2r�s  rr�zTest_exec.test_unchanged_1<��������q�����rc�4�d}|�|��dS)Nzexec (code)r2r�s  rr�zTest_exec.test_unchanged_2@s�������q�����rc�4�d}|�|��dS)Nr�r2r�s  rr�zTest_exec.test_unchanged_3D��� �����q�����rc�4�d}|�|��dS)Nrr2r�s  rr�zTest_exec.test_unchanged_4Hs��&�����q�����rN)rLr=rMrr�rVrrr�r�r�r�r�r�r;rrr�r�s��������E����
���
���
���
���
����������������rr�c�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�	Test_repr�reprc�:�d}d}|�||��dS)Nz
x =   `1 + 2`zx =   repr(1 + 2)rRrSs   rr�z"Test_repr.test_prefix_preservationO�&����#���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = `1 + 2`zx = repr(1 + 2)rRrSs   r�
test_simple_1zTest_repr.test_simple_1Ts&����!���
�
�1�a�����rc�:�d}d}|�||��dS)Nzy = `x`zy = repr(x)rRrSs   r�
test_simple_2zTest_repr.test_simple_2Ys&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzz = `y`.__repr__()zz = repr(y).__repr__()rRrSs   r�test_complexzTest_repr.test_complex^s&��$��(���
�
�1�a�����rc�:�d}d}|�||��dS)Nz
x = `1, 2, 3`zx = repr((1, 2, 3))rRrSs   rr�zTest_repr.test_tuplec�&����%���
�
�1�a�����rc�:�d}d}|�||��dS)Nz
x = `1 + `2``zx = repr(1 + repr(2))rRrSs   r�test_nestedzTest_repr.test_nestedhs&����'���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = `1, 2 + `3, 4``zx = repr((1, 2 + repr((3, 4))))rRrSs   r�test_nested_tupleszTest_repr.test_nested_tuplesms&��%��1���
�
�1�a�����rN)rLr=rMrr�rrrr�rrr;rrrrLs��������E����
���
���
���
���
���
����rrc�r�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZdS)�Test_except�exceptc�:�d}d}|�||��dS)Nzq
            try:
                pass
            except (RuntimeError, ImportError),    e:
                passzs
            try:
                pass
            except (RuntimeError, ImportError) as    e:
                passrRrSs   rr�z$Test_except.test_prefix_preservationu�,��
��

��
	
�
�
�1�a�����rc�:�d}d}|�||��dS)NzV
            try:
                pass
            except Foo, e:
                pass�X
            try:
                pass
            except Foo as e:
                passrRrSs   r�test_simplezTest_except.test_simple�r#rc�:�d}d}|�||��dS)NzU
            try:
                pass
            except Foo,e:
                passr%rRrSs   r�"test_simple_no_space_before_targetz.Test_except.test_simple_no_space_before_target�r#rc�:�d}d}|�||��dS)Nz�
            def foo():
                try:
                    pass
                except Exception, (f, e):
                    pass
                except ImportError, e:
                    passa
            def foo():
                try:
                    pass
                except Exception as xxx_todo_changeme:
                    (f, e) = xxx_todo_changeme.args
                    pass
                except ImportError as e:
                    passrRrSs   r�test_tuple_unpackzTest_except.test_tuple_unpack�s,��
��
��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nzn
            try:
                pass
            except (RuntimeError, ImportError), e:
                passzp
            try:
                pass
            except (RuntimeError, ImportError) as e:
                passrRrSs   r�test_multi_classzTest_except.test_multi_class�s,��
��
��
	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nza
            try:
                pass
            except Exception, [a, b]:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                [a, b] = xxx_todo_changeme.args
                passrRrSs   r�test_list_unpackzTest_except.test_list_unpack��,��
��
��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nz_
            try:
                pass
            except Exception, d[5]:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                d[5] = xxx_todo_changeme
                passrRrSs   r�test_weird_target_1zTest_except.test_weird_target_1�r/rc�:�d}d}|�||��dS)Nz`
            try:
                pass
            except Exception, a.foo:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                a.foo = xxx_todo_changeme
                passrRrSs   r�test_weird_target_2zTest_except.test_weird_target_2�r/rc�:�d}d}|�||��dS)Nzb
            try:
                pass
            except Exception, a().foo:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                a().foo = xxx_todo_changeme
                passrRrSs   r�test_weird_target_3zTest_except.test_weird_target_3�r/rc�:�d}d}|�||��dS)Nz�
            try:
                pass
            except Exception, a:
                pass
            except:
                passz�
            try:
                pass
            except Exception as a:
                pass
            except:
                passrRrSs   r�test_bare_exceptzTest_except.test_bare_except�s,��
��
��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nz�
            try:
                pass
            except Exception, a:
                pass
            except:
                pass
            else:
                pass
            finally:
                passz�
            try:
                pass
            except Exception as a:
                pass
            except:
                pass
            else:
                pass
            finally:
                passrRrSs   r�!test_bare_except_and_else_finallyz-Test_except.test_bare_except_and_else_finally
s,��

��

��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nz�
            try:
                pass
            except TypeError, b:
                pass
            except Exception, a:
                pass
            except:
                passz�
            try:
                pass
            except TypeError as b:
                pass
            except Exception as a:
                pass
            except:
                passrRrSs   r�+test_multi_fixed_excepts_before_bare_exceptz7Test_except.test_multi_fixed_excepts_before_bare_except's,��
��
��	
�
�
�1�a�����rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)	Nzd
            try: raise TypeError
            except TypeError, e:
                pass
            zf
            try: raise TypeError
            except TypeError as e:
                pass
            zd
            try:
                raise TypeError
            except TypeError, e: pass
            zf
            try:
                raise TypeError
            except TypeError as e: pass
            zT
            try: raise TypeError
            except TypeError, e: pass
            zV
            try: raise TypeError
            except TypeError as e: pass
            z�
            try: raise TypeError
            except TypeError, e: pass
            else: function()
            finally: done()
            z�
            try: raise TypeError
            except TypeError as e: pass
            else: function()
            finally: done()
            rRrSs   r�test_one_line_suitesz Test_except.test_one_line_suites=s���
��

��
	
�
�
�1�a����
��

��
	
�
�
�1�a����
��
��	
�
�
�1�a����
��
��	
�
�
�1�a�����rc�4�d}|�|��dS)NzO
            try:
                pass
            except:
                passr2r�s  rr�zTest_except.test_unchanged_1m�#��
��
	
���q�����rc�4�d}|�|��dS)NzY
            try:
                pass
            except Exception:
                passr2r�s  rr�zTest_except.test_unchanged_2ur?rc�4�d}|�|��dS)Nzg
            try:
                pass
            except (Exception, SystemExit):
                passr2r�s  rr�zTest_except.test_unchanged_3}r?rN)rLr=rMrr�r&r(r*r,r.r1r3r5r7r9r;r=r�r�r�r;rrr r rs
�������E�������������*���
�
�
�
�
�
�
�
�
�
�
�
����$���4���,,�,�,�`����������rr c�x�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZdS)�
Test_raise�raisec�:�d}d}|�||��dS)Nzraise Exception, 5�raise Exception(5)rRrSs   rrVzTest_raise.test_basic�s&��$��$���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzraise Exception,5rFzraise   Exception,    5zraise   Exception(5)rRrSs   rr�z#Test_raise.test_prefix_preservation�sD��#��$���
�
�1�a����)��&���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzraise Exception, 5 # foozraise Exception(5) # foozraise E, (5, 6) % (a, b) # foozraise E((5, 6) % (a, b)) # fooz:def foo():
                    raise Exception, 5, 6 # foozIdef foo():
                    raise Exception(5).with_traceback(6) # foorRrSs   r�test_with_commentszTest_raise.test_with_comments�sg��*��*���
�
�1�a����0��0���
�
�1�a����
3��
B���
�
�1�a�����rc�:�d}d}|�||��dS)Nzraise Exception(5), None, tbz%raise Exception(5).with_traceback(tb)rRrSs   r�test_None_valuezTest_raise.test_None_value�s&��.��7���
�
�1�a�����rc�:�d}d}|�||��dS)Nzraise Exception, (5, 6, 7)zraise Exception(5, 6, 7)rRrSs   r�test_tuple_valuezTest_raise.test_tuple_value�s&��,��*���
�
�1�a�����rc�:�d}d}|�||��dS)Nzraise E, (5, 6) % (a, b)zraise E((5, 6) % (a, b))rRrSs   r�test_tuple_detectionzTest_raise.test_tuple_detection�s&��*��*���
�
�1�a�����rc�:�d}d}|�||��dS)Nzraise (((E1, E2), E3), E4), V�raise E1(V)rRrSs   r�test_tuple_exc_1zTest_raise.test_tuple_exc_1�s&��/�����
�
�1�a�����rc�:�d}d}|�||��dS)Nzraise (E1, (E2, E3), E4), VrQrRrSs   r�test_tuple_exc_2zTest_raise.test_tuple_exc_2�s&��-�����
�
�1�a�����rc�6�d}|�|d��dS)Nzraise 'foo'�+Python 3 does not support string exceptions�r4r�s  r�test_string_exczTest_raise.test_string_exc�s$�������Q� M�N�N�N�N�Nrc�6�d}|�|d��dS)Nzraise "foo", 5rVrWr�s  r�test_string_exc_valzTest_raise.test_string_exc_val��$�� �����Q� M�N�N�N�N�Nrc�6�d}|�|d��dS)Nzraise "foo", 5, 6rVrWr�s  r�test_string_exc_val_tbz!Test_raise.test_string_exc_val_tb��$��#�����Q� M�N�N�N�N�Nrc�:�d}d}|�||��dS)Nz4def foo():
                    raise Exception, 5, 6�Cdef foo():
                    raise Exception(5).with_traceback(6)rRrSs   r�	test_tb_1zTest_raise.test_tb_1�s*��
-��
<���
�
�1�a�����rc�:�d}d}|�||��dS)Nzhdef foo():
                    a = 5
                    raise Exception, 5, 6
                    b = 6�wdef foo():
                    a = 5
                    raise Exception(5).with_traceback(6)
                    b = 6rRrSs   r�	test_tb_2zTest_raise.test_tb_2��,��
��
��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nz2def foo():
                    raise Exception,5,6r`rRrSs   r�	test_tb_3zTest_raise.test_tb_3�s*��
+��
<���
�
�1�a�����rc�:�d}d}|�||��dS)Nzfdef foo():
                    a = 5
                    raise Exception,5,6
                    b = 6rcrRrSs   r�	test_tb_4zTest_raise.test_tb_4�rerc�:�d}d}|�||��dS)Nz<def foo():
                    raise Exception, (5, 6, 7), 6zIdef foo():
                    raise Exception(5, 6, 7).with_traceback(6)rRrSs   r�	test_tb_5zTest_raise.test_tb_5�s+��
5��
B���
�
�1�a�����rc�:�d}d}|�||��dS)Nzpdef foo():
                    a = 5
                    raise Exception, (5, 6, 7), 6
                    b = 6z}def foo():
                    a = 5
                    raise Exception(5, 6, 7).with_traceback(6)
                    b = 6rRrSs   r�	test_tb_6zTest_raise.test_tb_6�rerN)rLr=rMrrVr�rIrKrMrOrRrTrXrZr]rardrgrirkrmr;rrrCrC�s!�������E����
���
�
�
����
���
���
���
���O�O�O�O�O�O�O�O�O����	�	�	����	�	�	����	�	�	�	�	rrCc�~�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�
Test_throw�throwc�:�d}d}|�||��dS)Nzg.throw(Exception, 5)�g.throw(Exception(5))rRrSs   rr`zTest_throw.test_1s&��'��'���
�
�1�a�����rc�:�d}d}|�||��dS)Nzg.throw(Exception,5)rrrRrSs   rrbzTest_throw.test_2s&��&��'���
�
�1�a�����rc�:�d}d}|�||��dS)Nzg.throw(Exception, (5, 6, 7))zg.throw(Exception(5, 6, 7))rRrSs   rrezTest_throw.test_3s&��/��-���
�
�1�a�����rc�:�d}d}|�||��dS)Nz5 + g.throw(Exception, 5)z5 + g.throw(Exception(5))rRrSs   rrgzTest_throw.test_4s&��+��+���
�
�1�a�����rc�6�d}|�|d��dS)Nzg.throw("foo")rVrWr�s  r�test_warn_1zTest_throw.test_warn_1r[rc�6�d}|�|d��dS)Nzg.throw("foo", 5)rVrWr�s  r�test_warn_2zTest_throw.test_warn_2!r^rc�6�d}|�|d��dS)Nzg.throw("foo", 5, 6)rVrWr�s  r�test_warn_3zTest_throw.test_warn_3%s$��&�����Q� M�N�N�N�N�Nrc�4�d}|�|��dS)Nzg.throw(Exception)r2r�s  r�test_untouched_1zTest_throw.test_untouched_1+���$�����q�����rc�4�d}|�|��dS)Nzg.throw(Exception(5, 6))r2r�s  r�test_untouched_2zTest_throw.test_untouched_2/s��*�����q�����rc�4�d}|�|��dS)Nz5 + g.throw(Exception(5, 6))r2r�s  r�test_untouched_3zTest_throw.test_untouched_33r�rc�:�d}d}|�||��dS)Nz7def foo():
                    g.throw(Exception, 5, 6)�Fdef foo():
                    g.throw(Exception(5).with_traceback(6))rRrSs   rrazTest_throw.test_tb_19s*��
0��
?���
�
�1�a�����rc�:�d}d}|�||��dS)Nzkdef foo():
                    a = 5
                    g.throw(Exception, 5, 6)
                    b = 6�zdef foo():
                    a = 5
                    g.throw(Exception(5).with_traceback(6))
                    b = 6rRrSs   rrdzTest_throw.test_tb_2@rerc�:�d}d}|�||��dS)Nz5def foo():
                    g.throw(Exception,5,6)r�rRrSs   rrgzTest_throw.test_tb_3Ks*��
.��
?���
�
�1�a�����rc�:�d}d}|�||��dS)Nzidef foo():
                    a = 5
                    g.throw(Exception,5,6)
                    b = 6r�rRrSs   rrizTest_throw.test_tb_4Rrerc�:�d}d}|�||��dS)Nz?def foo():
                    g.throw(Exception, (5, 6, 7), 6)zLdef foo():
                    g.throw(Exception(5, 6, 7).with_traceback(6))rRrSs   rrkzTest_throw.test_tb_5]s+��
8��
E���
�
�1�a�����rc�:�d}d}|�||��dS)Nzsdef foo():
                    a = 5
                    g.throw(Exception, (5, 6, 7), 6)
                    b = 6z�def foo():
                    a = 5
                    g.throw(Exception(5, 6, 7).with_traceback(6))
                    b = 6rRrSs   rrmzTest_throw.test_tb_6drerc�:�d}d}|�||��dS)Nz;def foo():
                    a + g.throw(Exception, 5, 6)zJdef foo():
                    a + g.throw(Exception(5).with_traceback(6))rRrSs   r�	test_tb_7zTest_throw.test_tb_7os+��
4��
C���
�
�1�a�����rc�:�d}d}|�||��dS)Nzodef foo():
                    a = 5
                    a + g.throw(Exception, 5, 6)
                    b = 6z~def foo():
                    a = 5
                    a + g.throw(Exception(5).with_traceback(6))
                    b = 6rRrSs   r�	test_tb_8zTest_throw.test_tb_8vrerN)rLr=rMrr`rbrergrwryr{r}r�r�rardrgrirkrmr�r�r;rrroros0�������E����
���
���
���O�O�O�O�O�O�O�O�O�������������	�	�	����	�	�	����	�	�	����	�	�	�	�	rroc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�	Test_long�longc�:�d}d}|�||��dS)Nzx = long(x)z
x = int(x)rRrSs   rr`zTest_long.test_1�s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzy = isinstance(x, long)zy = isinstance(x, int)rRrSs   rrbzTest_long.test_2��&��)��(���
�
�1�a�����rc�:�d}d}|�||��dS)Nzz = type(x) in (int, long)zz = type(x) in (int, int)rRrSs   rrezTest_long.test_3�s&��,��+���
�
�1�a�����rc�H�d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzlong = Truez
s.long = Truezdef long(): passzclass long(): passzdef f(long): passzdef f(g, long): passzdef f(x, long=True): passr2r�s  rr�zTest_long.test_unchanged�s��������q���������q����"�����q����$�����q����#�����q����&�����q����+�����q�����rc�:�d}d}|�||��dS)Nzx =   long(  x  )zx =   int(  x  )rRrSs   rr�z"Test_long.test_prefix_preservation��&��#��"���
�
�1�a�����rN)	rLr=rMrr`rbrer�r�r;rrr�r��sd�������E����
���
���
���,����rr�c��eZdZdZd�Zd�ZdS)�
Test_execfile�execfilec�>�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��d}d}|�||��dS)
Nzexecfile("fn")z4exec(compile(open("fn", "rb").read(), "fn", 'exec'))zexecfile("fn", glob)z:exec(compile(open("fn", "rb").read(), "fn", 'exec'), glob)zexecfile("fn", glob, loc)z?exec(compile(open("fn", "rb").read(), "fn", 'exec'), glob, loc)zexecfile("fn", globals=glob)zBexec(compile(open("fn", "rb").read(), "fn", 'exec'), globals=glob)zexecfile("fn", locals=loc)z@exec(compile(open("fn", "rb").read(), "fn", 'exec'), locals=loc)z(execfile("fn", globals=glob, locals=loc)zNexec(compile(open("fn", "rb").read(), "fn", 'exec'), globals=glob, locals=loc)rRrSs   r�test_conversionzTest_execfile.test_conversion�s��� ��F���
�
�1�a����&��L���
�
�1�a����+��Q���
�
�1�a����.��T���
�
�1�a����,��R���
�
�1�a����:��`���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzexecfile( "fn" )z6exec(compile(open( "fn", "rb" ).read(), "fn", 'exec'))zexecfile("fn",  globals = glob)zEexec(compile(open("fn", "rb").read(), "fn", 'exec'),  globals = glob)rRrSs   r�test_spacingzTest_execfile.test_spacing�sD��"��H���
�
�1�a����1��W���
�
�1�a�����rN)rLr=rMrr�r�r;rrr�r��s7�������E����2����rr�c�$�eZdZdZd�Zd�Zd�ZdS)�Test_isinstance�
isinstancec���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)	Nzisinstance(x, (int, int, int))zisinstance(x, int)z,isinstance(x, (int, float, int, int, float))zisinstance(x, (int, float))z1isinstance(x, (int, float, int, int, float, str))z isinstance(x, (int, float, str))z4isinstance(foo() + bar(), (x(), y(), x(), int, int))z/isinstance(foo() + bar(), (x(), y(), x(), int))rRrSs   r�test_remove_multiple_itemsz*Test_isinstance.test_remove_multiple_items�s���0��$���
�
�1�a����>��-���
�
�1�a����C��2���
�
�1�a����F��A���
�
�1�a�����rc�:�d}d}|�||��dS)Nz4if    isinstance(  foo(), (  bar, bar, baz )) : passz/if    isinstance(  foo(), (  bar, baz )) : passrRrSs   rr�z(Test_isinstance.test_prefix_preservation�s&��F��A���
�
�1�a�����rc�0�|�d��dS)Nzisinstance(x, (str, int))r2�rs rr�zTest_isinstance.test_unchanged�s�����2�3�3�3�3�3rN)rLr=rMrr�r�r�r;rrr�r��sF�������E����"���
4�4�4�4�4rr�c���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%S)&�	Test_dict�dictc�>�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��d}d}|�||��dS)Nzif   d. keys  (  )  : passz if   list(d. keys  (  ))  : passzif   d. items  (  )  : passz!if   list(d. items  (  ))  : passzif   d. iterkeys  ( )  : passzif   iter(d. keys  ( ))  : passz"[i for i in    d.  iterkeys(  )  ]z[i for i in    d.  keys(  )  ]zif   d. viewkeys  ( )  : passzif   d. keys  ( )  : passz"[i for i in    d.  viewkeys(  )  ]rRrSs   rr�z"Test_dict.test_prefix_preservation�s���(��.���
�
�1�a����)��/���
�
�1�a����+��-���
�
�1�a����0��,���
�
�1�a����+��'���
�
�1�a����0��,���
�
�1�a�����rc�>�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d}|�||��dS)
Nzd.keys() # foozlist(d.keys()) # foozd.items()  # foozlist(d.items())  # foozd.iterkeys()  # fooziter(d.keys())  # fooz/[i for i in d.iterkeys() # foo
               ]z+[i for i in d.keys() # foo
               ]zd.viewitems()  # foorRrSs   r�test_trailing_commentzTest_dict.test_trailing_comment
s�����"���
�
�1�a������$���
�
�1�a����!��#���
�
�1�a����
��
���
�
�1�a����
��
���
�
�1�a����"�����
�
�1�a�����rc��tjD]P}d|z}|�|��d|z}|�|��d|z}|�|���QdS)Nzs = %s(d.keys())zs = %s(d.values())zs = %s(d.items())�r�consuming_callsr/)r�wrapperr�s   rr�zTest_dict.test_unchanged*su��!�1�	�	�G�"�W�,�A��N�N�1����$�w�.�A��N�N�1����#�g�-�A��N�N�1�����	�	rc�n�d}d}|�||��d}d}|�||��dS)N�d.keys()�list(d.keys())za[0].foo().keys()zlist(a[0].foo().keys())rRrSs   r�test_01zTest_dict.test_015sD�������
�
�1�a������%���
�
�1�a�����rc�:�d}d}|�||��dS)N�	d.items()zlist(d.items())rRrSs   r�test_02zTest_dict.test_02>s&�������
�
�1�a�����rc�:�d}d}|�||��dS)N�
d.values()zlist(d.values())rRrSs   r�test_03zTest_dict.test_03Cs&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzd.iterkeys()�iter(d.keys())rRrSs   r�test_04zTest_dict.test_04Hs&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nz
d.iteritems()ziter(d.items())rRrSs   r�test_05zTest_dict.test_05Ms&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzd.itervalues()ziter(d.values())rRrSs   r�test_06zTest_dict.test_06Rs&�������
�
�1�a�����rc�4�d}|�|��dS)Nr�r2r�s  r�test_07zTest_dict.test_07Wr	rc�4�d}|�|��dS)N�sorted(d.keys())r2r�s  r�test_08zTest_dict.test_08[s�������q�����rc�:�d}d}|�||��dS)Nr�ziter(list(d.keys()))rRrSs   r�test_09zTest_dict.test_09_s&����"���
�
�1�a�����rc�:�d}d}|�||��dS)Nz
foo(d.keys())zfoo(list(d.keys()))rRrSs   rrvzTest_dict.test_10ds&����!���
�
�1�a�����rc�:�d}d}|�||��dS)N�for i in d.keys(): print iz for i in list(d.keys()): print irRrSs   rrxzTest_dict.test_11is&��(��.���
�
�1�a�����rc�:�d}d}|�||��dS)Nzfor i in d.iterkeys(): print ir�rRrSs   r�test_12zTest_dict.test_12ns&��,��(���
�
�1�a�����rc�:�d}d}|�||��dS)N�[i for i in d.keys()]z for i in list(d.keys())]rRrSs   r�test_13zTest_dict.test_13s�&��#��)���
�
�1�a�����rc�:�d}d}|�||��dS)Nz[i for i in d.iterkeys()]r�rRrSs   r�test_14zTest_dict.test_14xrjrc�:�d}d}|�||��dS)N�(i for i in d.keys())z(i for i in list(d.keys()))rRrSs   r�test_15zTest_dict.test_15}r�rc�:�d}d}|�||��dS)Nz(i for i in d.iterkeys())r�rRrSs   r�test_16zTest_dict.test_16�rjrc�:�d}d}|�||��dS)Nziter(d.iterkeys())r�rRrSs   r�test_17zTest_dict.test_17��&�� �����
�
�1�a�����rc�:�d}d}|�||��dS)Nzlist(d.iterkeys())r�rRrSs   r�test_18zTest_dict.test_18�r�rc�:�d}d}|�||��dS)Nzsorted(d.iterkeys())r�rRrSs   r�test_19zTest_dict.test_19��&��"�����
�
�1�a�����rc�:�d}d}|�||��dS)Nzfoo(d.iterkeys())zfoo(iter(d.keys()))rRrSs   r�test_20zTest_dict.test_20�s&����!���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint h.iterkeys().next()zprint iter(h.keys()).next()rRrSs   r�test_21zTest_dict.test_21�s&��'��)���
�
�1�a�����rc�:�d}d}|�||��dS)Nzprint h.keys()[0]zprint list(h.keys())[0]rRrSs   r�test_22zTest_dict.test_22�rrc�:�d}d}|�||��dS)Nzprint list(h.iterkeys().next())z!print list(iter(h.keys()).next())rRrSs   r�test_23zTest_dict.test_23�s&��-��/���
�
�1�a�����rc�:�d}d}|�||��dS)Nzfor x in h.keys()[0]: print xz#for x in list(h.keys())[0]: print xrRrSs   r�test_24zTest_dict.test_24�s&��+��1���
�
�1�a�����rc�:�d}d}|�||��dS)Nzd.viewkeys()r�rRrSs   r�test_25zTest_dict.test_25�s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nz
d.viewitems()r�rRrSs   r�test_26zTest_dict.test_26�s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzd.viewvalues()r�rRrSs   r�test_27zTest_dict.test_27�s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nz[i for i in d.viewkeys()]r�rRrSs   r�test_28zTest_dict.test_28�rjrc�:�d}d}|�||��dS)Nz(i for i in d.viewkeys())r�rRrSs   r�test_29zTest_dict.test_29�rjrc�:�d}d}|�||��dS)Nziter(d.viewkeys())r�rRrSs   r�test_30zTest_dict.test_30�r�rc�:�d}d}|�||��dS)Nzlist(d.viewkeys())r�rRrSs   r�test_31zTest_dict.test_31�r�rc�:�d}d}|�||��dS)Nzsorted(d.viewkeys())r�rRrSs   r�test_32zTest_dict.test_32�r�rN)'rLr=rMrr�r�r�r�r�r�r�r�r�r�r�r�rvrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;rrr�r��s&�������E����2���:	�	�	�������
���
���
���
���
���������
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
���
����rr�c�H�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�Test_xrange�xrangec��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzx =    xrange(  10  )zx =    range(  10  )zx = xrange(  1  ,  10   )zx = range(  1  ,  10   )zx = xrange(  0  ,  10 ,  2 )zx = range(  0  ,  10 ,  2 )rRrSs   rr�z$Test_xrange.test_prefix_preservation�sb��'��&���
�
�1�a����+��*���
�
�1�a����.��-���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = xrange(10)z
x = range(10)rRrSs   r�test_single_argzTest_xrange.test_single_arg��&�� �����
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = xrange(1, 10)zx = range(1, 10)rRrSs   r�
test_two_argszTest_xrange.test_two_args�r�rc�:�d}d}|�||��dS)Nzx = xrange(0, 10, 2)zx = range(0, 10, 2)rRrSs   r�test_three_argszTest_xrange.test_three_args�rrc�
�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��dS)Nzx = range(10, 3, 9)zx = list(range(10, 3, 9))zx = foo(range(10, 3, 9))zx = foo(list(range(10, 3, 9)))zx = range(10, 3, 9) + [4]zx = list(range(10, 3, 9)) + [4]zx = range(10)[::-1]zx = list(range(10))[::-1]zx = range(10)  [3]zx = list(range(10))  [3]rRrSs   r�test_wrap_in_listzTest_xrange.test_wrap_in_list�s���%��+���
�
�1�a����*��0���
�
�1�a����+��1���
�
�1�a����%��+���
�
�1�a����$��*���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzfor i in xrange(10):
    j=izfor i in range(10):
    j=iz[i for i in xrange(10)]�[i for i in range(10)]rRrSs   r�test_xrange_in_forzTest_xrange.test_xrange_in_forsD��/��.���
�
�1�a����)��(���
�
�1�a�����rc�Z�|�d��|�d��dS)Nzfor i in range(10): passr
r2r�s r�test_range_in_forzTest_xrange.test_range_in_fors.�����1�2�2�2����/�0�0�0�0�0rc�0�|�d��dS)Nzx in range(10, 3, 9)r2r�s r�test_in_contains_testz!Test_xrange.test_in_contains_tests�����-�.�.�.�.�.rc�T�tjD]}|�d|z���dS)Nza = %s(range(10))r�)r�calls  r�test_in_consuming_contextz%Test_xrange.test_in_consuming_contexts9���.�	7�	7�D��N�N�.��5�6�6�6�6�	7�	7rN)
rLr=rMrr�rrrrrr
rrr;rrr�r��s��������E�������
���
���
���*���1�1�1�/�/�/�7�7�7�7�7rr�c�$��eZdZ�fd�Zd�Z�xZS)�Test_xrange_with_reducec�\��tt|���ddg��dS)Nr�r�)�superrr)rr<s �rrzTest_xrange_with_reduce.setUp!s-���
�%�t�,�,�2�2�H�h�3G�H�H�H�H�Hrc�:�d}d}|�||��dS)Nzreduce(x, xrange(5))z0from functools import reduce
reduce(x, range(5))rRrSs   r�test_double_transformz-Test_xrange_with_reduce.test_double_transform$s(��&��
���
�
�1�a�����r)rLr=rMrr�
__classcell__�r<s@rrrsL�������I�I�I�I�I�������rrc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�Test_raw_input�	raw_inputc�n�d}d}|�||��d}d}|�||��dS)Nzx =    raw_input(   )zx =    input(   )zx = raw_input(   ''   )�x = input(   ''   )rRrSs   rr�z'Test_raw_input.test_prefix_preservation-sD��'��#���
�
�1�a����)��%���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = raw_input()�x = input()rRrSs   rr`zTest_raw_input.test_16s&��!�����
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = raw_input('')�
x = input('')rRrSs   rrbzTest_raw_input.test_2;s&��#�����
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = raw_input('prompt')�x = input('prompt')rRrSs   rrezTest_raw_input.test_3@s&��)��%���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = raw_input(foo(a) + 6)zx = input(foo(a) + 6)rRrSs   rrgzTest_raw_input.test_4Erprc�:�d}d}|�||��dS)Nzx = raw_input(invite).split()zx = input(invite).split()rRrSs   rrizTest_raw_input.test_5Jrcrc�:�d}d}|�||��dS)Nz x = raw_input(invite) . split ()zx = input(invite) . split ()rRrSs   rrlzTest_raw_input.test_6Orrc�:�d}d}|�||��dS)Nzx = int(raw_input())zx = int(input())rRrSs   rrrzTest_raw_input.test_8Tr�rN)rLr=rMrr�r`rbrergrirlrrr;rrrr*s��������E�������
���
���
���
���
���
����rrc�&�eZdZdZgd�Zd�Zd�ZdS)�Test_funcattrs�	funcattrs)�closure�doc�name�defaults�code�globalsr�c��|jD]B}d|z}d|z}|�||��d|z}d|z}|�||���CdS)Nz	a.func_%s�a.__%s__zself.foo.func_%s.foo_bar�self.foo.__%s__.foo_bar��attrsr)�r�attrrTrUs    rr�zTest_funcattrs.test^sp���J�	�	�D��d�"�A��T�!�A��J�J�q�!����*�T�1�A�)�D�0�A��J�J�q�!�����	�	rc��|jD]P}d|z}|�|��d|z}|�|��d|z}|�|���QdS)Nzfoo(func_%s + 5)�
f(foo.__%s__)�f(foo.__%s__.foo)�r7r/�rr9r�s   rr�zTest_funcattrs.test_unchangedhst���J�	�	�D�"�T�)�A��N�N�1�����$�&�A��N�N�1����#�d�*�A��N�N�1�����	�	rN�rLr=rMrr7r�r�r;rrr+r+YsB�������E�M�M�M�E����	�	�	�	�	rr+c�$�eZdZdZd�Zd�Zd�ZdS)�Test_xreadlines�
xreadlinesc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzfor x in f.xreadlines(): passzfor x in f: passz!for x in foo().xreadlines(): passzfor x in foo(): passz'for x in (5 + foo()).xreadlines(): passzfor x in (5 + foo()): passrRrSs   rr�zTest_xreadlines.test_callvsb��+�����
�
�1�a����/��"���
�
�1�a����5��(���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzfoo(f.xreadlines + 5)zfoo(f.__iter__ + 5)zfoo(f().xreadlines + 5)zfoo(f().__iter__ + 5)zfoo((5 + f()).xreadlines + 5)zfoo((5 + f()).__iter__ + 5)rRrSs   r�
test_attr_refzTest_xreadlines.test_attr_ref�sb��#��!���
�
�1�a����%��#���
�
�1�a����+��)���
�
�1�a�����rc��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzfor x in f.xreadlines(5): passz for x in f.xreadlines(k=5): passz$for x in f.xreadlines(*k, **v): passzfoo(xreadlines)r2r�s  rr�zTest_xreadlines.test_unchanged�sd��,�����q����.�����q����2�����q���������q�����rN)rLr=rMrr�rEr�r;rrrArAssF�������E�����������rrAc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�ImportsFixerTestsc���|j���D]E\}}d|z}d|z}|�||��d|z}d|z}|�||���FdS)N�	import %szimport foo, %s, bar��modules�itemsr)�r�old�newrTrUs     r�test_import_modulez$ImportsFixerTests.test_import_module�s�����*�*�,�,�	�	�H�C���c�!�A��c�!�A��J�J�q�!����%��+�A�%��+�A��J�J�q�!�����	�	rc��|j���D]e\}}d|z}d|z}|�||��d|z}d|z}|�||��d|z}d|z}|�||���fdS)Nzfrom %s import foozfrom %s import foo, barzfrom %s import (yes, no)rKrNs     r�test_import_fromz"ImportsFixerTests.test_import_from�s�����*�*�,�,�	�	�H�C��$�s�*�A�$�s�*�A��J�J�q�!����)�C�/�A�)�C�/�A��J�J�q�!����*�S�0�A�*�S�0�A��J�J�q�!�����	�	rc���|j���D]E\}}d|z}d|z}|�||��d|z}d|z}|�||���FdS)Nzimport %s as foo_barrKrNs     r�test_import_module_asz'ImportsFixerTests.test_import_module_as�s�����*�*�,�,�	�	�H�C��&��,�A�&��,�A��J�J�q�!����&��,�A�&��,�A��J�J�q�!�����	�	rc��|j���D]%\}}d|z}d|z}|�||���&dS)Nzfrom %s import foo as barrKrNs     r�test_import_from_asz%ImportsFixerTests.test_import_from_as�sX����*�*�,�,�	�	�H�C��+�c�1�A�+�c�1�A��J�J�q�!�����	�	rc��|j���D]%\}}d|z}d|z}|�||���&dS)N�from %s import *rKrNs     r�	test_starzImportsFixerTests.test_star�sX����*�*�,�,�	�	�H�C��"�S�(�A�"�S�(�A��J�J�q�!�����	�	rc���|j���D]�\}}d|�d|�d�}d|�d|�d�}|�||��d|�d|�d�}d|�d|�d�}|�||��d|�d�}|�|��d|�d	|�d
|�d�}d|�d	|�d
|�d�}|�||��d|�d|�d	�}d|�d|�d	�}|�||����dS)
N�
                import �
                foo(z.bar)
                �
                from z import x
                z = 23
                z.
                def f():
                    z.method()
                z
                z.bar(z.foo)
                z
                x.)rLrMr)r/)rrOrPrTrUr�s      r�test_import_module_usagez*ImportsFixerTests.test_import_module_usage�s����*�*�,�,�.	�.	�H�C����s�s�C�C�C�!�A�A��s�s�C�C�C�!�A�
�J�J�q�!�����
�s�s�C�C�C�!�A�A��s�s�C�C�C�!�A�
�J�J�q�!�����
�s�s��A�
�N�N�1������s�s�C�C�C����&�A�A��s�s�C�C�C����&�A�
�J�J�q�!�����
�s�s�C�C�C�!�A�A��s�s�C�C�C�!�A�
�J�J�q�!�����].	�.	rN)	rLr=rMrQrSrUrWrZr_r;rrrHrH�sn���������������������/�/�/�/�/rrHc�*�eZdZdZddlmZd�Zd�ZdS)�Test_imports�imports���MAPPINGc�:�d}d}|�||��dS)Nzimport urlparse, cStringIOzimport urllib.parse, iorRrSs   r�test_multiple_importsz"Test_imports.test_multiple_importss&��,��)���
�
�1�a�����rc�:�d}d}|�||��dS)Nzv
            import copy_reg as bar, HTMLParser as foo, urlparse
            s = urlparse.spam(bar.foo())
            z~
            import copyreg as bar, html.parser as foo, urllib.parse
            s = urllib.parse.spam(bar.foo())
            rRrSs   r�test_multiple_imports_asz%Test_imports.test_multiple_imports_as	�,��
��
��	
�
�
�1�a�����rN)	rLr=rMr�fixes.fix_importsrerLrgrir;rrrarasI�������E�6�6�6�6�6�6����
	�	�	�	�	rrac��eZdZdZddlmZdS)�
Test_imports2�imports2rcrdN)rLr=rMr�fixes.fix_imports2rerLr;rrrmrms'�������E�7�7�7�7�7�7�7�7rrmc�$��eZdZ�fd�Zd�Z�xZS)�Test_imports_fixer_orderc����tt|���ddg��ddlm}|���|_ddlm}dD]}|||j|<�dS)Nrbrnrcrd)�dbhash�dumbdbm�dbm�gdbm)rrqrrore�copyrLrk)r�mapping2�mapping1�keyr<s    �rrzTest_imports_fixer_order.setUps����
�&��-�-�3�3�Y�
�4K�L�L�L�<�<�<�<�<�<��}�}�����;�;�;�;�;�;�7�	.�	.�C� (��
�D�L����	.�	.rc�H�dD]}||_|�d���dS)N)rbrn�import)rrK)r�fixs  r�$test_after_local_imports_refactoringz=Test_imports_fixer_order.test_after_local_imports_refactoring$s9��*�	-�	-�C��D�J��"�"�8�,�,�,�,�	-�	-r)rLr=rMrr~rrs@rrqrqsG�������.�.�.�.�.�-�-�-�-�-�-�-rrqc�N�eZdZdZddlmZd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZdS)
�Test_urllib�urllibrcrdc	���|j���D]S\}}d|z}dd�tt	d��|����z}|�||���TdS)NrJr9r)rLrMr-�maprr))rrO�changesrTrUs     rrQzTest_urllib.test_import_module.st�� �L�.�.�0�0�	�	�L�C���c�!�A��d�i�i��J�q�M�M�7�(C�(C�D�D�D�A��J�J�q�!�����	�	rc��|j���D�]3\}}g}|D]�\}}|D]W}|�|��d|�d|��}d|�d|��}|�||��d|z}	|�|	���Xd|�dd�|����}d|�dd�|����}|�||��dd�|��z}	|�|	����d|�dd�|����}d�d�|D����}|�||����5dS)N�from � import �from foo import %sr9�
c�J�g|] \}}d|�dd�|������!S)r�r�r9)r-)r>rP�memberss   rr@z0Test_urllib.test_import_from.<locals>.<listcomp>JsF��;�;�;� .��g�g�36�#�#�t�y�y��7I�7I�7I�J�;�;�;r)rLrM�appendr)r/r-)
rrOr��all_membersrPr��memberrTrUr�s
          rrSzTest_urllib.test_import_from4s��� �L�.�.�0�0�	�	�L�C���K� '�
"�
"���W�%�&�&�F��&�&�v�.�.�.�.�/2�s�s�F�F�;�A�A�/2�s�s�F�F�;�A��J�J�q�!�$�$�$�,�v�5�A��N�N�1�%�%�%�%�&�,/�3�3��	�	�'�0B�0B�0B�C���+.�3�3��	�	�'�0B�0B�0B�C���
�
�1�a� � � �(�4�9�9�W�+=�+=�=�����q�!�!�!�!�
"�$(+�s�s�D�I�I�k�,B�,B�,B�C�A��	�	�;�;�29�;�;�;�<�<�A��J�J�q�!�����/	�	rc�P�|jD]}d|z}|�|d���dS)Nzimport %s as fooz#This module is now multiple modules�rLr4�rrOr�s   rrUz!Test_urllib.test_import_module_asNsE���<�	K�	K�C�"�S�(�A�� � ��$I�J�J�J�J�	K�	Krc	��|j���D]f\}}|D]^\}}|D]V}d|�d|�d�}d|�d|�d�}|�||��d|�d|�d|��}d|�d|�d|��}|�||���W�_�gdS)Nr�r�� as foo_barz
 as blah, rK)rrOr�rPr�r�rTrUs        rrWzTest_urllib.test_import_from_asSs��� �L�.�.�0�0�	%�	%�L�C�� '�
%�
%���W�%�%�%�F�F�:=�#�#�v�v�v�F�A�A�:=�#�#�v�v�v�F�A��J�J�q�!�$�$�$�$�;>�3�3������O�A�A�;>�3�3������O�A��J�J�q�!�$�$�$�$�
%�
%�	%�	%rc�P�|jD]}d|z}|�|d���dS)NrYzCannot handle star importsr�r�s   rrZzTest_urllib.test_star^sE���<�	B�	B�C�"�S�(�A�� � ��$@�A�A�A�A�	B�	Brc�n�d}d}|�||��d}d}|�||��dS)Nz6
def foo():
    from urllib import urlencode, urlopen
zZ
def foo():
    from urllib.parse import urlencode
    from urllib.request import urlopen
zB
def foo():
    other()
    from urllib import urlencode, urlopen
zf
def foo():
    other()
    from urllib.parse import urlencode
    from urllib.request import urlopen
rRrSs   r�
test_indentedzTest_urllib.test_indentedcsP��
��
��
	
�
�
�1�a����
��

��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nzfrom urllib import getproxiesz%from urllib.request import getproxiesrRrSs   r�test_single_importzTest_urllib.test_single_import|s&��+��3���
�
�1�a�����rc��|j���D]�\}}|D]�\}}|D]�}d�d�|j|D����}d|�d|�d|�d�}d|�d|�d|�d�}|�||��d|�d|�d|�d|�d|�d�}d|�d|�d|�d|�d|�d�}|�||��������dS)	Nr9c��g|]\}}|��Sr;r;)r>rJ�memss   rr@z8Test_urllib.test_import_module_usage.<locals>.<listcomp>�s.��,B�,B�,B�)�1�d�A�,B�,B�,Brz 
                        import z
                        foo(�.z)
                        z
                        �()rLrMr-r))	rrOr�rPr�r��
new_importrTrUs	         rr_z$Test_urllib.test_import_module_usage�sW�� �L�.�.�0�0�	%�	%�L�C�� '�
%�
%���W�%�%�%�F�!%���,B�,B�/3�|�C�/@�,B�,B�,B�"C�"C�J�J�
 #�s�s�C�C�C����1�A�A� *�z�z�3�3�3����8�A��J�J�q�!�$�$�$�$� #�s�s�C�C�C�������f�f�f�>�A�A� *�z�z�3�3�3�������V�V�V�E�A��J�J�q�!�$�$�$�$�)%�
%�	%�	%rN)rLr=rMr�fixes.fix_urllibrerLrQrSrUrWrZr�r�r_r;rrr�r�*s��������E�5�5�5�5�5�5�������4K�K�K�
	%�	%�	%�B�B�B�
���2���%�%�%�%�%rr�c�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�
Test_input�inputc�n�d}d}|�||��d}d}|�||��dS)Nzx =   input(   )zx =   eval(input(   ))rzx = eval(input(   ''   ))rRrSs   rr�z#Test_input.test_prefix_preservation�sD��"��(���
�
�1�a����%��+���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = input()  #  foozx = eval(input())  #  foorRrSs   rr�z Test_input.test_trailing_comment��&��%��+���
�
�1�a�����rc��d}|�|��d}|�|��d}|�|��dS)N�x = eval(input())�x = eval(input(''))�x = eval(input(foo(5) + 9))r2r�s  rr�zTest_input.test_idempotency�sM��#�����q����%�����q����-�����q�����rc�:�d}d}|�||��dS)Nr!r�rRrSs   rr`zTest_input.test_1�s&����#���
�
�1�a�����rc�:�d}d}|�||��dS)Nr#r�rRrSs   rrbzTest_input.test_2�rrc�:�d}d}|�||��dS)Nr%zx = eval(input('prompt'))rRrSs   rrezTest_input.test_3�r�rc�:�d}d}|�||��dS)Nzx = input(foo(5) + 9)r�rRrSs   rrgzTest_input.test_4�s&��'��-���
�
�1�a�����rN)rLr=rMrr�r�r�r`rbrergr;rrr�r��s��������E�������
������
���
���
����rr�c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�Test_tuple_params�tuple_paramsc�4�d}|�|��dS)Nzdef foo(): passr2r�s  rr�z"Test_tuple_params.test_unchanged_1�r�rc�4�d}|�|��dS)Nzdef foo(a, b, c): passr2r�s  rr�z"Test_tuple_params.test_unchanged_2�s��(�����q�����rc�4�d}|�|��dS)Nzdef foo(a=3, b=4, c=5): passr2r�s  rr�z"Test_tuple_params.test_unchanged_3�r�rc�:�d}d}|�||��dS)Nz8
            def foo(((a, b), c)):
                x = 5zn
            def foo(xxx_todo_changeme):
                ((a, b), c) = xxx_todo_changeme
                x = 5rRrSs   rr`zTest_tuple_params.test_1��,��
��
��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nz;
            def foo(((a, b), c), d):
                x = 5zq
            def foo(xxx_todo_changeme, d):
                ((a, b), c) = xxx_todo_changeme
                x = 5rRrSs   rrbzTest_tuple_params.test_2�r�rc�:�d}d}|�||��dS)Nz@
            def foo(((a, b), c), d) -> e:
                x = 5zv
            def foo(xxx_todo_changeme, d) -> e:
                ((a, b), c) = xxx_todo_changeme
                x = 5rRrSs   rrezTest_tuple_params.test_3�r�rc�:�d}d}|�||��dS)Nz/
            def foo(((a, b), c)): x = 5; y = 7zV
            def foo(xxx_todo_changeme): ((a, b), c) = xxx_todo_changeme; x = 5; y = 7rRrSs   r�test_semicolonz Test_tuple_params.test_semicolon�s+��
2��
Y���
�
�1�a�����rc�:�d}d}|�||��dS)NzE
            def foo(((a, b), c), d, e=5) -> z:
                x = 5z{
            def foo(xxx_todo_changeme, d, e=5) -> z:
                ((a, b), c) = xxx_todo_changeme
                x = 5rRrSs   r�
test_keywordszTest_tuple_params.test_keywordsr�rc�:�d}d}|�||��dS)NzR
            def foo(((a, b), c), d, *vargs, **kwargs) -> z:
                x = 5z�
            def foo(xxx_todo_changeme, d, *vargs, **kwargs) -> z:
                ((a, b), c) = xxx_todo_changeme
                x = 5rRrSs   r�test_varargszTest_tuple_params.test_varargsr�rc�:�d}d}|�||��dS)NzH
            def foo(((a, b), c), (d, e, f)) -> z:
                x = 5z�
            def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z:
                ((a, b), c) = xxx_todo_changeme
                (d, e, f) = xxx_todo_changeme1
                x = 5rRrSs   r�test_multi_1zTest_tuple_params.test_multi_1�,��
��
��
	
�
�
�1�a�����rc�:�d}d}|�||��dS)NzQ
            def foo(x, ((a, b), c), d, (e, f, g), y) -> z:
                x = 5z�
            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 = 5rRrSs   r�test_multi_2zTest_tuple_params.test_multi_2%r�rc�:�d}d}|�||��dS)Nzj
            def foo(((a, b), c), (d, e, f)) -> z:
                "foo foo foo foo"
                x = 5z�
            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 = 5rRrSs   r�test_docstringz Test_tuple_params.test_docstring1s,��
��

��	
�
�
�1�a�����rc�4�d}|�|��dS)N�lambda x: x + 5r2r�s  r�test_lambda_no_changez'Test_tuple_params.test_lambda_no_change?r�rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzlambda (x): x + 5r�zlambda(x): x + 5zlambda ((((x)))): x + 5zlambda((((x)))): x + 5rRrSs   r�test_lambda_parens_single_argz/Test_tuple_params.test_lambda_parens_single_argCs���#��!���
�
�1�a����"��!���
�
�1�a����)��!���
�
�1�a����(��!���
�
�1�a�����rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzlambda (x, y): x + f(y)zlambda x_y: x_y[0] + f(x_y[1])zlambda(x, y): x + f(y)zlambda (((x, y))): x + f(y)zlambda(((x, y))): x + f(y)rRrSs   r�test_lambda_simplez$Test_tuple_params.test_lambda_simpleTs���)��0���
�
�1�a����(��0���
�
�1�a����-��0���
�
�1�a����,��0���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzlambda (x,): x + f(x)zlambda x1: x1[0] + f(x1[0])zlambda (((x,))): x + f(x)rRrSs   r�test_lambda_one_tuplez'Test_tuple_params.test_lambda_one_tupleesD��'��-���
�
�1�a����+��-���
�
�1�a�����rc�:�d}d}|�||��dS)Nzlambda (x, y): x + x + f(x) + xz0lambda x_y: x_y[0] + x_y[0] + f(x_y[0]) + x_y[0]rRrSs   r�test_lambda_simple_multi_usez.Test_tuple_params.test_lambda_simple_multi_usens&��1��B���
�
�1�a�����rc�:�d}d}|�||��dS)Nzlambda (x, y): y + xzlambda x_y: x_y[1] + x_y[0]rRrSs   r�test_lambda_simple_reversez,Test_tuple_params.test_lambda_simple_reversess&��&��-���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzlambda (x, (y, z)): x + y + zz2lambda x_y_z: x_y_z[0] + x_y_z[1][0] + x_y_z[1][1]z!lambda (((x, (y, z)))): x + y + zrRrSs   r�test_lambda_nestedz$Test_tuple_params.test_lambda_nestedxsD��/��D���
�
�1�a����3��D���
�
�1�a�����rc�:�d}d}|�||��dS)Nz lambda (x, (y, z)): x + y + f(y)z5lambda x_y_z: x_y_z[0] + x_y_z[1][0] + f(x_y_z[1][0])rRrSs   r�test_lambda_nested_multi_usez.Test_tuple_params.test_lambda_nested_multi_use�s&��2��G���
�
�1�a�����rN)rLr=rMrr�r�r�r`rbrer�r�r�r�r�r�r�r�r�r�r�r�r�r�r;rrr�r��sE�������E����������	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�
�
�
�
�
�
����������"���"������
���
�������rr�c�&�eZdZdZgd�Zd�Zd�ZdS)�Test_methodattrs�methodattrs)�funcr�classc��|jD]T}d|z}|dkrd}nd|z}|�||��d|z}|dkrd}nd|z}|�||���UdS)Nza.im_%sr�za.__self__.__class__r4zself.foo.im_%s.foo_barz#self.foo.__self__.__class__.foo_barr5r6r8s    rr�zTest_methodattrs.test�s����J�
	�
	�D��D� �A��w���*�����%���J�J�q�!����(�4�/�A��w���9���-��4���J�J�q�!�����
	�
	rc��|jD]P}d|z}|�|��d|z}|�|��d|z}|�|���QdS)Nzfoo(im_%s + 5)r;r<r=r>s   rr�zTest_methodattrs.test_unchanged�st���J�	�	�D� �4�'�A��N�N�1�����$�&�A��N�N�1����#�d�*�A��N�N�1�����	�	rNr?r;rrr�r��sB�������E�%�%�%�E���� 	�	�	�	�	rr�c� �eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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.�Z0d/S)0�	Test_next�nextc�:�d}d}|�||��dS)Nz	it.next()znext(it)rRrSs   rr`zTest_next.test_1��&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nza.b.c.d.next()z
next(a.b.c.d)rRrSs   rrbzTest_next.test_2�rrc�:�d}d}|�||��dS)Nz(a + b).next()z
next((a + b))rRrSs   rrezTest_next.test_3�rrc�:�d}d}|�||��dS)Nz
a().next()z	next(a())rRrSs   rrgzTest_next.test_4��&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nza().next() + bz
next(a()) + brRrSs   rrizTest_next.test_5�rrc�:�d}d}|�||��dS)Nzc(      a().next() + b)zc(      next(a()) + b)rRrSs   rrlzTest_next.test_6�r�rc�:�d}d}|�||��dS)NzU
            for a in b:
                foo(a)
                a.next()
            zT
            for a in b:
                foo(a)
                next(a)
            rRrSs   r�test_prefix_preservation_1z$Test_next.test_prefix_preservation_1��,��
��

��
	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nzq
            for a in b:
                foo(a) # abc
                # def
                a.next()
            zp
            for a in b:
                foo(a) # abc
                # def
                next(a)
            rRrSs   r�test_prefix_preservation_2z$Test_next.test_prefix_preservation_2�s,��
��
��	
�
�
�1�a�����rc�>�d}d}|�||d���dS)Nzj
            next = 5
            for a in b:
                foo(a)
                a.next()
            zn
            next = 5
            for a in b:
                foo(a)
                a.__next__()
            T�r(rRrSs   r�test_prefix_preservation_3z$Test_next.test_prefix_preservation_3��0��
��
��	
�
�
�1�a��
�.�.�.�.�.rc�>�d}d}|�||d���dS)Nz�
            next = 5
            for a in b:
                foo(a) # abc
                # def
                a.next()
            z�
            next = 5
            for a in b:
                foo(a) # abc
                # def
                a.__next__()
            Tr�rRrSs   r�test_prefix_preservation_4z$Test_next.test_prefix_preservation_4�s0��
��
��	
�
�
�1�a��
�.�.�.�.�.rc�>�d}d}|�||d���dS)Nzz
            next = 5
            for a in b:
                foo(foo(a), # abc
                    a.next())
            z~
            next = 5
            for a in b:
                foo(foo(a), # abc
                    a.__next__())
            Tr�rRrSs   r�test_prefix_preservation_5z$Test_next.test_prefix_preservation_5	r�rc�:�d}d}|�||��dS)Nze
            for a in b:
                foo(foo(a), # abc
                    a.next())
            zd
            for a in b:
                foo(foo(a), # abc
                    next(a))
            rRrSs   r�test_prefix_preservation_6z$Test_next.test_prefix_preservation_6	r�rc�:�d}d}|�||��dS)Nz[
            class A:
                def next(self):
                    pass
            z_
            class A:
                def __next__(self):
                    pass
            rRrSs   r�
test_method_1zTest_next.test_method_1	r�rc�:�d}d}|�||��dS)Nzc
            class A(object):
                def next(self):
                    pass
            zg
            class A(object):
                def __next__(self):
                    pass
            rRrSs   r�
test_method_2zTest_next.test_method_2,	r�rc�:�d}d}|�||��dS)NzX
            class A:
                def next(x):
                    pass
            z\
            class A:
                def __next__(x):
                    pass
            rRrSs   r�
test_method_3zTest_next.test_method_39	r�rc�:�d}d}|�||��dS)Nz�
            class A:
                def __init__(self, foo):
                    self.foo = foo

                def next(self):
                    pass

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

                def __next__(self):
                    pass

                def __iter__(self):
                    return self
            rRrSs   r�
test_method_4zTest_next.test_method_4F	s,��

��

��	
�
�
�1�a�����rc�4�d}|�|��dS)Nza
            class A:
                def next(self, a, b):
                    pass
            r2r�s  r�test_method_unchangedzTest_next.test_method_unchanged_	�#��
��
	
���q�����rc�6�d}|�|d��dS)Nzy
            next = foo

            class A:
                def next(self, a, b):
                    pass
            �)Calls to builtin next() possibly shadowedrWr�s  r�test_shadowing_assign_simplez&Test_next.test_shadowing_assign_simpleg	�(��
��	
���Q� K�L�L�L�L�Lrc�6�d}|�|d��dS)Nz~
            (next, a) = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_assign_tuple_1z'Test_next.test_shadowing_assign_tuple_1q	rrc�6�d}|�|d��dS)Nz�
            (a, (b, (next, c)), a) = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_assign_tuple_2z'Test_next.test_shadowing_assign_tuple_2{	rrc�6�d}|�|d��dS)Nz~
            [next, a] = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_assign_list_1z&Test_next.test_shadowing_assign_list_1�	rrc�6�d}|�|d��dS)Nz�
            [a, [b, [next, c]], a] = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_assign_list_2z&Test_next.test_shadowing_assign_list_2�	rrc�6�d}|�|d��dS)Nz�
            def foo():
                __builtin__.next = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_builtin_assignzTest_next.test_builtin_assign�	�(��
��	
���Q� K�L�L�L�L�Lrc�6�d}|�|d��dS)Nz�
            def foo():
                (a, __builtin__.next) = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_builtin_assign_in_tuplez&Test_next.test_builtin_assign_in_tuple�	rrc�6�d}|�|d��dS)Nz�
            def foo():
                [a, __builtin__.next] = foo

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_builtin_assign_in_listz%Test_next.test_builtin_assign_in_list�	rrc�4�d}|�|��dS)Nz�
            def foo():
                A.next = foo

            class A:
                def next(self, a, b):
                    pass
            r2r�s  r�test_assign_to_nextzTest_next.test_assign_to_next�	�#��
��	
���q�����rc�4�d}|�|��dS)Nz�
            def foo():
                (a, A.next) = foo

            class A:
                def next(self, a, b):
                    pass
            r2r�s  r�test_assign_to_next_in_tuplez&Test_next.test_assign_to_next_in_tuple�	rrc�4�d}|�|��dS)Nz�
            def foo():
                [a, A.next] = foo

            class A:
                def next(self, a, b):
                    pass
            r2r�s  r�test_assign_to_next_in_listz%Test_next.test_assign_to_next_in_list�	rrc�6�d}|�|d��dS)Nz�
            import foo.bar as next

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_1z!Test_next.test_shadowing_import_1�	rrc�6�d}|�|d��dS)Nz�
            import bar, bar.foo as next

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_2z!Test_next.test_shadowing_import_2�	rrc�6�d}|�|d��dS)Nz�
            import bar, bar.foo as next, baz

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_3z!Test_next.test_shadowing_import_3�	rrc�6�d}|�|d��dS)Nz�
            from x import next

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_from_1z&Test_next.test_shadowing_import_from_1�	rrc�6�d}|�|d��dS)Nz�
            from x.a import next

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_from_2z&Test_next.test_shadowing_import_from_2
rrc�6�d}|�|d��dS)Nz�
            from x import a, next, b

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_from_3z&Test_next.test_shadowing_import_from_3
rrc�6�d}|�|d��dS)Nz�
            from x.a import a, next, b

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_import_from_4z&Test_next.test_shadowing_import_from_4
rrc�6�d}|�|d��dS)Nz�
            def next(a):
                pass

            class A:
                def next(self, a, b):
                    pass
            rrWr�s  r�test_shadowing_funcdef_1z"Test_next.test_shadowing_funcdef_1!
rrc�<�d}d}|�||d��dS)Nz�
            def next(a):
                pass

            class A:
                def next(self):
                    pass

            it.next()
            z�
            def next(a):
                pass

            class A:
                def __next__(self):
                    pass

            it.__next__()
            rr3rSs   r�test_shadowing_funcdef_2z"Test_next.test_shadowing_funcdef_2,
s/��	
��	
��	
�
�
�1�a�D�E�E�E�E�Erc�6�d}|�|d��dS)NzW
            def f():
                global next
                next = 5
            rrWr�s  r�test_shadowing_global_1z!Test_next.test_shadowing_global_1C
�(��
��
	
���Q� K�L�L�L�L�Lrc�6�d}|�|d��dS)Nz]
            def f():
                global a, next, b
                next = 5
            rrWr�s  r�test_shadowing_global_2z!Test_next.test_shadowing_global_2K
r0rc�6�d}|�|d��dS)Nze
            for next in it():
                pass

            b = 5
            c = 6
            rrWr�s  r�test_shadowing_for_simplez#Test_next.test_shadowing_for_simpleS
rrc�6�d}|�|d��dS)Nzh
            for next, b in it():
                pass

            b = 5
            c = 6
            rrWr�s  r�test_shadowing_for_tuple_1z$Test_next.test_shadowing_for_tuple_1]
rrc�6�d}|�|d��dS)Nzp
            for a, (next, c), b in it():
                pass

            b = 5
            c = 6
            rrWr�s  r�test_shadowing_for_tuple_2z$Test_next.test_shadowing_for_tuple_2g
rrc�:�d}d}|�||��dS)Nzgnext = g.nextzgnext = g.__next__rRrSs   r�test_noncall_access_1zTest_next.test_noncall_access_1q
�&�� ��$���
�
�1�a�����rc�:�d}d}|�||��dS)Nz
f(g.next + 5)zf(g.__next__ + 5)rRrSs   r�test_noncall_access_2zTest_next.test_noncall_access_2v
rrc�:�d}d}|�||��dS)Nzf(g().next + 5)zf(g().__next__ + 5)rRrSs   r�test_noncall_access_3zTest_next.test_noncall_access_3{
s&��!��%���
�
�1�a�����rN)1rLr=rMrr`rbrergrirlr�r�r�r�r�r�r�r�r�r�rrrr	rr
rrrrrrrrr!r#r%r'r)r+r-r/r2r4r6r8r:r=r?r;rrr�r��s��������E����
���
���
���
���
���
���
�
�
�
/�
/�
/�/�/�/�"
/�
/�
/����������������2���M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�	M�	M�	M�	M�	M�	M�	M�	M�	M�	�	�	�	�	�	�	�	�	�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�	M�	M�	M�F�F�F�.M�M�M�M�M�M�M�M�M�M�M�M�M�M�M����
���
����rr�c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�Test_nonzero�nonzeroc�:�d}d}|�||��dS)Nzb
            class A:
                def __nonzero__(self):
                    pass
            z_
            class A:
                def __bool__(self):
                    pass
            rRrSs   rr`zTest_nonzero.test_1�
r�rc�:�d}d}|�||��dS)Nzj
            class A(object):
                def __nonzero__(self):
                    pass
            �g
            class A(object):
                def __bool__(self):
                    pass
            rRrSs   rrbzTest_nonzero.test_2�
r�rc�4�d}|�|��dS)NrEr2r�s  rr�zTest_nonzero.test_unchanged_1�
rrc�4�d}|�|��dS)Nzm
            class A(object):
                def __nonzero__(self, a):
                    pass
            r2r�s  rr�zTest_nonzero.test_unchanged_2�
rrc�4�d}|�|��dS)NzE
            def __nonzero__(self):
                pass
            r2r�s  r�test_unchanged_funcz Test_nonzero.test_unchanged_func�
s#��
��	
���q�����rN)	rLr=rMrr`rbr�r�rIr;rrrArA�
sd�������E�����������������rrAc�`�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZdS)�Test_numliterals�numliteralsc�:�d}d}|�||��dS)N�0755�0o755rRrSs   r�test_octal_1zTest_numliterals.test_octal_1�
s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nza = 12L�a = 12rRrSs   r�test_long_int_1z Test_numliterals.test_long_int_1�
�&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nza = 12lrRrRrSs   r�test_long_int_2z Test_numliterals.test_long_int_2�
rTrc�:�d}d}|�||��dS)Nz	b = 0x12lzb = 0x12rRrSs   r�
test_long_hexzTest_numliterals.test_long_hex�
r�rc�n�d}d}|�||��d}d}|�||��dS)Nzb =   0x12Lz
b =   0x12zb = 0755 # spamzb = 0o755 # spamrRrSs   r�test_comments_and_spacingz*Test_numliterals.test_comments_and_spacing�
sD�������
�
�1�a����!��"���
�
�1�a�����rc�4�d}|�|��dS)N�5r2r�s  r�test_unchanged_intz#Test_numliterals.test_unchanged_int�
s�������q�����rc�4�d}|�|��dS)Nz5.0r2r�s  r�test_unchanged_floatz%Test_numliterals.test_unchanged_float�
s�������q�����rc�4�d}|�|��dS)NrOr2r�s  r�test_unchanged_octalz%Test_numliterals.test_unchanged_octal�
��������q�����rc�4�d}|�|��dS)N�0xABCr2r�s  r�test_unchanged_hexz#Test_numliterals.test_unchanged_hex�
rbrc�4�d}|�|��dS)Nz5.0e10r2r�s  r�test_unchanged_expz#Test_numliterals.test_unchanged_exp�
��������q�����rc�4�d}|�|��dS)Nz5 + 4jr2r�s  r�test_unchanged_complex_intz+Test_numliterals.test_unchanged_complex_int�
rhrc�4�d}|�|��dS)Nz
5.4 + 4.9jr2r�s  r�test_unchanged_complex_floatz-Test_numliterals.test_unchanged_complex_float�
r	rc�b�d}|�|��d}|�|��dS)N�4jz4.4jr2r�s  r�test_unchanged_complex_barez,Test_numliterals.test_unchanged_complex_bare�
s6�������q���������q�����rN)rLr=rMrrPrSrVrXrZr]r_rarergrjrlror;rrrKrK�
s��������E����
���
���
���
����������������������������rrKc�2�eZdZdZddiZd�Zd�Zd�Zd�ZdS)	�Test_renames�renames�sys)�maxint�maxsizec���t|j�����D]H\}\}}d|�d|��}d|�d|��}|�||��d|z}|�|���IdS)Nr�r�r�)�listrLrMr)r/)r�modrOrPrTrUr�s       rrSzTest_renames.test_import_from�
s���#�D�L�$6�$6�$8�$8�9�9�	�	�O�C��#�s�s�'*�s�s�C�C�0�A�A�'*�s�s�C�C�0�A��J�J�q�!����$�s�*�A��N�N�1�����
	�	rc��t|j�����D]0\}\}}d|�d|�d�}d|�d|�d�}|�||���1dS)Nr�r�r��rwrLrMr)�rrxrOrPrTrUs      rrWz Test_renames.test_import_from_assx��#�D�L�$6�$6�$8�$8�9�9�	�	�O�C��#�s�s�25�#�#�s�s�s�;�A�A�25�#�#�s�s�s�;�A��J�J�q�!�����	�	rc
���t|j�����D]<\}\}}d|�d|�d|�d|�d�	}d|�d|�d|�d|�d�	}|�||���=dS)Nr\r]r9r��)
                rzr{s      rr_z%Test_renames.test_import_module_usages���#�D�L�$6�$6�$8�$8�9�9�		�		�O�C��#�s�s��s�s�C�C�C����c�c�c�+�A�A��s�s�C�C�C����c�c�c�+�A�
�J�J�q�!�����		�		rc
���t|j�����D]<\}\}}d|�d|�d|�d|�d�	}d|�d|�d|�d|�d�	}|�||���=dS)Nr^r�r]r9r}rzr{s      r�XXX_test_from_import_usagez'Test_renames.XXX_test_from_import_usages���#�D�L�$6�$6�$8�$8�9�9�		�		�O�C��#�s�s��s�s�C�C�C����c�c�c�+�A�A��s�s�C�C�C����c�c�c�+�A�
�J�J�q�!�����		�		rN)	rLr=rMrrLrSrWr_rr;rrrqrq�
sb�������E��,��G�������
�
�
�����rrqc�N�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dS)
�Test_unicode�unicodec��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzunicode( x)zstr( x)z unicode(x )z str(x )z u'h'z 'h'rRrSs   r�test_whitespacezTest_unicode.test_whitespace'sb�������
�
�1�a���������
�
�1�a���������
�
�1�a�����rc�:�d}d}|�||��dS)Nzunicode(x, y, z)zstr(x, y, z)rRrSs   r�test_unicode_callzTest_unicode.test_unicode_call4r�rc�:�d}d}|�||��dS)Nzunichr(u'h')zchr('h')rRrSs   r�test_unichrzTest_unicode.test_unichr9s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzu"x"z"x"rRrSs   r�test_unicode_literal_1z#Test_unicode.test_unicode_literal_1>s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzur'x'zr'x'rRrSs   r�test_unicode_literal_2z#Test_unicode.test_unicode_literal_2Cs&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nz
UR'''x''' z	R'''x''' rRrSs   r�test_unicode_literal_3z#Test_unicode.test_unicode_literal_3Hr�rc�n�d}d}|�||��d}d}|�||��dS)N�'\\\u20ac\U0001d121\\u20ac'z'\\\\u20ac\\U0001d121\\u20ac'�r'\\\u20ac\U0001d121\\u20ac'rRrSs   r�test_native_literal_escape_uz)Test_unicode.test_native_literal_escape_uMsD��.��0���
�
�1�a����/��/���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzb'\\\u20ac\U0001d121\\u20ac'zbr'\\\u20ac\U0001d121\\u20ac'rRrSs   r�test_bytes_literal_escape_uz(Test_unicode.test_bytes_literal_escape_uVsD��/��/���
�
�1�a����0��0���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzu'\\\u20ac\U0001d121\\u20ac'r�zur'\\\u20ac\U0001d121\\u20ac'r�rRrSs   r�test_unicode_literal_escape_uz*Test_unicode.test_unicode_literal_escape_u_sD��/��.���
�
�1�a����0��/���
�
�1�a�����rc��d}|dz}|dz}|�||��|dz}|dz}|�||��dS)Nz(from __future__ import unicode_literals
r�r�rR)r�frTrUs    r�$test_native_unicode_literal_escape_uz1Test_unicode.test_native_unicode_literal_escape_uhsa��7��
�2�2��
�2�2���
�
�1�a����
�3�3��
�3�3���
�
�1�a�����rN)rLr=rMrr�r�r�r�r�r�r�r�r�r�r;rrr�r�$s��������E�������
���
���
���
���
�������������rr�c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�Test_filter�filterc�n�d}d}|�||��d}d}|�||��dS)Nz#x =   filter(    foo,     'abc'   )z)x =   list(filter(    foo,     'abc'   ))zx =   filter(  None , 'abc'  )z x =   [_f for _f in 'abc' if _f]rRrSs   rr�z$Test_filter.test_prefix_preservationvsD��5��;���
�
�1�a����0��2���
�
�1�a�����rc�
�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d}d	}|�||��dS)
Nzx = filter(None, 'abc')zx = [_f for _f in 'abc' if _f]zx = len(filter(f, 'abc'))zx = len(list(filter(f, 'abc')))z)x = filter(lambda x: x%2 == 0, range(10))z&x = [x for x in range(10) if x%2 == 0]z+x = filter(lambda (x): x%2 == 0, range(10))z5filter(lambda x: True if x > 2 else False, [1, 2, 3])z4[x for x in [1, 2, 3] if (True if x > 2 else False)]rRrSs   r�test_filter_basiczTest_filter.test_filter_basics���)��0���
�
�1�a����+��1���
�
�1�a����;��8���
�
�1�a����
>��8���
�
�1�a����
H��F���
�
�1�a�����rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzx = filter(None, 'abc')[0]z!x = [_f for _f in 'abc' if _f][0]zx = len(filter(f, 'abc')[0])z"x = len(list(filter(f, 'abc'))[0])z,x = filter(lambda x: x%2 == 0, range(10))[0]z)x = [x for x in range(10) if x%2 == 0][0]z.x = filter(lambda (x): x%2 == 0, range(10))[0]rRrSs   r�test_filter_trailersz Test_filter.test_filter_trailers�s���,��3���
�
�1�a����.��4���
�
�1�a����>��;���
�
�1�a����
A��;���
�
�1�a�����rc�p�d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d	}|�|��d
}|�|��d}|�|��d}|�|��d
}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzb.join(filter(f, 'abc'))z#(a + foo(5)).join(filter(f, 'abc'))ziter(filter(f, 'abc'))zlist(filter(f, 'abc'))zlist(filter(f, 'abc'))[0]zset(filter(f, 'abc'))zset(filter(f, 'abc')).pop()ztuple(filter(f, 'abc'))zany(filter(f, 'abc'))zall(filter(f, 'abc'))zsum(filter(f, 'abc'))zsorted(filter(f, 'abc'))z"sorted(filter(f, 'abc'), key=blah)z%sorted(filter(f, 'abc'), key=blah)[0]zenumerate(filter(f, 'abc'))z$enumerate(filter(f, 'abc'), start=1)zfor i in filter(f, 'abc'): passz[x for x in filter(f, 'abc')]z(x for x in filter(f, 'abc'))r2�rrUs  r�test_filter_nochangez Test_filter.test_filter_nochange�s���*�����q����5�����q����(�����q����(�����q����+�����q����'�����q����-�����q����)�����q����'�����q����'�����q����'�����q����*�����q����4�����q����7�����q����-�����q����6�����q����1�����q����/�����q����/�����q�����rc��d}|�|��d}d}|�||��d}|�|��dS)Nz:from future_builtins import spam, filter; filter(f, 'ham')z6from future_builtins import spam; x = filter(f, 'abc')z<from future_builtins import spam; x = list(filter(f, 'abc'))z/from future_builtins import *; filter(f, 'ham')r�r�s   r�test_future_builtinsz Test_filter.test_future_builtins�sT��H�����q����H��N���
�
�1�a����=�����q�����rN)	rLr=rMrr�r�r�r�r�r;rrr�r�sse�������E�������.���$&�&�&�P	�	�	�	�	rr�c�L��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Z�xZS)
�Test_mapr�c���|�d|z|��tt|���||��dS)Nz!from future_builtins import map; )r/rr�r)�rrTrUr<s   �rr)zTest_map.check��C������:�Q�>��B�B�B�
�h����#�#�A�q�)�)�)�)�)rc�:�d}d}|�||��dS)Nzx =    map(   f,    'abc'   )z#x =    list(map(   f,    'abc'   ))rRrSs   rr�z!Test_map.test_prefix_preservation�s&��/��5���
�
�1�a�����rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)	Nzx = map(f, 'abc')[0]zx = list(map(f, 'abc'))[0]zx = map(None, l)[0]zx = list(l)[0]zx = map(lambda x:x, l)[0]zx = [x for x in l][0]zx = map(f, 'abc')[0][1]zx = list(map(f, 'abc'))[0][1]rRrSs   r�test_map_trailerszTest_map.test_map_trailers�s���&��,���
�
�1�a����%�� ���
�
�1�a����+��'���
�
�1�a����)��/���
�
�1�a�����rc�:�d}d}|�||��dS)Nzx = map(f, 'abc')   #   fooz!x = list(map(f, 'abc'))   #   foorRrSs   rr�zTest_map.test_trailing_comment�s&��-��3���
�
�1�a�����rc�6�d}|�|d��dS)Nzx = map(None, a, b, c)z5cannot convert map(None, ...) with multiple argumentsrWr�s  r�!test_None_with_multiple_argumentsz*Test_map.test_None_with_multiple_arguments�s0��(�����Q�!2�	3�	3�	3�	3�	3rc�@�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d}|�||��d
}d}|�||d��dS)
Nzx = map(f, 'abc')zx = list(map(f, 'abc'))zx = len(map(f, 'abc', 'def'))z#x = len(list(map(f, 'abc', 'def')))zx = map(None, 'abc')zx = list('abc')z x = map(lambda x: x+1, range(4))zx = [x+1 for x in range(4)]z"x = map(lambda (x): x+1, range(4))zG
            foo()
            # foo
            map(f, x)
            zM
            foo()
            # foo
            list(map(f, x))
            zYou should use a for loop here)r)r0rSs   r�test_map_basiczTest_map.test_map_basics���#��)���
�
�1�a����/��5���
�
�1�a����&��!���
�
�1�a����2��-���
�
�1�a����
5��-���
�
�1�a����
��

��
	
�
�
�1�a�9�:�:�:�:�:rc�p�d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d	}|�|��d
}|�|��d}|�|��d}|�|��d
}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzb.join(map(f, 'abc'))z (a + foo(5)).join(map(f, 'abc'))ziter(map(f, 'abc'))zlist(map(f, 'abc'))zlist(map(f, 'abc'))[0]zset(map(f, 'abc'))zset(map(f, 'abc')).pop()ztuple(map(f, 'abc'))zany(map(f, 'abc'))zall(map(f, 'abc'))zsum(map(f, 'abc'))zsorted(map(f, 'abc'))zsorted(map(f, 'abc'), key=blah)z"sorted(map(f, 'abc'), key=blah)[0]zenumerate(map(f, 'abc'))z!enumerate(map(f, 'abc'), start=1)zfor i in map(f, 'abc'): passz[x for x in map(f, 'abc')]z(x for x in map(f, 'abc'))r2r�s  r�test_map_nochangezTest_map.test_map_nochange$s���'�����q����2�����q����%�����q����%�����q����(�����q����$�����q����*�����q����&�����q����$�����q����$�����q����$�����q����'�����q����1�����q����4�����q����*�����q����3�����q����.�����q����,�����q����,�����q�����rc��d}|�|��d}d}|�||��d}|�|��dS)Nz:from future_builtins import spam, map, eggs; map(f, 'ham')z9from future_builtins import spam, eggs; x = map(f, 'abc')z?from future_builtins import spam, eggs; x = list(map(f, 'abc'))z,from future_builtins import *; map(f, 'ham')r�r�s   rr�zTest_map.test_future_builtinsLsT��H�����q����K��Q���
�
�1�a����:�����q�����r)
rLr=rMrr)r�r�r�r�r�r�r�rrs@rr�r��s���������E�*�*�*�*�*����
���"���
3�3�3�
 ;� ;� ;�D&�&�&�P	�	�	�	�	�	�	rr�c�:��eZdZdZ�fd�Zd�Zd�Zd�Zd�Z�xZ	S)�Test_zip�zipc���|�d|z|��tt|���||��dS)Nz!from future_builtins import zip; )r/rr�r)r�s   �rr)zTest_zip.checkZr�rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nz	x = zip()zx = list(zip())zx = zip(a, b, c)zx = list(zip(a, b, c))zx = len(zip(a, b))zx = len(list(zip(a, b)))rRrSs   r�test_zip_basiczTest_zip.test_zip_basic^sb����!���
�
�1�a����"��(���
�
�1�a����$��*���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzx = zip(a, b, c)[0]zx = list(zip(a, b, c))[0]zx = zip(a, b, c)[0][1]zx = list(zip(a, b, c))[0][1]rRrSs   r�test_zip_trailerszTest_zip.test_zip_trailersksD��%��+���
�
�1�a����(��.���
�
�1�a�����rc�p�d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d	}|�|��d
}|�|��d}|�|��d}|�|��d
}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzb.join(zip(a, b))z(a + foo(5)).join(zip(a, b))ziter(zip(a, b))zlist(zip(a, b))zlist(zip(a, b))[0]zset(zip(a, b))zset(zip(a, b)).pop()ztuple(zip(a, b))zany(zip(a, b))zall(zip(a, b))zsum(zip(a, b))zsorted(zip(a, b))zsorted(zip(a, b), key=blah)zsorted(zip(a, b), key=blah)[0]zenumerate(zip(a, b))zenumerate(zip(a, b), start=1)zfor i in zip(a, b): passz[x for x in zip(a, b)]z(x for x in zip(a, b))r2r�s  r�test_zip_nochangezTest_zip.test_zip_nochangets���#�����q����.�����q����!�����q����!�����q����$�����q���� �����q����&�����q����"�����q���� �����q���� �����q���� �����q����#�����q����-�����q����0�����q����&�����q����/�����q����*�����q����(�����q����(�����q�����rc��d}|�|��d}d}|�||��d}|�|��dS)Nz6from future_builtins import spam, zip, eggs; zip(a, b)z5from future_builtins import spam, eggs; x = zip(a, b)z;from future_builtins import spam, eggs; x = list(zip(a, b))z(from future_builtins import *; zip(a, b)r�r�s   rr�zTest_zip.test_future_builtins�sT��D�����q����G��M���
�
�1�a����6�����q�����r)
rLr=rMrr)r�r�r�r�rrs@rr�r�Wsz��������E�*�*�*�*�*�������&�&�&�P	�	�	�	�	�	�	rr�c��eZdZdZd�ZdS)�Test_standarderror�
standarderrorc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzx =    StandardError()zx =    Exception()zx = StandardError(a, b, c)zx = Exception(a, b, c)zf(2 + StandardError(a, b, c))zf(2 + Exception(a, b, c))rRrSs   rr�zTest_standarderror.test�sb��(��$���
�
�1�a����,��(���
�
�1�a����/��+���
�
�1�a�����rN)rLr=rMrr�r;rrr�r��s(�������E�����rr�c��eZdZdZd�ZdS)�
Test_types�typesc�r�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d}|�||��d
}d}|�||��d}d
}|�||��dS)Nztypes.StringType�bytesztypes.DictTyper�ztypes . IntType�intztypes.ListTyperwztypes.LongTypeztypes.NoneTypez
type(None)ztypes.StringTypesz(str,)rRrSs   r�test_basic_types_convertz#Test_types.test_basic_types_convert�s���"�����
�
�1�a���� �����
�
�1�a����!�����
�
�1�a���� �����
�
�1�a���� �����
�
�1�a���� �����
�
�1�a���������
�
�1�a�����rN)rLr=rMrr�r;rrr�r��s(�������E�����rr�c�~�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�Test_idioms�idiomsc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzwhile 1: foo()zwhile True: foo()zwhile   1: foo()zwhile   True: foo()z8
            while 1:
                foo()
            z;
            while True:
                foo()
            rRrSs   r�
test_whilezTest_idioms.test_while�sh�� ��#���
�
�1�a����"��%���
�
�1�a����
��
��	
�
�
�1�a�����rc��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzwhile 11: foo()zwhile 0: foo()zwhile foo(): foo()zwhile []: foo()r2r�s  r�test_while_unchangedz Test_idioms.test_while_unchanged�sd��!�����q���� �����q����$�����q����!�����q�����rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x) == T�isinstance(x, T)zif   type(x) == T: pass�if   isinstance(x, T): passrRrSs   r�test_eq_simplezTest_idioms.test_eq_simple��D����"���
�
�1�a����)��-���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)NzT == type(x)r�zif   T == type(x): passr�rRrSs   r�test_eq_reversezTest_idioms.test_eq_reverse
r�rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x+y) == d.get('T')�isinstance(x+y, d.get('T'))ztype(   x  +  y) == d.get('T')�isinstance(x  +  y, d.get('T'))rRrSs   r�test_eq_expressionzTest_idioms.test_eq_expression
�D��)��-���
�
�1�a����0��1���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x) is Tr�zif   type(x) is T: passr�rRrSs   r�test_is_simplezTest_idioms.test_is_simple
r�rc�n�d}d}|�||��d}d}|�||��dS)NzT is type(x)r�zif   T is type(x): passr�rRrSs   r�test_is_reversezTest_idioms.test_is_reverse
r�rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x+y) is d.get('T')r�ztype(   x  +  y) is d.get('T')r�rRrSs   r�test_is_expressionzTest_idioms.test_is_expression'
r�rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x) is not T�not isinstance(x, T)zif   type(x) is not T: pass�if   not isinstance(x, T): passrRrSs   r�test_is_not_simplezTest_idioms.test_is_not_simple0
�D��"��&���
�
�1�a����-��1���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)NzT is not type(x)r�zif   T is not type(x): passr�rRrSs   r�test_is_not_reversezTest_idioms.test_is_not_reverse9
r�rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x+y) is not d.get('T')�not isinstance(x+y, d.get('T'))z"type(   x  +  y) is not d.get('T')�#not isinstance(x  +  y, d.get('T'))rRrSs   r�test_is_not_expressionz"Test_idioms.test_is_not_expressionB
sD��-��1���
�
�1�a����4��5���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x) != Tr�zif   type(x) != T: passr�rRrSs   r�test_ne_simplezTest_idioms.test_ne_simpleK
�D����&���
�
�1�a����)��1���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)NzT != type(x)r�zif   T != type(x): passr�rRrSs   r�test_ne_reversezTest_idioms.test_ne_reverseT
r�rc�n�d}d}|�||��d}d}|�||��dS)Nztype(x+y) != d.get('T')r�ztype(   x  +  y) != d.get('T')r�rRrSs   r�test_ne_expressionzTest_idioms.test_ne_expression]
sD��)��1���
�
�1�a����0��5���
�
�1�a�����rc�4�d}|�|��dS)Nztype(x).__name__r2r�s  r�test_type_unchangedzTest_idioms.test_type_unchangedf
r�rc��d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��d}d}|�||��d
}d}|�||��d}d}|�||��dS)NzM
            v = list(t)
            v.sort()
            foo(v)
            �:
            v = sorted(t)
            foo(v)
            zV
            v = list(foo(b) + d)
            v.sort()
            foo(v)
            �C
            v = sorted(foo(b) + d)
            foo(v)
            zn
            while x:
                v = list(t)
                v.sort()
                foo(v)
            �W
            while x:
                v = sorted(t)
                foo(v)
            z_
            v = list(t)
            # foo
            v.sort()
            foo(v)
            �L
            v = sorted(t)
            # foo
            foo(v)
            zP
            v = list(   t)
            v.sort()
            foo(v)
            z=
            v = sorted(   t)
            foo(v)
            zl
            try:
                m = list(s)
                m.sort()
            except: pass
            zU
            try:
                m = sorted(s)
            except: pass
            z�
            try:
                m = list(s)
                # foo
                m.sort()
            except: pass
            zk
            try:
                m = sorted(s)
                # foo
            except: pass
            zI
            m = list(s)
            # more comments
            m.sort()z6
            m = sorted(s)
            # more commentsrRrSs   r�test_sort_list_callzTest_idioms.test_sort_list_callj
s(��
��

��	
�
�
�1�a����
��

��	
�
�
�1�a����
��
��
	
�
�
�1�a����
��
��
	
�
�
�1�a����
��

��	
�
�
�1�a����
��
��
	
�
�
�1�a����
��
��	
�
�
�1�a����
��

��	
�
�
�1�a�����rc�r�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��d}d}|�||��d
}d}|�||��dS)NzG
            v = t
            v.sort()
            foo(v)
            r�zL
            v = foo(b)
            v.sort()
            foo(v)
            z?
            v = sorted(foo(b))
            foo(v)
            zN
            v = b.keys()
            v.sort()
            foo(v)
            zA
            v = sorted(b.keys())
            foo(v)
            zP
            v = foo(b) + d
            v.sort()
            foo(v)
            r�zh
            while x:
                v = t
                v.sort()
                foo(v)
            r�zY
            v = t
            # foo
            v.sort()
            foo(v)
            r�zI
            v =   t
            v.sort()
            foo(v)
            z<
            v =   sorted(t)
            foo(v)
            rRrSs   r�test_sort_simple_exprz!Test_idioms.test_sort_simple_expr�
s��
��

��	
�
�
�1�a����
��

��	
�
�
�1�a����
��

��	
�
�
�1�a����
��

��	
�
�
�1�a����
��
��
	
�
�
�1�a����
��
��
	
�
�
�1�a����
��

��	
�
�
�1�a�����rc�b�d}|�|��d}|�|��dS)NzM
            v = list(t)
            w.sort()
            foo(w)
            zN
            v = list(t)
            v.sort(u)
            foo(v)
            r2r�s  r�test_sort_unchangedzTest_idioms.test_sort_unchanged s>��
��
	
���q����
��
	
���q�����rN)rLr=rMrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr;rrr�r��s/�������E����&������������������������������������������b�b�b�HP�P�P�d
�
�
�
�
rr�c��eZdZdZd�ZdS)�Test_basestring�
basestringc�:�d}d}|�||��dS)Nzisinstance(x, basestring)zisinstance(x, str)rRrSs   r�test_basestringzTest_basestring.test_basestring2s&��+��$���
�
�1�a�����rN)rLr=rMrrr;rrrr/s(�������E�����rrc��eZdZdZd�Zd�ZdS)�Test_buffer�bufferc�:�d}d}|�||��dS)Nz
x = buffer(y)zx = memoryview(y)rRrSs   r�test_bufferzTest_buffer.test_buffer:rrc�:�d}d}|�||��dS)Nzbuffer(y)[4:5]zmemoryview(y)[4:5]rRrSs   r�test_slicingzTest_buffer.test_slicing?r;rN)rLr=rMrr
rr;rrr
r
7s7�������E����
����rr
c��eZdZdZd�Zd�ZdS)�Test_future�futurec��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzfrom __future__ import bracesr+z'# comment
from __future__ import bracesz
# comment
z'from __future__ import braces
# commentz

# commentrRrSs   r�test_futurezTest_future.test_futureGsb��/�����
�
�1�a����:�����
�
�1�a����:�����
�
�1�a�����rc�0�|�d��dS)Nr��rKr�s r�test_run_orderzTest_future.test_run_orderTs�����w�'�'�'�'�'rN)rLr=rMrrrr;rrrrDs7�������E����(�(�(�(�(rrc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�Test_itertools�	itertoolsc�f�dD]-}dD](}||dz|zz}||z}|�||���)�.dS)N)z
itertools.r+)r�r�r��irR)rr!r"rr�rTrUs       r�checkallzTest_itertools.checkallZsc��$�	!�	!�A�-�
!�
!���Q�s�U�1�W�%���A�J���
�
�1�a� � � � �
!�	!�	!rc�:�d}d}|�||��dS)Nzitertools.izip(a, b)z	zip(a, b)rRrSs   r�test_0zTest_itertools.test_0ds(��
#�����
�
�1�a�����rc�:�d}d}|�||��dS)Nz%s(f, a)�rrSs   rr`zTest_itertools.test_1ks&�������
�
�a������rc�n�d}d}|�||��d}d}|�||��dS)Nzitertools.ifilterfalse(a, b)zitertools.filterfalse(a, b)zitertools.izip_longest(a, b)zitertools.zip_longest(a, b)rRrSs   r�test_qualifiedzTest_itertools.test_qualifiedpsD��.��-���
�
�1�a����.��-���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzifilterfalse(a, b)zfilterfalse(a, b)zizip_longest(a, b)zzip_longest(a, b)rRrSs   rrbzTest_itertools.test_2ysD��$��#���
�
�1�a����$��#���
�
�1�a�����rc�:�d}d}|�||��dS)Nz    %s(f, a)r!rSs   rr�zTest_itertools.test_space_1�s&�������
�
�a������rc�n�d}d}|�||��d}d}|�||��dS)Nz     itertools.ifilterfalse(a, b)z    itertools.filterfalse(a, b)z     itertools.izip_longest(a, b)z    itertools.zip_longest(a, b)rRrSs   rr�zTest_itertools.test_space_2�sD��2��1���
�
�1�a����2��1���
�
�1�a�����rc�4�|�ddd��dS)Nr�r�r�rr�s rrzTest_itertools.test_run_order�s �����u�e�X�6�6�6�6�6rN)rLr=rMrrrr`r#rbr�r�rr;rrrrWs��������E�!�!�!�������
���������
���7�7�7�7�7rrc�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�Test_itertools_imports�itertools_importsc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nz%from itertools import imap, izip, foo�from itertools import fooz*from itertools import bar, imap, izip, foozfrom itertools import bar, fooz'from itertools import chain, imap, izipzfrom itertools import chainrRrSs   r�test_reducedz#Test_itertools_imports.test_reduced�sb��3��'���
�
�1�a����8��,���
�
�1�a����5��)���
�
�1�a�����rc�:�d}d}|�||��dS)Nz%#foo
from itertools import imap, izipz#foo
rRrSs   r�
test_commentsz$Test_itertools_imports.test_comments�s&��4�����
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nz from itertools import imap, izipr+zfrom itertools import iziprRrSs   r�	test_nonez Test_itertools_imports.test_none�sD��.�����
�
�1�a����(�����
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d}|�|��dS)Nz-from itertools import izip, bar as bang, imapz!from itertools import bar as bangz-from itertools import izip as _zip, imap, barzfrom itertools import barz"from itertools import imap as _mapr+z0from itertools import imap as _map, izip as _zip)r)r/)rrTrUr�s    r�test_import_asz%Test_itertools_imports.test_import_as�s���;��/���
�
�1�a����;��'���
�
�1�a����0�����
�
�1�a����>�����
�
�1�a����/�����q�����rc���dD]f}d|��}d|��}|�||��d|�d�}d|�d�}|�||��d|�d�}d|�d�}|�||���gdS)N)�filterfalse�zip_longestzfrom itertools import izfrom itertools import zfrom itertools import imap, iz, foozfrom itertools import bar, izfrom itertools import bar, rR)rr/rTrUs    r�test_ifilter_and_zip_longestz3Test_itertools_imports.test_ifilter_and_zip_longest�s���0�	�	�D�D�/3�t�5�A�A�.2�d�4�A��J�J�q�!�����:>�$�$�@�A�A�37�4�4�9�A��J�J�q�!�����9=���?�A�A�8<���>�A��J�J�q�!�����	�	rc�4�d}|�|��dS)Nzfrom itertools import *r2r�s  r�test_import_starz'Test_itertools_imports.test_import_star����%�����q�����rc�4�d}|�|��dS)Nr,r2r�s  rr�z%Test_itertools_imports.test_unchanged�s��'�����q�����rN)rLr=rMrr-r/r1r3r7r9r�r;rrr)r)�s��������E�������
������(������
����rr)c���eZdZdZ�fd�Zd�Z�fd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z�xZS)�Test_importr|c����tt������g�_t	���_d�_�fd�}ddlm}||_	dS)NTc�X���j�|���jp|�jvSr)�
files_checkedr��
always_exists�
present_files)r/rs �r�fake_existsz&Test_import.setUp.<locals>.fake_exists�s0�����%�%�d�+�+�+��%�E�$�$�2D�*D�Err��
fix_import)
rr=rr@�setrBrA�
lib2to3.fixesrE�exists)rrCrEr<s`  �rrzTest_import.setUp�s~����
�k�4� � �&�&�(�(�(� ��� �U�U���!���	F�	F�	F�	F�	F�	-�,�,�,�,�,�'�
���rc�>�ddlm}tjj|_dS)NrrD)rGrE�os�pathrH)rrEs  r�tearDownzTest_import.tearDown�s&��,�,�,�,�,�,��G�N�
���rc����d|_tt|���||��d|_tt|���|��dS)NTF)rArr=r)r/r�s   �r�
check_bothzTest_import.check_both�sW���!���
�k�4� � �&�&�q�!�,�,�,�"���
�k�4� � �*�*�1�-�-�-�-�-rc�*��d�}d|_tdg��|_dtjjddddf}|d	��d
|d��f}|D]��g|_�|_|�d��tj�	���r#tj�	���d
z�nd�t�fd�|D����}|�
d��|�t|j��|����dS)Nc�p�tjj�|�d����S)N�/)rJrK�pathsepr-�split)rKs r�pz)Test_import.test_files_checked.<locals>.p�s$���7�?�'�'��
�
�3���8�8�8rF�__init__.pyz.pyz.pycz.soz.slz.pydz
/spam/eggs.pyzni.pyz../../shrubbery.pyz
import jamz/jam�jamc3�"�K�|]	}�|zV��
dSrr;)r>�extr/s  �r�	<genexpr>z1Test_import.test_files_checked.<locals>.<genexpr>s'�����!L�!L��$��*�!L�!L�!L�!L�!L�!Lr)rArFrBrJrK�sepr@rr/�dirname�addr)rrT�expected_extensions�
names_to_test�expected_checksr/s     @r�test_files_checkedzTest_import.test_files_checked�s4���	9�	9�	9�#��� �-��1�1���$�b�g�k�6�5�%��P����?�+�+�W�a�a�8L�6M�6M�N�
�!�	G�	G�D�!#�D�� �D�M��N�N�<�(�(�(��w���t�$�$�
��w���t�,�,�v�5�����!�!L�!L�!L�!L�8K�!L�!L�!L�L�L�O����
�.�.�.����S��!3�4�4�o�F�F�F�F�	G�	Grc�l�d}d|_tdg��|_|�|��dS)N�
import barF�bar.py�rArFrBr/r�s  r�test_not_in_packagezTest_import.test_not_in_packages7����"��� �(��_�_������q�����rc�n�d}d|_tddg��|_|�|��dS)Nz1from __future__ import absolute_import
import barFrUrcrdr�s  r�!test_with_absolute_import_enabledz-Test_import.test_with_absolute_import_enableds<��@��"��� �-��!:�;�;������q�����rc�t�d}d}d|_tddg��|_|�||��dS)Nrb�from . import barFrUrc)rArFrBr)rSs   r�test_in_packagezTest_import.test_in_packagesC������"��� �-��!:�;�;����
�
�1�a�����rc��d}d}d|_tddtjjzg��|_|�||��dS)NrbriFrU�bar)rArFrJrKrZrBr)rSs   r�test_import_from_packagez$Test_import.test_import_from_package$sL������"��� �-�����1D�!E�F�F����
�
�1�a�����rc�4�d}|�|��dS)Nrir2r�s  r�test_already_relative_importz(Test_import.test_already_relative_import+s�������q�����rc�:�d}d}|�||��dS)Nzimport bar # Foozfrom . import bar # FoorRrSs   r�test_comments_and_indentz$Test_import.test_comments_and_indent/s&����%���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzfrom foo import bar, bazzfrom .foo import bar, bazzfrom foo import barzfrom .foo import barzfrom foo import (bar, baz)zfrom .foo import (bar, baz)�rNrSs   r�	test_fromzTest_import.test_from4sb��&��'������1����!��"������1����(��)������1�����rc�:�d}d}|�||��dS)Nzfrom green.eggs import hamzfrom .green.eggs import hamrsrSs   r�test_dotted_fromzTest_import.test_dotted_fromAs&��(��)������1�����rc�:�d}d}|�||��dS)Nz"from green.eggs import ham as spamz#from .green.eggs import ham as spamrsrSs   r�test_from_aszTest_import.test_from_asFs&��0��1������1�����rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)	Nz
import foozfrom . import foo�import foo, barzfrom . import foo, barzimport foo, bar, xzfrom . import foo, bar, xzimport x, y, zzfrom . import x, y, zrsrSs   r�test_importzTest_import.test_importKs�����������1������$������1���� ��'������1������#������1�����rc�n�d}d}|�||��d}d}|�||��dS)Nzimport foo as xzfrom . import foo as xzimport a as b, b as c, c as dz$from . import a as b, b as c, c as drsrSs   rr3zTest_import.test_import_as\sD����$������1����+��2������1�����rc�p�d|_tddg��|_d}|�|d��dS)NFzfoo.pyrUrzz#absolute and local imports together)rArFrBr4r�s  r�test_local_and_absolutez#Test_import.test_local_and_absoluteesA��"��� �(�M�!:�;�;��������Q� E�F�F�F�F�Frc�:�d}d}|�||��dS)Nzimport foo.barzfrom . import foo.barrsrSs   r�test_dotted_importzTest_import.test_dotted_importls&����#������1�����rc�:�d}d}|�||��dS)Nzimport foo.bar as bangzfrom . import foo.bar as bangrsrSs   r�test_dotted_import_asz!Test_import.test_dotted_import_asqs&��$��+������1�����rc�:�d}d}|�||��dS)Nz1
        # prefix
        import foo.bar
        z8
        # prefix
        from . import foo.bar
        rsrSs   r�test_prefixzTest_import.test_prefixvs,��
��
��	
����1�����r)rLr=rMrrrLrNr`rergrjrmrorqrtrvrxr{r3r~r�r�r�rrs@rr=r=�s[��������E�(�(�(�(�(�+�+�+�.�.�.�.�.�G�G�G�0������������������
������
���
���"���G�G�G����
���
	�	�	�	�	�	�	rr=c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�Test_set_literal�set_literalc���d}d}|�||��d}d}|�||��d}d}|�||��d}|�||��d}d}|�||��d	}|�||��d
}d}|�||��d}d
}|�||��d}d}|�||��dS)Nzset([1, 2, 3])z	{1, 2, 3}zset((1, 2, 3))z	set((1,))�{1}zset([1])zset((a, b))z{a, b}zset([a, b])zset((a*234, f(args=23)))z{a*234, f(args=23)}zset([a*23, f(23)])z
{a*23, f(23)}zset([a-234**23])z{a-234**23}rRrSs   rrVzTest_set_literal.test_basic�s�� �����
�
�1�a���� �����
�
�1�a���������
�
�1�a�������
�
�1�a���������
�
�1�a�������
�
�1�a����*��%���
�
�1�a����$�����
�
�1�a����"�����
�
�1�a�����rc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)	Nzset([x for x in y])z{x for x in y}zset([x for x in y if x == m])z{x for x in y if x == m}zset([x for x in y for a in b])z{x for x in y for a in b}zset([f(x) - 23 for x in y])z{f(x) - 23 for x in y}rRrSs   r�test_listcompszTest_set_literal.test_listcomps�s���%�� ���
�
�1�a����/��*���
�
�1�a����0��+���
�
�1�a����-��(���
�
�1�a�����rc�r�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��d}d}|�||��d
}d}|�||��dS)Nzset( [1, 2])z{1, 2}z
set([1 ,  2])z{1 ,  2}z
set([ 1 ])z{ 1 }z
set( [1] )r�zset([  1,  2  ])z{  1,  2  }zset([x  for x in y ])z{x  for x in y }z<set(
                   [1, 2]
               )
            z{1, 2}
rRrSs   rr�z Test_set_literal.test_whitespace�s��������
�
�1�a���������
�
�1�a���������
�
�1�a���������
�
�1�a����"�����
�
�1�a����'��"���
�
�1�a����
��
���
�
�1�a�����rc�n�d}d}|�||��d}d}|�||��dS)Nzset((1, 2)) # Hiz{1, 2} # HizZ
            # Foo
            set( # Bar
               (1, 2)
            )
            z2
            # Foo
            {1, 2}
            rRrSs   rr/zTest_set_literal.test_comments�sJ��"�����
�
�1�a����
��
��	
�
�
�1�a�����rc��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��d}|�|��dS)Nzset()zset(a)zset(a, b, c)zset(x for x in y)zset(x for x in y if z)zset(a*823-23**2 + f(23))r2r�s  rr�zTest_set_literal.test_unchanged�s��������q���������q���������q����
$�����q����(�����q����*�����q�����rN)	rLr=rMrrVr�r�r/r�r;rrr�r��sf�������E�!�!�!�F���"���@���$����rr�c�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�Test_sys_exc�sys_excc�:�d}d}|�||��dS)Nzsys.exc_typezsys.exc_info()[0]rRrSs   rrzTest_sys_exc.test_0s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nz
sys.exc_valuezsys.exc_info()[1]rRrSs   rr`zTest_sys_exc.test_1	s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzsys.exc_tracebackzsys.exc_info()[2]rRrSs   rrbzTest_sys_exc.test_2s&�������
�
�1�a�����rc�:�d}d}|�||��dS)Nzsys.exc_type # Foozsys.exc_info()[0] # FoorRrSs   rrezTest_sys_exc.test_3s&�� ��%���
�
�1�a�����rc�:�d}d}|�||��dS)Nzsys.  exc_typezsys.  exc_info()[0]rRrSs   rrgzTest_sys_exc.test_4�&����!���
�
�1�a�����rc�:�d}d}|�||��dS)Nzsys  .exc_typezsys  .exc_info()[0]rRrSs   rrizTest_sys_exc.test_5r�rN)
rLr=rMrrr`rbrergrir;rrr�r�ss�������E����
���
���
���
���
����rr�c�Z�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZdS)�
Test_paren�parenc�:�d}d}|�||��dS)Nz[i for i in 1, 2 ]z[i for i in (1, 2) ]rRrSs   rrzTest_paren.test_0&s&��$��&���
�
�1�a�����rc�:�d}d}|�||��dS)Nz[i for i in 1, 2, ]z[i for i in (1, 2,) ]rRrSs   rr`zTest_paren.test_1+s&��%��'���
�
�1�a�����rc�:�d}d}|�||��dS)Nz[i for i  in     1, 2 ]z[i for i  in     (1, 2) ]rRrSs   rrbzTest_paren.test_20s&��)��+���
�
�1�a�����rc�:�d}d}|�||��dS)Nz[i for i in 1, 2 if i]z[i for i in (1, 2) if i]rRrSs   rrezTest_paren.test_35s&��(��*���
�
�1�a�����rc�:�d}d}|�||��dS)Nz[i for i in 1,    2    ]z[i for i in (1,    2)    ]rRrSs   rrgzTest_paren.test_4:s&��*��,���
�
�1�a�����rc�:�d}d}|�||��dS)Nz(i for i in 1, 2)�(i for i in (1, 2))rRrSs   rrizTest_paren.test_5?s&��#��%���
�
�1�a�����rc�:�d}d}|�||��dS)Nz(i for i in 1   ,2   if i)z(i for i in (1   ,2)   if i)rRrSs   rrlzTest_paren.test_6Ds&��,��.���
�
�1�a�����rc�4�d}|�|��dS)Nz[i for i in (1, 2)]r2r�s  r�test_unchanged_0zTest_paren.test_unchanged_0Ir:rc�4�d}|�|��dS)Nz[i for i in foo()]r2r�s  rr�zTest_paren.test_unchanged_1Mr~rc�4�d}|�|��dS)Nz[i for i in (1, 2) if nothing]r2r�s  rr�zTest_paren.test_unchanged_2Qr�rc�4�d}|�|��dS)Nr�r2r�s  rr�zTest_paren.test_unchanged_3Ur:rc�4�d}|�|��dS)Nz[i for i in m]r2r�s  rr�zTest_paren.test_unchanged_4YrrN)rLr=rMrrr`rbrergrirlr�r�r�r�r�r;rrr�r�#s��������E����
���
���
���
���
���
���
����������������rr�c�$�eZdZdZd�Zd�Zd�ZdS)�Test_metaclass�	metaclassc��|�d��|�d��|�d��|�d��|�d��|�d��|�d��d}|�|��d	}|�|��dS)
Nzclass X(): passzclass X(object): passzclass X(object1, object2): passz(class X(object1, object2, object3): passzclass X(metaclass=Meta): passz'class X(b, arg=23, metclass=Meta): passz2class X(b, arg=23, metaclass=Meta, other=42): passzD
        class X:
            def __metaclass__(self): pass
        z1
        class X:
            a[23] = 74
        r2r�s  rr�zTest_metaclass.test_unchangedas������(�)�)�)����.�/�/�/����8�9�9�9����A�B�B�B����6�7�7�7����@�A�A�A����K�L�L�L�
��	
���q����
��	
���q�����rc�n�d}d}|�||��d}d}|�||��dS)NzQ
        class X:
            # hi
            __metaclass__ = AppleMeta
        zQ
        class X(metaclass=AppleMeta):
            # hi
            pass
        zR
        class X:
            __metaclass__ = Meta
            # Bedtime!
        zR
        class X(metaclass=Meta):
            pass
            # Bedtime!
        rRrSs   rr/zTest_metaclass.test_commentsvsP��
��

��
	
�
�
�1�a����
��

��
	
�
�
�1�a�����rc�B�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d}|�||��d
}d}|�||��d}d
}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)NzK
        class X():
            __metaclass__ = Q
            pass
        z8
        class X(metaclass=Q):
            pass
        z"class X(object): __metaclass__ = Qz"class X(object, metaclass=Q): passzW
        class X(object):
            __metaclass__ = Meta
            bar = 7
        zF
        class X(object, metaclass=Meta):
            bar = 7
        zJ
        class X:
            __metaclass__ = Meta; x = 4; g = 23
        zD
        class X(metaclass=Meta):
            x = 4; g = 23
        zW
        class X(object):
            bar = 7
            __metaclass__ = Meta
        zl
        class X():
            __metaclass__ = A
            __metaclass__ = B
            bar = 7
        z;
        class X(metaclass=B):
            bar = 7
        z[
        class X(clsA, clsB):
            __metaclass__ = Meta
            bar = 7
        zJ
        class X(clsA, clsB, metaclass=Meta):
            bar = 7
        z(class m(a, arg=23): __metaclass__ = Metaz(class m(a, arg=23, metaclass=Meta): passzN
        class X(expression(2 + 4)):
            __metaclass__ = Meta
        zN
        class X(expression(2 + 4), metaclass=Meta):
            pass
        zT
        class X(expression(2 + 4), x**4):
            __metaclass__ = Meta
        zT
        class X(expression(2 + 4), x**4, metaclass=Meta):
            pass
        zT
        class X:
            __metaclass__ = Meta
            save.py = 23
        zC
        class X(metaclass=Meta):
            save.py = 23
        rRrSs   r�	test_metazTest_metaclass.test_meta�s���
��

��	
�
�
�1�a����
5��4���
�
�1�a����
��

��	
�
�
�1�a����
��
��	
�
�
�1�a����
��

��	
�
�
�1�a����
��
��	
�
�
�1�a����
��

��	
�
�
�1�a����
;��:���
�
�1�a����
��
��	
�
�
�1�a����
��
��	
�
�
�1�a����
��

��	
�
�
�1�a�����rN)rLr=rMrr�r/r�r;rrr�r�]sK�������E����*���2p�p�p�p�prr�c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�Test_getcwdu�getcwduc���d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��dS)	Nz
os.getcwduz	os.getcwdzos.getcwdu()�os.getcwd()zmeth = os.getcwduzmeth = os.getcwdzos.getcwdu(args)zos.getcwd(args)rRrSs   rrVzTest_getcwdu.test_basics��������
�
�1�a���������
�
�1�a����#��"���
�
�1�a����"��!���
�
�1�a�����rc�:�d}d}|�||��dS)Nzos.getcwdu() # Foozos.getcwd() # FoorRrSs   rr�zTest_getcwdu.test_commentrrc��d}|�|��d}|�|��d}|�|��dS)Nr�z	getcwdu()zos.getcwdb()r2r�s  rr�zTest_getcwdu.test_unchangedsM�������q���������q���������q�����rc�:�d}d}|�||��dS)Nz<
            if 1:
                os.getcwdu()
            z;
            if 1:
                os.getcwd()
            rRrSs   r�test_indentationzTest_getcwdu.test_indentation&rjrc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nz
os .getcwdu()zos .getcwd()zos.  getcwduzos.  getcwdzos.getcwdu (  )zos.getcwd (  )rRrSs   r�test_multilationzTest_getcwdu.test_multilation1sb�������
�
�1�a���������
�
�1�a����!�� ���
�
�1�a�����rN)	rLr=rMrrVr�r�r�r�r;rrr�r�sd�������E����"���
���	�	�	�����rr�c�f�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZdS)�
Test_operator�operatorc�:�d}d}|�||��dS)Nzoperator.isCallable(x)zcallable(x)rRrSs   r�test_operator_isCallablez&Test_operator.test_operator_isCallableCs&��$�����
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzoperator.sequenceIncludes(x, y)zoperator.contains(x, y)z operator .sequenceIncludes(x, y)zoperator .contains(x, y)z!operator.  sequenceIncludes(x, y)zoperator.  contains(x, y)rRrSs   r�test_operator_sequenceIncludesz,Test_operator.test_operator_sequenceIncludesHsb��-��%���
�
�1�a����.��&���
�
�1�a����/��'���
�
�1�a�����rc�:�d}d}|�||��dS)Nzoperator.isSequenceType(x)z>import collections.abc
isinstance(x, collections.abc.Sequence)rRrSs   r�test_operator_isSequenceTypez*Test_operator.test_operator_isSequenceTypeUs&��(��M���
�
�1�a�����rc�:�d}d}|�||��dS)Nzoperator.isMappingType(x)z=import collections.abc
isinstance(x, collections.abc.Mapping)rRrSs   r�test_operator_isMappingTypez)Test_operator.test_operator_isMappingTypeZs&��'��L���
�
�1�a�����rc�:�d}d}|�||��dS)Nzoperator.isNumberType(x)z,import numbers
isinstance(x, numbers.Number)rRrSs   r�test_operator_isNumberTypez(Test_operator.test_operator_isNumberType_s&��&��;���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzoperator.repeat(x, n)zoperator.mul(x, n)zoperator .repeat(x, n)zoperator .mul(x, n)zoperator.  repeat(x, n)zoperator.  mul(x, n)rRrSs   r�test_operator_repeatz"Test_operator.test_operator_repeatdsb��#�� ���
�
�1�a����$��!���
�
�1�a����%��"���
�
�1�a�����rc��d}d}|�||��d}d}|�||��d}d}|�||��dS)Nzoperator.irepeat(x, n)zoperator.imul(x, n)zoperator .irepeat(x, n)zoperator .imul(x, n)zoperator.  irepeat(x, n)zoperator.  imul(x, n)rRrSs   r�test_operator_irepeatz#Test_operator.test_operator_irepeatqsb��$��!���
�
�1�a����%��"���
�
�1�a����&��#���
�
�1�a�����rc�:�d}d}|�||��dS)Nz
isCallable(x)z"You should use 'callable(x)' here.rW�rr��ts   r�test_bare_isCallablez"Test_operator.test_bare_isCallable~s(����0�����Q��"�"�"�"�"rc�:�d}d}|�||��dS)NzsequenceIncludes(x, y)z.You should use 'operator.contains(x, y)' here.rWr�s   r�test_bare_sequenceIncludesz(Test_operator.test_bare_sequenceIncludes�s(��$��<�����Q��"�"�"�"�"rc�:�d}d}|�||��dS)NzisSequenceType(z)z>You should use 'isinstance(z, collections.abc.Sequence)' here.rWr�s   r�!test_bare_operator_isSequenceTypez/Test_operator.test_bare_operator_isSequenceType�s(����L�����Q��"�"�"�"�"rc�:�d}d}|�||��dS)NzisMappingType(x)z=You should use 'isinstance(x, collections.abc.Mapping)' here.rWr�s   r� test_bare_operator_isMappingTypez.Test_operator.test_bare_operator_isMappingType�s(����K�����Q��"�"�"�"�"rc�:�d}d}|�||��dS)NzisNumberType(y)z4You should use 'isinstance(y, numbers.Number)' here.rWr�s   r�test_bare_operator_isNumberTypez-Test_operator.test_bare_operator_isNumberType�s(����B�����Q��"�"�"�"�"rc�:�d}d}|�||��dS)Nzrepeat(x, n)z)You should use 'operator.mul(x, n)' here.rWr�s   r�test_bare_operator_repeatz'Test_operator.test_bare_operator_repeat�s(����7�����Q��"�"�"�"�"rc�:�d}d}|�||��dS)Nzirepeat(y, 187)z,You should use 'operator.imul(y, 187)' here.rWr�s   r�test_bare_operator_irepeatz(Test_operator.test_bare_operator_irepeat�s(����:�����Q��"�"�"�"�"rN)rLr=rMrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r;rrr�r�?s��������E����
������
���
���
������#�#�#�
#�#�#�
#�#�#�
#�#�#�
#�#�#�
#�#�#�
#�#�#�#�#rr�c�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�
Test_exitfunc�exitfuncc�:�d}d}|�||��dS)NzI
            import sys
            sys.exitfunc = my_atexit
            ze
            import sys
            import atexit
            atexit.register(my_atexit)
            rRrSs   rr&zTest_exitfunc.test_simple��,��
��
��
	
�
�
�1�a�����rc�:�d}d}|�||��dS)NzO
            import sys, crumbs
            sys.exitfunc = my_func
            zY
            import sys, crumbs, atexit
            atexit.register(my_func)
            rRrSs   r�test_names_importzTest_exitfunc.test_names_import�rjrc�:�d}d}|�||��dS)Nzh
            import sys
            sys.exitfunc = do(d)/a()+complex(f=23, g=23)*expression
            z�
            import sys
            import atexit
            atexit.register(do(d)/a()+complex(f=23, g=23)*expression)
            rRrSs   r�test_complex_expressionz%Test_exitfunc.test_complex_expression�r�rc�n�d}d}|�||��d}d}|�||��dS)NzN
            import sys # Foo
            sys.exitfunc = f # Blah
            zj
            import sys
            import atexit # Foo
            atexit.register(f) # Blah
            zo
            import apples, sys, crumbs, larry # Pleasant comments
            sys.exitfunc = func
            zy
            import apples, sys, crumbs, larry, atexit # Pleasant comments
            atexit.register(func)
            rRrSs   rr/zTest_exitfunc.test_comments�sP��
��
��
	
�
�
�1�a����
��
��	
�
�
�1�a�����rc�:�d}d}|�||��dS)Nz]
            import sys
            def f():
                sys.exitfunc = func
            zz
            import sys
            import atexit
            def f():
                atexit.register(func)
             rRrSs   r�test_in_a_functionz Test_exitfunc.test_in_a_function�s,��
��

��	
�
�
�1�a�����rc�@�d}d}d}|�|||��dS)Nzsys.exitfunc = fzatexit.register(f)zKCan't find sys import; Please add an atexit import at the top of your file.r3)rrTrU�msgs    r�test_no_sys_importz Test_exitfunc.test_no_sys_import�s/��"��$�� ���
�
�1�a������rc�4�d}|�|��dS)Nzf(sys.exitfunc)r2r�s  rr�zTest_exitfunc.test_unchanged�r�rN)rLr=rMrr&r�r�r/r�r�r�r;rrr�r��s��������E�
�
�
�	�	�	�
�
�
����,����������rr�c�$�eZdZdZd�Zd�Zd�ZdS)�Test_asserts�assertsc�J�gd�}|D]\}}|�||���dS)N))zself.assert_(True)�self.assertTrue(True))zself.assertEquals(2, 2)�self.assertEqual(2, 2))zself.assertNotEquals(2, 3)�self.assertNotEqual(2, 3))zself.assertAlmostEquals(2, 3)�self.assertAlmostEqual(2, 3))z self.assertNotAlmostEquals(2, 8)�self.assertNotAlmostEqual(2, 8))zself.failUnlessEqual(2, 2)r�)zself.failIfEqual(2, 3)r�)z self.failUnlessAlmostEqual(2, 3)r�)zself.failIfAlmostEqual(2, 8)r�)zself.failUnless(True)r�)zself.failUnlessRaises(foo)zself.assertRaises(foo))zself.failIf(False)zself.assertFalse(False)rR)r�testsrTrUs    r�test_deprecated_namesz"Test_asserts.test_deprecated_names�sI��

�

�

���	�	�D�A�q��J�J�q�!�����	�	rc�r�d}d}|�||��d}d}|�||��d}d}|�||��d}d}|�||��d	}d
}|�||��d}d}|�||��d
}d}|�||��dS)Nzeq = self.assertEqualszeq = self.assertEqualz#self.assertEquals(2, 3, msg="fail")z"self.assertEqual(2, 3, msg="fail")z)self.assertEquals(2, 3, msg="fail") # fooz(self.assertEqual(2, 3, msg="fail") # foozself.assertEquals (2, 3)zself.assertEqual (2, 3)z  self.assertEquals (2, 3)z  self.assertEqual (2, 3)z0with self.failUnlessRaises(Explosion): explode()z,with self.assertRaises(Explosion): explode()z6with self.failUnlessRaises(Explosion) as cm: explode()z2with self.assertRaises(Explosion) as cm: explode()rRrSs   r�
test_variantszTest_asserts.test_variantss���$��#���
�
�1�a����1��0���
�
�1�a����7��6���
�
�1�a����&��%���
�
�1�a����(��'���
�
�1�a����>��:���
�
�1�a����D��@���
�
�1�a�����rc�Z�|�d��|�d��dS)Nzself.assertEqualsOnSaturdayz!self.assertEqualsOnSaturday(3, 5)r2r�s rr�zTest_asserts.test_unchanged's.�����4�5�5�5����:�;�;�;�;�;rN)rLr=rMrr�r�r�r;rrr�r��sF�������E����$���.<�<�<�<�<rr�)C�__doc__rJrrr�rr
rr�
lib2to3.testsr�TestCaser	rOr]rzr�r�r�r�r�rr rCror�r�r�r�r�rrr+rArHrarmrqr�r�r�r�r�rArKrqr�r�r�r�r�r�r�rr
rrr)r=r�r�r�r�r�r�r�r�r;rr�<module>r�sk
��(�(�
�	�	�	�������������'�&�&�&�&�&�&�&�!�!�!�!�!�!�7N�7N�7N�7N�7N�G�$�7N�7N�7N�r�����m����68�8�8�8�8�=�8�8�8�tC�C�C�C�C��C�C�C�J9�9�9�9�9�-�9�9�9�v/�/�/�/�/�-�/�/�/�b!�!�!�!�!�-�!�!�!�Fg�g�g�g�g��g�g�g�T1�1�1�1�1�
�1�1�1�f$�$�$�$�$�
�$�$�$�LQ�Q�Q�Q�Q�-�Q�Q�Q�f}�}�}�}�}��}�}�}�~{�{�{�{�{��{�{�{�z+�+�+�+�+�
�+�+�+�\#�#�#�#�#�M�#�#�#�L4�4�4�4�4�m�4�4�4�8d�d�d�d�d�
�d�d�d�LF7�F7�F7�F7�F7�-�F7�F7�F7�P	�	�	�	�	�m�	�	�	�-�-�-�-�-�]�-�-�-�^�����]����4(�(�(�(�(�m�(�(�(�V_�_�_�_�_�_�_�_�D�����=�"3����*8�8�8�8�8�M�#4�8�8�8�

-�
-�
-�
-�
-�}�.?�
-�
-�
-� o%�o%�o%�o%�o%�-�o%�o%�o%�d-�-�-�-�-��-�-�-�^y�y�y�y�y�
�y�y�y�v�����}����@X�X�X�X�X�
�X�X�X�t2�2�2�2�2�=�2�2�2�h@�@�@�@�@�}�@�@�@�D,�,�,�,�,�=�,�,�,�\L�L�L�L�L�=�L�L�L�^f�f�f�f�f�-�f�f�f�Pz�z�z�z�z�}�z�z�z�xN�N�N�N�N�}�N�N�N�`��������� ���������@V�V�V�V�V�-�V�V�V�p
�����m���������-����(�(�(�(�(�-�(�(�(�&:7�:7�:7�:7�:7�]�:7�:7�:7�zG�G�G�G�G�]�G�G�G�Ta�a�a�a�a�-�a�a�a�H|�|�|�|�|�}�|�|�|�~�����=����D8�8�8�8�8��8�8�8�tb�b�b�b�b�]�b�b�b�J:�:�:�:�:�=�:�:�:�z`#�`#�`#�`#�`#�M�`#�`#�`#�FU�U�U�U�U�M�U�U�U�p/<�/<�/<�/<�/<�=�/<�/<�/<�/<�/<r