Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_lib2to3/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_lib2to3/__pycache__/test_fixers.cpython-312.opt-2.pyc

�

)Μg<����	ddlZddlmZddlmZddlmZmZddlm	Z	Gd�de	j�ZGd�d	e�ZGd
�de�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�ZGd0�d1e�Z Gd2�d3�Z!Gd4�d5ee!�Z"Gd6�d7ee!�Z#Gd8�d9ee!�Z$Gd:�d;e�Z%Gd<�d=e�Z&Gd>�d?e�Z'Gd@�dAe�Z(GdB�dCe�Z)GdD�dEe�Z*GdF�dGe�Z+GdH�dIe�Z,GdJ�dKe�Z-GdL�dMe�Z.GdN�dOe�Z/GdP�dQe�Z0GdR�dSe�Z1GdT�dUe�Z2GdV�dWe�Z3GdX�dYe�Z4GdZ�d[e�Z5Gd\�d]e�Z6Gd^�d_e�Z7Gd`�dae�Z8Gdb�dce�Z9Gdd�dee�Z:Gdf�dge�Z;Gdh�die�Z<Gdj�dke�Z=Gdl�dme�Z>Gdn�doe�Z?Gdp�dqe�Z@Gdr�dse�ZAy)t�N)�chain)�
itemgetter)�pygram�
fixer_util)�supportc�>�eZdZd	d�Zd�Zd
d�Zd
d�Zd�Zd
d�Zd�Z	y)�
FixerTestCaseNc�
�|�
|jg}tj|||�|_g|_d|_t
|jj|jj�D]}|j|_	�y)Nz<string>)
�fixerr�get_refactorer�refactor�	fixer_log�filenamer�	pre_order�
post_order�log)�self�fix_list�	fixer_pkg�optionsrs     �:/usr/local/lib/python3.12/test/test_lib2to3/test_fixers.py�setUpzFixerTestCase.setUpsj�����
�
�|�H��.�.�y�(�G�L��
����"��
��4�=�=�2�2��=�=�3�3�5�E����E�I�5�c���tj|�}tj|�}|jj||j�}|j|t
|��|S�N)r�reformatr
�refactor_stringr�assertEqual�str)r�before�after�trees    r�_checkzFixerTestCase._checksU���!�!�&�)��� � ��'���}�}�,�,�V�T�]�]�C�������D�	�*��rc��|j||�}|j|j�|s|j|jg�yyr)r#�
assertTrue�was_changedrr)rr r!�ignore_warningsr"s     r�checkzFixerTestCase.check#s@���{�{�6�5�)������(�(�)�����T�^�^�R�0�rc��|j||�}|j|dj|j��|s|j	|j
�yy)N�)r#�assertIn�joinrr%r&)rr r!�message�	unchangedr"s      r�warnszFixerTestCase.warns)sG���{�{�6�5�)���
�
�g�r�w�w�t�~�~�6�7���O�O�D�,�,�-�rc�.�|j|||d��y)NT�r.�r/)rr r-s   r�warns_unchangedzFixerTestCase.warns_unchanged/s���
�
�6�6�7�d�
�;rc�f�|j||�|s|j|jg�yyr)r#rr)rr r's   rr.zFixerTestCase.unchanged2s,�����F�F�#�����T�^�^�R�0�rc	��|jg}|j|�tjd|�}|j	�\}}d|jz}|r)|dj
jj|�ry|r+|dj
jj|�r|sy|jddj||zD�cgc]}|j
j��c}��d|�d��ycc}w)N�lib2to3�fix_���zFixer run order (�, z) is incorrect; z should be last.)
r�extendrr�
get_fixers�	__class__�
__module__�endswith�failr,)r�names�fixes�r�pre�post�n�xs        r�assert_runs_afterzFixerTestCase.assert_runs_after7s��������
���U���"�"�9�e�4���l�l�n���d��T�Z�Z����D��H�&�&�1�1�:�:�1�=���3�r�7�$�$�/�/�8�8��;�D���	�	����S��X�G�X�q�A�K�K�2�2�X�G�H�!�M�	N��Gs�
C<)Nr6N)F)
�__name__r=�__qualname__rr#r(r/r3r.rG�rrr	r	
s&��	'��1�.�<�1�

Nrr	c�"�eZdZdZd�Zd�Zd�Zy)�Test_ne�nec�0�d}d}|j||�y)Nzif x <> y:
            passzif x != y:
            pass�r(�r�b�as   r�
test_basiczTest_ne.test_basicI���
��
���
�
�1�a�rc�0�d}d}|j||�y)Nzif x<>y:
            passzif x!=y:
            passrOrPs   r�test_no_spaceszTest_ne.test_no_spacesQrTrc�0�d}d}|j||�y)Nzif x<>y<>z:
            passzif x!=y!=z:
            passrOrPs   r�test_chainedzTest_ne.test_chainedYrTrN)rHr=rIrrSrVrXrJrrrLrLFs���E���rrLc�R�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�Test_has_key�has_keyc�0�d}d}|j||�y)Nz$x = d.has_key("x") or d.has_key("y")zx = "x" in d or "y" in drOrPs   r�test_1zTest_has_key.test_1ds��6��*���
�
�1�a�rc�0�d}d}|j||�y)Nzx = a.b.c.d.has_key("x") ** 3zx = ("x" in a.b.c.d) ** 3rOrPs   r�test_2zTest_has_key.test_2i���/��+���
�
�1�a�rc�0�d}d}|j||�y)Nz!x = a.b.has_key(1 + 2).__repr__()zx = (1 + 2 in a.b).__repr__()rOrPs   r�test_3zTest_has_key.test_3ns��3��/���
�
�1�a�rc�0�d}d}|j||�y)Nz,x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4z(x = (1 + 2 in a.b).__repr__() ** -3 ** 4rOrPs   r�test_4zTest_has_key.test_4ss��>��:���
�
�1�a�rc�0�d}d}|j||�y)Nzx = a.has_key(f or g)zx = (f or g) in arOrPs   r�test_5zTest_has_key.test_5x���'��#���
�
�1�a�rc�0�d}d}|j||�y)Nzx = a + b.has_key(c)zx = a + (c in b)rOrPs   r�test_6zTest_has_key.test_6}���&��"���
�
�1�a�rc�0�d}d}|j||�y)Nzx = a.has_key(lambda: 12)zx = (lambda: 12) in arOrPs   r�test_7zTest_has_key.test_7����+��'���
�
�1�a�rc�0�d}d}|j||�y)Nzx = a.has_key(a for a in b)zx = (a for a in b) in arOrPs   r�test_8zTest_has_key.test_8�s��-��)���
�
�1�a�rc�0�d}d}|j||�y)Nzif not a.has_key(b): passzif b not in a: passrOrPs   r�test_9zTest_has_key.test_9�s��+��%���
�
�1�a�rc�0�d}d}|j||�y)Nz$if not a.has_key(b).__repr__(): passz if not (b in a).__repr__(): passrOrPs   r�test_10zTest_has_key.test_10�s��6��2���
�
�1�a�rc�0�d}d}|j||�y)Nzif not a.has_key(b) ** 2: passzif not (b in a) ** 2: passrOrPs   r�test_11zTest_has_key.test_11�s��0��,���
�
�1�a�rN)rHr=rIrr]r_rbrdrfrirlrorqrsrurJrrrZrZas>���E��
�
�
�
�
�
�
�
�
�
rrZc��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�Zy)�
Test_apply�applyc�0�d}d}|j||�y)Nzx = apply(f, g + h)z
x = f(*g + h)rOrPs   rr]zTest_apply.test_1�s��%�����
�
�1�a�rc�0�d}d}|j||�y)Nzy = apply(f, g, h)zy = f(*g, **h)rOrPs   rr_zTest_apply.test_2�s��$�� ���
�
�1�a�rc�0�d}d}|j||�y)Nz z = apply(fs[0], g or h, h or g)zz = fs[0](*g or h, **h or g)rOrPs   rrbzTest_apply.test_3����2��.���
�
�1�a�rc�0�d}d}|j||�y)Nzapply(f, (x, y) + t)zf(*(x, y) + t)rOrPs   rrdzTest_apply.test_4����&�� ���
�
�1�a�rc�0�d}d}|j||�y)Nzapply(f, args,)�f(*args)rOrPs   rrfzTest_apply.test_5�s��!�����
�
�1�a�rc�0�d}d}|j||�y)Nzapply(f, args, kwds,)�f(*args, **kwds)rOrPs   rrizTest_apply.test_6�s��'��"���
�
�1�a�rc�0�d}d}|j||�y)Nzx = apply(f+g, args)zx = (f+g)(*args)rOrPs   r�test_complex_1zTest_apply.test_complex_1�rjrc�0�d}d}|j||�y)Nzx = apply(f*g, args)zx = (f*g)(*args)rOrPs   r�test_complex_2zTest_apply.test_complex_2�rjrc�0�d}d}|j||�y)Nzx = apply(f**g, args)zx = (f**g)(*args)rOrPs   r�test_complex_3zTest_apply.test_complex_3�rgrc�0�d}d}|j||�y)Nzx = apply(f.g, args)zx = f.g(*args)rOrPs   r�test_dotted_namezTest_apply.test_dotted_name�r~rc�0�d}d}|j||�y)Nzx = apply(f[x], args)zx = f[x](*args)rOrPs   r�test_subscriptzTest_apply.test_subscript�s��'��!���
�
�1�a�rc�0�d}d}|j||�y)Nzx = apply(f(), args)zx = f()(*args)rOrPs   r�	test_callzTest_apply.test_call�r~rc�0�d}d}|j||�y)Nz"x = apply(a.b.c.d.e.f, args, kwds)zx = a.b.c.d.e.f(*args, **kwds)rOrPs   r�test_extremezTest_apply.test_extreme�s��4��0���
�
�1�a�rc�0�d}d}|j||�y)Nz1apply(   # foo
          f, # bar
          args)r�rOrPs   r�test_weird_commentszTest_apply.test_weird_comments�s��
��
���
�
�1�a�rc�*�d}|j|�y)Nzapply()r1�r�ss  r�test_unchanged_1zTest_apply.test_unchanged_1�s�������q�rc�*�d}|j|�y)Nzapply(f)r1r�s  r�test_unchanged_2zTest_apply.test_unchanged_2�s�������q�rc�*�d}|j|�y)Nz	apply(f,)r1r�s  r�test_unchanged_3zTest_apply.test_unchanged_3�s�������q�rc�*�d}|j|�y)Nzapply(f, args, kwds, extras)r1r�s  r�test_unchanged_4zTest_apply.test_unchanged_4����.�����q�rc�*�d}|j|�y)Nzapply(f, *args, **kwds)r1r�s  r�test_unchanged_5zTest_apply.test_unchanged_5�s��)�����q�rc�*�d}|j|�y)Nzapply(f, *args)r1r�s  r�test_unchanged_6zTest_apply.test_unchanged_6���!�����q�rc�*�d}|j|�y)Nzapply(f, **kwds)r1r�s  r�test_unchanged_6bzTest_apply.test_unchanged_6b���"�����q�rc�*�d}|j|�y)Nz#apply(func=f, args=args, kwds=kwds)r1r�s  r�test_unchanged_7zTest_apply.test_unchanged_7
s��5�����q�rc�*�d}|j|�y)Nzapply(f, args=args, kwds=kwds)r1r�s  r�test_unchanged_8zTest_apply.test_unchanged_8���0�����q�rc�*�d}|j|�y)Nzapply(f, args, kwds=kwds)r1r�s  r�test_unchanged_9zTest_apply.test_unchanged_9s��+�����q�rc�0�d}d}|j||�y)Nzapply(  f,  args,   kwds)r�rO�rrRrQs   r�test_space_1zTest_apply.test_space_1���+��"���
�
�1�a�rc�0�d}d}|j||�y)Nzapply(  f  ,args,kwds   )r�rOr�s   r�test_space_2zTest_apply.test_space_2r�rN)rHr=rIrr]r_rbrdrfrir�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rJrrrwrw�s����E��
�
�
�
�
��
�
��
�
��������������
rrwc�(�eZdZdZd�Zd�Zd�Zd�Zy)�Test_reload�reloadc�0�d}d}|j||�y)Nz	reload(a)z$import importlib
importlib.reload(a)rOrPs   r�testzTest_reload.test#s����7���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzreload( a ) # commentz0import importlib
importlib.reload( a ) # commentzreload( a )  # commentz1import importlib
importlib.reload( a )  # commentrOrPs   r�test_commentzTest_reload.test_comment(s4��'��C���
�
�1�a��
)��D���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)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 )rOrPs   r�
test_spacezTest_reload.test_space2sJ����9���
�
�1�a����8���
�
�1�a����8���
�
�1�a�rc�Z�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d	}|j|�y)
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()r1r�s  r�test_unchangedzTest_reload.test_unchanged?s��������q�������q�������q��$�����q�� �����q��!�����q�������q�������q�������q�rN)rHr=rIrr�r�r�r�rJrrr�r� s���E��
��rr�c�"�eZdZdZd�Zd�Zd�Zy)�Test_intern�internc��d}d}|j||�d}d}|j||�d}d}|j||�y)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,   )rOrPs   r�test_prefix_preservationz$Test_intern.test_prefix_preservation^sN��%��5���
�
�1�a��
��
���
�
�1�a��)��9���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)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", "")rOrPs   rr�zTest_intern.testmsJ����/���
�
�1�a��&��6���
�
�1�a��4��D���
�
�1�a�rc���d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)Nzintern(a=1)zintern(f, g)z
intern(*h)zintern(**i)zintern()r1r�s  rr�zTest_intern.test_unchanged|sW�������q�������q�������q�������q�������q�rN)rHr=rIrr�r�r�rJrrr�r�[s���E�
��rr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�Test_reduce�reducec�0�d}d}|j||�y)Nzreduce(a, b, c)z,from functools import reduce
reduce(a, b, c)rOrPs   r�test_simple_callzTest_reduce.test_simple_call�s����;���
�
�1�a�rc�0�d}d}|j||�y)Nzdef x(arg): reduce(sum, [])z8from functools import reduce
def x(arg): reduce(sum, [])rOrPs   r�
test_bug_7253zTest_reduce.test_bug_7253�s��)��G���
�
�1�a�rc�0�d}d}|j||�y)Nzreduce(lambda x, y: x + y, seq)z<from functools import reduce
reduce(lambda x, y: x + y, seq)rOrPs   r�test_call_with_lambdaz!Test_reduce.test_call_with_lambda�s��-��K���
�
�1�a�rc���d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)Nz	reduce(a)zreduce(a, b=42)zreduce(a, b, c, d)zreduce(**c)zreduce()r1r�s  rr�zTest_reduce.test_unchanged�sW�������q�������q�� �����q�������q�������q�rN)rHr=rIrr�r�r�r�rJrrr�r��s���E��
��
rr�c�v�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zy)�
Test_print�printc�0�d}d}|j||�y)Nzprint 1,   1+1,   1+1+1zprint(1,   1+1,   1+1+1)rOrPs   rr�z#Test_print.test_prefix_preservation�s��)��*���
�
�1�a�rc�P�d}|j|�d}|j|�y)N�print()�	print('')r1r�s  r�test_idempotencyzTest_print.test_idempotency�s$�������q�������q�rc���tj|jj_d}|j|�d}|j|�d}|j|�y)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�sM��'-�'O�'O��
�
���$�&�����q�������q�������q�rc�0�d}d}|j||�y)Nzprint 1, 1+1, 1+1+1r�rOrPs   rr]zTest_print.test_1�s��%��&���
�
�1�a�rc�0�d}d}|j||�y)Nz
print 1, 2zprint(1, 2)rOrPs   rr_zTest_print.test_2�s�������
�
�1�a�rc�0�d}d}|j||�y)Nr�r�rOrPs   rrbzTest_print.test_3�s�������
�
�1�a�rc�0�d}d}|j||�y)Nzprint whatever; printzprint(whatever); print()rOrPs   rrdzTest_print.test_4�s��'��*���
�
�1�a�rc�0�d}d}|j||�y)Nzprint; print whatever;zprint(); print(whatever);rOrPs   rrfzTest_print.test_5�s��(��+���
�
�1�a�rc�0�d}d}|j||�y)Nzprint (a, b, c)zprint((a, b, c))rOrPs   r�
test_tuplezTest_print.test_tuple�s��!��"���
�
�1�a�rc�0�d}d}|j||�y)Nzprint 1, 2, 3,zprint(1, 2, 3, end=' ')rOrPs   r�test_trailing_comma_1z Test_print.test_trailing_comma_1�s�� ��)���
�
�1�a�rc�0�d}d}|j||�y)Nzprint 1, 2,zprint(1, 2, end=' ')rOrPs   r�test_trailing_comma_2z Test_print.test_trailing_comma_2�s����&���
�
�1�a�rc�0�d}d}|j||�y)Nzprint 1,zprint(1, end=' ')rOrPs   r�test_trailing_comma_3z Test_print.test_trailing_comma_3�s����#���
�
�1�a�rc�0�d}d}|j||�y)Nzprint >>sys.stderr, 1, 2, 3zprint(1, 2, 3, file=sys.stderr)rOrPs   r�!test_vargs_without_trailing_commaz,Test_print.test_vargs_without_trailing_comma�s��-��1���
�
�1�a�rc�0�d}d}|j||�y)Nzprint >>sys.stderr, 1, 2,z%print(1, 2, end=' ', file=sys.stderr)rOrPs   r�test_with_trailing_commaz#Test_print.test_with_trailing_commas��+��7���
�
�1�a�rc�0�d}d}|j||�y)Nzprint >>sys.stderr, 1+1zprint(1+1, file=sys.stderr)rOrPs   r�test_no_trailing_commaz!Test_print.test_no_trailing_commas��)��-���
�
�1�a�rc�0�d}d}|j||�y)Nzprint >>  sys.stderrzprint(file=sys.stderr)rOrPs   r�test_spaces_before_filez"Test_print.test_spaces_before_file
s��&��(���
�
�1�a�rc�V�d}|j|�d}d}|j||�y)Nz<from __future__ import print_function
print('Hai!', end=' ')zprint 'Hello, world!'zprint('Hello, world!')�r.r()rr�rQrRs    r�test_with_future_print_functionz*Test_print.test_with_future_print_functions-��
%�����q��#��$���
�
�1�a�rN)rHr=rIrr�r�r�r]r_rbrdrfr�r�r�r�r�r�r�r�r�rJrrr�r��s\���E��
�	��
�
�
��
��
�
��
�
�
�
rr�c�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�	Test_exec�execc�0�d}d}|j||�y)Nz  exec code in ns1,   ns2z  exec(code, ns1,   ns2)rOrPs   rr�z"Test_exec.test_prefix_preservations��+��*���
�
�1�a�rc�0�d}d}|j||�y)Nz	exec code�
exec(code)rOrPs   rrSzTest_exec.test_basic!s�������
�
�1�a�rc�0�d}d}|j||�y)Nzexec code in ns�exec(code, ns)rOrPs   r�test_with_globalszTest_exec.test_with_globals&s��!�� ���
�
�1�a�rc�0�d}d}|j||�y)Nzexec code in ns1, ns2�exec(code, ns1, ns2)rOrPs   r�test_with_globals_localsz"Test_exec.test_with_globals_locals+s��'��&���
�
�1�a�rc�0�d}d}|j||�y)Nzexec (a.b()) in nszexec((a.b()), ns)rOrPs   rr�zTest_exec.test_complex_10���$��#���
�
�1�a�rc�0�d}d}|j||�y)Nzexec a.b() + c in nszexec(a.b() + c, ns)rOrPs   rr�zTest_exec.test_complex_25���&��%���
�
�1�a�rc�*�d}|j|�y)Nr�r1r�s  rr�zTest_exec.test_unchanged_1<��������q�rc�*�d}|j|�y)Nzexec (code)r1r�s  rr�zTest_exec.test_unchanged_2@s�������q�rc�*�d}|j|�y)Nr�r1r�s  rr�zTest_exec.test_unchanged_3D��� �����q�rc�*�d}|j|�y)Nr�r1r�s  rr�zTest_exec.test_unchanged_4Hs��&�����q�rN)rHr=rIrr�rSr�rr�r�r�r�r�r�rJrrr�r�s9���E��
�
�
�
�
����rr�c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�	Test_repr�reprc�0�d}d}|j||�y)Nz
x =   `1 + 2`zx =   repr(1 + 2)rOrPs   rr�z"Test_repr.test_prefix_preservationO�����#���
�
�1�a�rc�0�d}d}|j||�y)Nzx = `1 + 2`zx = repr(1 + 2)rOrPs   r�
test_simple_1zTest_repr.test_simple_1Ts����!���
�
�1�a�rc�0�d}d}|j||�y)Nzy = `x`zy = repr(x)rOrPs   r�
test_simple_2zTest_repr.test_simple_2Ys�������
�
�1�a�rc�0�d}d}|j||�y)Nzz = `y`.__repr__()zz = repr(y).__repr__()rOrPs   r�test_complexzTest_repr.test_complex^s��$��(���
�
�1�a�rc�0�d}d}|j||�y)Nz
x = `1, 2, 3`zx = repr((1, 2, 3))rOrPs   rr�zTest_repr.test_tuplec�����%���
�
�1�a�rc�0�d}d}|j||�y)Nz
x = `1 + `2``zx = repr(1 + repr(2))rOrPs   r�test_nestedzTest_repr.test_nestedhs����'���
�
�1�a�rc�0�d}d}|j||�y)Nzx = `1, 2 + `3, 4``zx = repr((1, 2 + repr((3, 4))))rOrPs   r�test_nested_tupleszTest_repr.test_nested_tuplesms��%��1���
�
�1�a�rN)rHr=rIrr�rrrr�rrrJrrrrLs*���E��
�
�
�
�
�
rrc�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�Test_except�exceptc�0�d}d}|j||�y)Nzq
            try:
                pass
            except (RuntimeError, ImportError),    e:
                passzs
            try:
                pass
            except (RuntimeError, ImportError) as    e:
                passrOrPs   rr�z$Test_except.test_prefix_preservationu� ��
��

��
	
�
�
�1�a�rc�0�d}d}|j||�y)NzV
            try:
                pass
            except Foo, e:
                pass�X
            try:
                pass
            except Foo as e:
                passrOrPs   r�test_simplezTest_except.test_simple�r rc�0�d}d}|j||�y)NzU
            try:
                pass
            except Foo,e:
                passr"rOrPs   r�"test_simple_no_space_before_targetz.Test_except.test_simple_no_space_before_target�r rc�0�d}d}|j||�y)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:
                    passrOrPs   r�test_tuple_unpackzTest_except.test_tuple_unpack�s ��
��
��	
�
�
�1�a�rc�0�d}d}|j||�y)Nzn
            try:
                pass
            except (RuntimeError, ImportError), e:
                passzp
            try:
                pass
            except (RuntimeError, ImportError) as e:
                passrOrPs   r�test_multi_classzTest_except.test_multi_class�s ��
��
��
	
�
�
�1�a�rc�0�d}d}|j||�y)Nza
            try:
                pass
            except Exception, [a, b]:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                [a, b] = xxx_todo_changeme.args
                passrOrPs   r�test_list_unpackzTest_except.test_list_unpack�� ��
��
��	
�
�
�1�a�rc�0�d}d}|j||�y)Nz_
            try:
                pass
            except Exception, d[5]:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                d[5] = xxx_todo_changeme
                passrOrPs   r�test_weird_target_1zTest_except.test_weird_target_1�r,rc�0�d}d}|j||�y)Nz`
            try:
                pass
            except Exception, a.foo:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                a.foo = xxx_todo_changeme
                passrOrPs   r�test_weird_target_2zTest_except.test_weird_target_2�r,rc�0�d}d}|j||�y)Nzb
            try:
                pass
            except Exception, a().foo:
                passz�
            try:
                pass
            except Exception as xxx_todo_changeme:
                a().foo = xxx_todo_changeme
                passrOrPs   r�test_weird_target_3zTest_except.test_weird_target_3�r,rc�0�d}d}|j||�y)Nz�
            try:
                pass
            except Exception, a:
                pass
            except:
                passz�
            try:
                pass
            except Exception as a:
                pass
            except:
                passrOrPs   r�test_bare_exceptzTest_except.test_bare_except�s ��
��
��	
�
�
�1�a�rc�0�d}d}|j||�y)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:
                passrOrPs   r�!test_bare_except_and_else_finallyz-Test_except.test_bare_except_and_else_finally
s ��

��

��	
�
�
�1�a�rc�0�d}d}|j||�y)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:
                passrOrPs   r�+test_multi_fixed_excepts_before_bare_exceptz7Test_except.test_multi_fixed_excepts_before_bare_except's ��
��
��	
�
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)	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()
            rOrPs   r�test_one_line_suitesz Test_except.test_one_line_suites=sz��
��

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

��
	
�
�
�1�a��
��
��	
�
�
�1�a��
��
��	
�
�
�1�a�rc�*�d}|j|�y)NzO
            try:
                pass
            except:
                passr1r�s  rr�zTest_except.test_unchanged_1m���
��
	
���q�rc�*�d}|j|�y)NzY
            try:
                pass
            except Exception:
                passr1r�s  rr�zTest_except.test_unchanged_2ur<rc�*�d}|j|�y)Nzg
            try:
                pass
            except (Exception, SystemExit):
                passr1r�s  rr�zTest_except.test_unchanged_3}r<rN)rHr=rIrr�r#r%r'r)r+r.r0r2r4r6r8r:r�r�r�rJrrrrrsX���E�����*�
�
�
�
��$�4�,,�`��rrc�v�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zy)�
Test_raise�raisec�0�d}d}|j||�y)Nzraise Exception, 5�raise Exception(5)rOrPs   rrSzTest_raise.test_basic�s��$��$���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzraise Exception,5rCzraise   Exception,    5zraise   Exception(5)rOrPs   rr�z#Test_raise.test_prefix_preservation�s2��#��$���
�
�1�a��)��&���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)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) # foorOrPs   r�test_with_commentszTest_raise.test_with_comments�sO��*��*���
�
�1�a��0��0���
�
�1�a��
3��
B���
�
�1�a�rc�0�d}d}|j||�y)Nzraise Exception(5), None, tbz%raise Exception(5).with_traceback(tb)rOrPs   r�test_None_valuezTest_raise.test_None_value�s��.��7���
�
�1�a�rc�0�d}d}|j||�y)Nzraise Exception, (5, 6, 7)zraise Exception(5, 6, 7)rOrPs   r�test_tuple_valuezTest_raise.test_tuple_value�s��,��*���
�
�1�a�rc�0�d}d}|j||�y)Nzraise E, (5, 6) % (a, b)zraise E((5, 6) % (a, b))rOrPs   r�test_tuple_detectionzTest_raise.test_tuple_detection�s��*��*���
�
�1�a�rc�0�d}d}|j||�y)Nzraise (((E1, E2), E3), E4), V�raise E1(V)rOrPs   r�test_tuple_exc_1zTest_raise.test_tuple_exc_1�s��/�����
�
�1�a�rc�0�d}d}|j||�y)Nzraise (E1, (E2, E3), E4), VrNrOrPs   r�test_tuple_exc_2zTest_raise.test_tuple_exc_2�s��-�����
�
�1�a�rc�,�d}|j|d�y)Nzraise 'foo'�+Python 3 does not support string exceptions�r3r�s  r�test_string_exczTest_raise.test_string_exc�s�������Q� M�Nrc�,�d}|j|d�y)Nzraise "foo", 5rSrTr�s  r�test_string_exc_valzTest_raise.test_string_exc_val���� �����Q� M�Nrc�,�d}|j|d�y)Nzraise "foo", 5, 6rSrTr�s  r�test_string_exc_val_tbz!Test_raise.test_string_exc_val_tb����#�����Q� M�Nrc�0�d}d}|j||�y)Nz4def foo():
                    raise Exception, 5, 6�Cdef foo():
                    raise Exception(5).with_traceback(6)rOrPs   r�	test_tb_1zTest_raise.test_tb_1�s��
-��
<���
�
�1�a�rc�0�d}d}|j||�y)Nzhdef foo():
                    a = 5
                    raise Exception, 5, 6
                    b = 6�wdef foo():
                    a = 5
                    raise Exception(5).with_traceback(6)
                    b = 6rOrPs   r�	test_tb_2zTest_raise.test_tb_2�� ��
��
��	
�
�
�1�a�rc�0�d}d}|j||�y)Nz2def foo():
                    raise Exception,5,6r]rOrPs   r�	test_tb_3zTest_raise.test_tb_3�s��
+��
<���
�
�1�a�rc�0�d}d}|j||�y)Nzfdef foo():
                    a = 5
                    raise Exception,5,6
                    b = 6r`rOrPs   r�	test_tb_4zTest_raise.test_tb_4�rbrc�0�d}d}|j||�y)Nz<def foo():
                    raise Exception, (5, 6, 7), 6zIdef foo():
                    raise Exception(5, 6, 7).with_traceback(6)rOrPs   r�	test_tb_5zTest_raise.test_tb_5�s��
5��
B���
�
�1�a�rc�0�d}d}|j||�y)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 = 6rOrPs   r�	test_tb_6zTest_raise.test_tb_6�rbrN)rHr=rIrrSr�rFrHrJrLrOrQrUrWrZr^rardrfrhrjrJrrr@r@�s_���E��
�
��
�
�
�
�O�O�O��	��	��	rr@c�|�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
Test_throw�throwc�0�d}d}|j||�y)Nzg.throw(Exception, 5)�g.throw(Exception(5))rOrPs   rr]zTest_throw.test_1s��'��'���
�
�1�a�rc�0�d}d}|j||�y)Nzg.throw(Exception,5)rorOrPs   rr_zTest_throw.test_2s��&��'���
�
�1�a�rc�0�d}d}|j||�y)Nzg.throw(Exception, (5, 6, 7))zg.throw(Exception(5, 6, 7))rOrPs   rrbzTest_throw.test_3s��/��-���
�
�1�a�rc�0�d}d}|j||�y)Nz5 + g.throw(Exception, 5)z5 + g.throw(Exception(5))rOrPs   rrdzTest_throw.test_4s��+��+���
�
�1�a�rc�,�d}|j|d�y)Nzg.throw("foo")rSrTr�s  r�test_warn_1zTest_throw.test_warn_1rXrc�,�d}|j|d�y)Nzg.throw("foo", 5)rSrTr�s  r�test_warn_2zTest_throw.test_warn_2!r[rc�,�d}|j|d�y)Nzg.throw("foo", 5, 6)rSrTr�s  r�test_warn_3zTest_throw.test_warn_3%s��&�����Q� M�Nrc�*�d}|j|�y)Nzg.throw(Exception)r1r�s  r�test_untouched_1zTest_throw.test_untouched_1+���$�����q�rc�*�d}|j|�y)Nzg.throw(Exception(5, 6))r1r�s  r�test_untouched_2zTest_throw.test_untouched_2/s��*�����q�rc�*�d}|j|�y)Nz5 + g.throw(Exception(5, 6))r1r�s  r�test_untouched_3zTest_throw.test_untouched_33r�rc�0�d}d}|j||�y)Nz7def foo():
                    g.throw(Exception, 5, 6)�Fdef foo():
                    g.throw(Exception(5).with_traceback(6))rOrPs   rr^zTest_throw.test_tb_19s��
0��
?���
�
�1�a�rc�0�d}d}|j||�y)Nzkdef foo():
                    a = 5
                    g.throw(Exception, 5, 6)
                    b = 6�zdef foo():
                    a = 5
                    g.throw(Exception(5).with_traceback(6))
                    b = 6rOrPs   rrazTest_throw.test_tb_2@rbrc�0�d}d}|j||�y)Nz5def foo():
                    g.throw(Exception,5,6)r�rOrPs   rrdzTest_throw.test_tb_3Ks��
.��
?���
�
�1�a�rc�0�d}d}|j||�y)Nzidef foo():
                    a = 5
                    g.throw(Exception,5,6)
                    b = 6r�rOrPs   rrfzTest_throw.test_tb_4Rrbrc�0�d}d}|j||�y)Nz?def foo():
                    g.throw(Exception, (5, 6, 7), 6)zLdef foo():
                    g.throw(Exception(5, 6, 7).with_traceback(6))rOrPs   rrhzTest_throw.test_tb_5]s��
8��
E���
�
�1�a�rc�0�d}d}|j||�y)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 = 6rOrPs   rrjzTest_throw.test_tb_6drbrc�0�d}d}|j||�y)Nz;def foo():
                    a + g.throw(Exception, 5, 6)zJdef foo():
                    a + g.throw(Exception(5).with_traceback(6))rOrPs   r�	test_tb_7zTest_throw.test_tb_7os��
4��
C���
�
�1�a�rc�0�d}d}|j||�y)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 = 6rOrPs   r�	test_tb_8zTest_throw.test_tb_8vrbrN)rHr=rIrr]r_rbrdrtrvrxrzr}rr^rardrfrhrjr�r�rJrrrlrlsd���E��
�
�
�O�O�O�����	��	��	��	rrlc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�	Test_long�longc�0�d}d}|j||�y)Nzx = long(x)z
x = int(x)rOrPs   rr]zTest_long.test_1�s�������
�
�1�a�rc�0�d}d}|j||�y)Nzy = isinstance(x, long)zy = isinstance(x, int)rOrPs   rr_zTest_long.test_2����)��(���
�
�1�a�rc�0�d}d}|j||�y)Nzz = type(x) in (int, long)zz = type(x) in (int, int)rOrPs   rrbzTest_long.test_3�s��,��+���
�
�1�a�rc��d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)Nzlong = Truez
s.long = Truezdef long(): passzclass long(): passzdef f(long): passzdef f(g, long): passzdef f(x, long=True): passr1r�s  rr�zTest_long.test_unchanged�sy�������q�������q��"�����q��$�����q��#�����q��&�����q��+�����q�rc�0�d}d}|j||�y)Nzx =   long(  x  )zx =   int(  x  )rOrPs   rr�z"Test_long.test_prefix_preservation����#��"���
�
�1�a�rN)	rHr=rIrr]r_rbr�r�rJrrr�r��s ���E��
�
�
�,rr�c��eZdZdZd�Zd�Zy)�
Test_execfile�execfilec��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�d}d}|j||�y)
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)rOrPs   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�\�d}d}|j||�d}d}|j||�y)Nzexecfile( "fn" )z6exec(compile(open( "fn", "rb" ).read(), "fn", 'exec'))zexecfile("fn",  globals = glob)zEexec(compile(open("fn", "rb").read(), "fn", 'exec'),  globals = glob)rOrPs   r�test_spacingzTest_execfile.test_spacing�s2��"��H���
�
�1�a��1��W���
�
�1�a�rN)rHr=rIrr�r�rJrrr�r��s���E��2rr�c�"�eZdZdZd�Zd�Zd�Zy)�Test_isinstance�
isinstancec��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)	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))rOrPs   r�test_remove_multiple_itemsz*Test_isinstance.test_remove_multiple_items�sb��0��$���
�
�1�a��>��-���
�
�1�a��C��2���
�
�1�a��F��A���
�
�1�a�rc�0�d}d}|j||�y)Nz4if    isinstance(  foo(), (  bar, bar, baz )) : passz/if    isinstance(  foo(), (  bar, baz )) : passrOrPs   rr�z(Test_isinstance.test_prefix_preservation�s��F��A���
�
�1�a�rc�&�|jd�y)Nzisinstance(x, (str, int))r1�rs rr�zTest_isinstance.test_unchanged�s�����2�3rN)rHr=rIrr�r�r�rJrrr�r��s���E��"�
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&y%)&�	Test_dict�dictc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�d}d}|j||�y)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(  )  ]rOrPs   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}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d}|j||�y)
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()  # foorOrPs   r�test_trailing_commentzTest_dict.test_trailing_comment
s�����"���
�
�1�a����$���
�
�1�a��!��#���
�
�1�a��
��
���
�
�1�a��
��
���
�
�1�a��"�����
�
�1�a�rc��tjD]D}d|z}|j|�d|z}|j|�d|z}|j|��Fy)Nzs = %s(d.keys())zs = %s(d.values())zs = %s(d.items())�r�consuming_callsr.)r�wrapperr�s   rr�zTest_dict.test_unchanged*sT��!�1�1�G�"�W�,�A��N�N�1��$�w�.�A��N�N�1��#�g�-�A��N�N�1��2rc�\�d}d}|j||�d}d}|j||�y)N�d.keys()�list(d.keys())za[0].foo().keys()zlist(a[0].foo().keys())rOrPs   r�test_01zTest_dict.test_015s2�������
�
�1�a����%���
�
�1�a�rc�0�d}d}|j||�y)N�	d.items()zlist(d.items())rOrPs   r�test_02zTest_dict.test_02>s�������
�
�1�a�rc�0�d}d}|j||�y)N�
d.values()zlist(d.values())rOrPs   r�test_03zTest_dict.test_03Cs�������
�
�1�a�rc�0�d}d}|j||�y)Nzd.iterkeys()�iter(d.keys())rOrPs   r�test_04zTest_dict.test_04Hs�������
�
�1�a�rc�0�d}d}|j||�y)Nz
d.iteritems()ziter(d.items())rOrPs   r�test_05zTest_dict.test_05Ms�������
�
�1�a�rc�0�d}d}|j||�y)Nzd.itervalues()ziter(d.values())rOrPs   r�test_06zTest_dict.test_06Rs�������
�
�1�a�rc�*�d}|j|�y)Nr�r1r�s  r�test_07zTest_dict.test_07Wrrc�*�d}|j|�y)N�sorted(d.keys())r1r�s  r�test_08zTest_dict.test_08[s�������q�rc�0�d}d}|j||�y)Nr�ziter(list(d.keys()))rOrPs   r�test_09zTest_dict.test_09_s����"���
�
�1�a�rc�0�d}d}|j||�y)Nz
foo(d.keys())zfoo(list(d.keys()))rOrPs   rrszTest_dict.test_10ds����!���
�
�1�a�rc�0�d}d}|j||�y)N�for i in d.keys(): print iz for i in list(d.keys()): print irOrPs   rruzTest_dict.test_11is��(��.���
�
�1�a�rc�0�d}d}|j||�y)Nzfor i in d.iterkeys(): print ir�rOrPs   r�test_12zTest_dict.test_12ns��,��(���
�
�1�a�rc�0�d}d}|j||�y)N�[i for i in d.keys()]z for i in list(d.keys())]rOrPs   r�test_13zTest_dict.test_13s���#��)���
�
�1�a�rc�0�d}d}|j||�y)Nz[i for i in d.iterkeys()]r�rOrPs   r�test_14zTest_dict.test_14xrgrc�0�d}d}|j||�y)N�(i for i in d.keys())z(i for i in list(d.keys()))rOrPs   r�test_15zTest_dict.test_15}r�rc�0�d}d}|j||�y)Nz(i for i in d.iterkeys())r�rOrPs   r�test_16zTest_dict.test_16�rgrc�0�d}d}|j||�y)Nziter(d.iterkeys())r�rOrPs   r�test_17zTest_dict.test_17���� �����
�
�1�a�rc�0�d}d}|j||�y)Nzlist(d.iterkeys())r�rOrPs   r�test_18zTest_dict.test_18�r�rc�0�d}d}|j||�y)Nzsorted(d.iterkeys())r�rOrPs   r�test_19zTest_dict.test_19����"�����
�
�1�a�rc�0�d}d}|j||�y)Nzfoo(d.iterkeys())zfoo(iter(d.keys()))rOrPs   r�test_20zTest_dict.test_20�s����!���
�
�1�a�rc�0�d}d}|j||�y)Nzprint h.iterkeys().next()zprint iter(h.keys()).next()rOrPs   r�test_21zTest_dict.test_21�s��'��)���
�
�1�a�rc�0�d}d}|j||�y)Nzprint h.keys()[0]zprint list(h.keys())[0]rOrPs   r�test_22zTest_dict.test_22�rrc�0�d}d}|j||�y)Nzprint list(h.iterkeys().next())z!print list(iter(h.keys()).next())rOrPs   r�test_23zTest_dict.test_23�s��-��/���
�
�1�a�rc�0�d}d}|j||�y)Nzfor x in h.keys()[0]: print xz#for x in list(h.keys())[0]: print xrOrPs   r�test_24zTest_dict.test_24�s��+��1���
�
�1�a�rc�0�d}d}|j||�y)Nzd.viewkeys()r�rOrPs   r�test_25zTest_dict.test_25�s�������
�
�1�a�rc�0�d}d}|j||�y)Nz
d.viewitems()r�rOrPs   r�test_26zTest_dict.test_26�s�������
�
�1�a�rc�0�d}d}|j||�y)Nzd.viewvalues()r�rOrPs   r�test_27zTest_dict.test_27�s�������
�
�1�a�rc�0�d}d}|j||�y)Nz[i for i in d.viewkeys()]r�rOrPs   r�test_28zTest_dict.test_28�rgrc�0�d}d}|j||�y)Nz(i for i in d.viewkeys())r�rOrPs   r�test_29zTest_dict.test_29�rgrc�0�d}d}|j||�y)Nziter(d.viewkeys())r�rOrPs   r�test_30zTest_dict.test_30�r�rc�0�d}d}|j||�y)Nzlist(d.viewkeys())r�rOrPs   r�test_31zTest_dict.test_31�r�rc�0�d}d}|j||�y)Nzsorted(d.viewkeys())r�rOrPs   r�test_32zTest_dict.test_32�r�rN)'rHr=rIrr�r�r�r�r�r�r�r�r�r�r�r�rsrur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rJrrr�r��s����E��2�:	���
�
�
�
�
���
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
rr�c�F�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�Test_xrange�xrangec��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzx =    xrange(  10  )zx =    range(  10  )zx = xrange(  1  ,  10   )zx = range(  1  ,  10   )zx = xrange(  0  ,  10 ,  2 )zx = range(  0  ,  10 ,  2 )rOrPs   rr�z$Test_xrange.test_prefix_preservation�sJ��'��&���
�
�1�a��+��*���
�
�1�a��.��-���
�
�1�a�rc�0�d}d}|j||�y)Nzx = xrange(10)z
x = range(10)rOrPs   r�test_single_argzTest_xrange.test_single_arg���� �����
�
�1�a�rc�0�d}d}|j||�y)Nzx = xrange(1, 10)zx = range(1, 10)rOrPs   r�
test_two_argszTest_xrange.test_two_args�r�rc�0�d}d}|j||�y)Nzx = xrange(0, 10, 2)zx = range(0, 10, 2)rOrPs   r�test_three_argszTest_xrange.test_three_args�rrc���d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�y)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]rOrPs   r�test_wrap_in_listzTest_xrange.test_wrap_in_list�sz��%��+���
�
�1�a��*��0���
�
�1�a��+��1���
�
�1�a��%��+���
�
�1�a��$��*���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)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)]rOrPs   r�test_xrange_in_forzTest_xrange.test_xrange_in_fors2��/��.���
�
�1�a��)��(���
�
�1�a�rc�H�|jd�|jd�y)Nzfor i in range(10): passrr1r�s r�test_range_in_forzTest_xrange.test_range_in_fors�����1�2����/�0rc�&�|jd�y)Nzx in range(10, 3, 9)r1r�s r�test_in_contains_testz!Test_xrange.test_in_contains_tests�����-�.rc�V�tjD]}|jd|z��y)Nza = %s(range(10))r�)r�calls  r�test_in_consuming_contextz%Test_xrange.test_in_consuming_contexts$���.�.�D��N�N�.��5�6�/rN)
rHr=rIrr�r�rrrrr
rrrJrrr�r��s4���E���
�
�
�*�1�/�7rr�c�$��eZdZ�fd�Zd�Z�xZS)�Test_xrange_with_reducec�0��tt|�ddg�y)Nr�r�)�superrr)rr<s �rrzTest_xrange_with_reduce.setUp!s���
�%�t�2�H�h�3G�Hrc�0�d}d}|j||�y)Nzreduce(x, xrange(5))z0from functools import reduce
reduce(x, range(5))rOrPs   r�test_double_transformz-Test_xrange_with_reduce.test_double_transform$s��&��
���
�
�1�a�r)rHr=rIrr�
__classcell__�r<s@rrrs���I�rrc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�Test_raw_input�	raw_inputc�\�d}d}|j||�d}d}|j||�y)Nzx =    raw_input(   )zx =    input(   )zx = raw_input(   ''   )�x = input(   ''   )rOrPs   rr�z'Test_raw_input.test_prefix_preservation-s2��'��#���
�
�1�a��)��%���
�
�1�a�rc�0�d}d}|j||�y)Nzx = raw_input()�x = input()rOrPs   rr]zTest_raw_input.test_16s��!�����
�
�1�a�rc�0�d}d}|j||�y)Nzx = raw_input('')�
x = input('')rOrPs   rr_zTest_raw_input.test_2;s��#�����
�
�1�a�rc�0�d}d}|j||�y)Nzx = raw_input('prompt')�x = input('prompt')rOrPs   rrbzTest_raw_input.test_3@s��)��%���
�
�1�a�rc�0�d}d}|j||�y)Nzx = raw_input(foo(a) + 6)zx = input(foo(a) + 6)rOrPs   rrdzTest_raw_input.test_4Ermrc�0�d}d}|j||�y)Nzx = raw_input(invite).split()zx = input(invite).split()rOrPs   rrfzTest_raw_input.test_5Jr`rc�0�d}d}|j||�y)Nz x = raw_input(invite) . split ()zx = input(invite) . split ()rOrPs   rrizTest_raw_input.test_6Or|rc�0�d}d}|j||�y)Nzx = int(raw_input())zx = int(input())rOrPs   rrozTest_raw_input.test_8Tr�rN)rHr=rIrr�r]r_rbrdrfrirorJrrrr*s/���E���
�
�
�
�
�
rrc�$�eZdZdZgd�Zd�Zd�Zy)�Test_funcattrs�	funcattrs)�closure�doc�name�defaults�code�globalsr�c��|jD]:}d|z}d|z}|j||�d|z}d|z}|j||��<y)Nz	a.func_%s�a.__%s__zself.foo.func_%s.foo_bar�self.foo.__%s__.foo_bar��attrsr(�r�attrrQrRs    rr�zTest_funcattrs.test^sT���J�J�D��d�"�A��T�!�A��J�J�q�!��*�T�1�A�)�D�0�A��J�J�q�!��rc��|jD]D}d|z}|j|�d|z}|j|�d|z}|j|��Fy)Nzfoo(func_%s + 5)�
f(foo.__%s__)�f(foo.__%s__.foo)�r4r.�rr6r�s   rr�zTest_funcattrs.test_unchangedhsR���J�J�D�"�T�)�A��N�N�1���$�&�A��N�N�1��#�d�*�A��N�N�1��rN�rHr=rIrr4r�r�rJrrr(r(Ys���E�M�E��	rr(c�"�eZdZdZd�Zd�Zd�Zy)�Test_xreadlines�
xreadlinesc��d}d}|j||�d}d}|j||�d}d}|j||�y)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()): passrOrPs   rr�zTest_xreadlines.test_callvsJ��+�����
�
�1�a��/��"���
�
�1�a��5��(���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)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)rOrPs   r�
test_attr_refzTest_xreadlines.test_attr_ref�sJ��#��!���
�
�1�a��%��#���
�
�1�a��+��)���
�
�1�a�rc��d}|j|�d}|j|�d}|j|�d}|j|�y)Nzfor x in f.xreadlines(5): passz for x in f.xreadlines(k=5): passz$for x in f.xreadlines(*k, **v): passzfoo(xreadlines)r1r�s  rr�zTest_xreadlines.test_unchanged�sF��,�����q��.�����q��2�����q�������q�rN)rHr=rIrr�rBr�rJrrr>r>ss���E���rr>c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�ImportsFixerTestsc��|jj�D]=\}}d|z}d|z}|j||�d|z}d|z}|j||��?y)N�	import %szimport foo, %s, bar��modules�itemsr(�r�old�newrQrRs     r�test_import_modulez$ImportsFixerTests.test_import_module�sa�����*�*�,�H�C���c�!�A��c�!�A��J�J�q�!��%��+�A�%��+�A��J�J�q�!��-rc���|jj�D]Y\}}d|z}d|z}|j||�d|z}d|z}|j||�d|z}d|z}|j||��[y)Nzfrom %s import foozfrom %s import foo, barzfrom %s import (yes, no)rHrKs     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��|jj�D]=\}}d|z}d|z}|j||�d|z}d|z}|j||��?y)Nzimport %s as foo_barrHrKs     r�test_import_module_asz'ImportsFixerTests.test_import_module_as�sa�����*�*�,�H�C��&��,�A�&��,�A��J�J�q�!��&��,�A�&��,�A��J�J�q�!��-rc��|jj�D]!\}}d|z}d|z}|j||��#y)Nzfrom %s import foo as barrHrKs     r�test_import_from_asz%ImportsFixerTests.test_import_from_as�s?�����*�*�,�H�C��+�c�1�A�+�c�1�A��J�J�q�!��-rc��|jj�D]!\}}d|z}d|z}|j||��#y)N�from %s import *rHrKs     r�	test_starzImportsFixerTests.test_star�s?�����*�*�,�H�C��"�S�(�A�"�S�(�A��J�J�q�!��-rc��|jj�D]�\}}d|�d|�d�}d|�d|�d�}|j||�d|�d|�d�}d|�d|�d�}|j||�d|�d�}|j|�d|�d	|�d
|�d�}d|�d	|�d
|�d�}|j||�d|�d|�d	�}d|�d|�d	�}|j||���y)
N�
                import �
                foo(z.bar)
                �
                from z import x
                z = 23
                z.
                def f():
                    z.method()
                z
                z.bar(z.foo)
                z
                x.)rIrJr(r.)rrLrMrQrRr�s      r�test_import_module_usagez*ImportsFixerTests.test_import_module_usage�s������*�*�,�H�C���C�!�A��C�!�A�
�J�J�q�!��
�C�!�A��C�!�A�
�J�J�q�!��
��A�
�N�N�1���C��&�A��C��&�A�
�J�J�q�!��
�C�!�A��C�!�A�
�J�J�q�!��]-rN)	rHr=rIrNrPrRrTrWr\rJrrrErE�s �������/rrEc�(�eZdZdZddlmZd�Zd�Zy)�Test_imports�importsr��MAPPINGc�0�d}d}|j||�y)Nzimport urlparse, cStringIOzimport urllib.parse, iorOrPs   r�test_multiple_importsz"Test_imports.test_multiple_importss��,��)���
�
�1�a�rc�0�d}d}|j||�y)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())
            rOrPs   r�test_multiple_imports_asz%Test_imports.test_multiple_imports_as	� ��
��
��	
�
�
�1�a�rN)	rHr=rIr�lib2to3.fixes.fix_importsrarIrcrerJrrr^r^s���E�<��
	rr^c��eZdZdZddlmZy)�
Test_imports2�imports2rr`N)rHr=rIr�lib2to3.fixes.fix_imports2rarIrJrrriris
���E�=rric�$��eZdZ�fd�Zd�Z�xZS)�Test_imports_fixer_orderc���tt|�ddg�ddlm}|j�|_ddlm}dD]}|||j|<�y)Nr_rjrr`)�dbhash�dumbdbm�dbm�gdbm)rrmrrkra�copyrIrg)r�mapping2�mapping1�keyr<s    �rrzTest_imports_fixer_order.setUpsG���
�&��3�Y�
�4K�L�B��}�}����A�7�C� (��
�D�L�L���8rc�B�dD]}||_|jd��y)N)r_rj�import)rrG)r�fixs  r�$test_after_local_imports_refactoringz=Test_imports_fixer_order.test_after_local_imports_refactoring$s!��*�C��D�J��"�"�8�,�+r)rHr=rIrrzrrs@rrmrms
���.�-rrmc�L�eZdZdZddlmZd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)
�Test_urllib�urllibrr`c	���|jj�D]C\}}d|z}ddjtt	d�|��z}|j||��Ey)NrGr9r)rIrJr,�maprr()rrL�changesrQrRs     rrNzTest_urllib.test_import_module.sS�� �L�L�.�.�0�L�C���c�!�A��d�i�i��J�q�M�7�(C�D�D�A��J�J�q�!��1rc
��|jj�D�])\}}g}|D]�\}}|D]K}|j|�d|�d|��}d|�d|��}|j||�d|z}	|j	|	��Md|�ddj|���}d|�ddj|���}|j||�ddj|�z}	|j	|	���d|�ddj|���}dj|D��cgc]\}}d|�ddj|�����c}}�}|j||���,ycc}}w)N�from � import �from foo import %sr9�
)rIrJ�appendr(r.r,)
rrLr��all_membersrM�members�memberrQrRr�s
          rrPzTest_urllib.test_import_from4s8�� �L�L�.�.�0�L�C���K� '���W�%�F��&�&�v�.�/2�F�;�A�/2�F�;�A��J�J�q�!�$�,�v�5�A��N�N�1�%�&�,/��	�	�'�0B�C��+.��	�	�'�0B�C���
�
�1�a� �(�4�9�9�W�+=�=�����q�!�!(�$(+�D�I�I�k�,B�C�A��	�	�29�;�29���g�36�t�y�y��7I�J�29�;�<�A��J�J�q�!��/1��*;s�
!E	c�T�|jD]}d|z}|j|d��y)Nzimport %s as fooz#This module is now multiple modules�rIr3�rrLr�s   rrRz!Test_urllib.test_import_module_asNs+���<�<�C�"�S�(�A�� � ��$I�J� rc	��|jj�D]b\}}|D]X\}}|D]N}d|�d|�d�}d|�d|�d�}|j||�d|�d|�d|��}d|�d|�d|��}|j||��P�Z�dy)Nr�r�� as foo_barz
 as blah, rH)rrLr�rMr�r�rQrRs        rrTzTest_urllib.test_import_from_asSs}�� �L�L�.�.�0�L�C�� '���W�%�F�:=�v�F�A�:=�v�F�A��J�J�q�!�$�;>���O�A�;>���O�A��J�J�q�!�$�
&�!(�1rc�T�|jD]}d|z}|j|d��y)NrVzCannot handle star importsr�r�s   rrWzTest_urllib.test_star^s+���<�<�C�"�S�(�A�� � ��$@�A� rc�\�d}d}|j||�d}d}|j||�y)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
rOrPs   r�
test_indentedzTest_urllib.test_indentedcs>��
��
��
	
�
�
�1�a��
��

��	
�
�
�1�a�rc�0�d}d}|j||�y)Nzfrom urllib import getproxiesz%from urllib.request import getproxiesrOrPs   r�test_single_importzTest_urllib.test_single_import|s��+��3���
�
�1�a�rc��|jj�D]�\}}|D]�\}}|D]�}dj|j|D��cgc]\}}|��	c}}�}d|�d|�d|�d�}	d|�d|�d|�d�}
|j|	|
�d|�d|�d|�d|�d|�d�}	d|�d|�d|�d|�d|�d�}
|j|	|
�������ycc}}w)Nr9z 
                        import z
                        foo(�.z)
                        z
                        �()rIrJr,r()rrLr�rMr�r�rE�mems�
new_importrQrRs           rr\z$Test_urllib.test_import_module_usage�s��� �L�L�.�.�0�L�C�� '���W�%�F�!%���/3�|�|�C�/@�,B�/@�3<�1�d�A�/@�,B�"C�J�
 #�C��1�A� *�3��8�A��J�J�q�!�$� #�C���f�>�A� *�3���V�E�A��J�J�q�!�$�)&�!(�1��,Bs�CN)rHr=rIr�lib2to3.fixes.fix_urllibrarIrNrPrRrTrWr�r�r\rJrrr|r|*s4���E�;���4K�
	%�B�
�2�%rr|c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�
Test_input�inputc�\�d}d}|j||�d}d}|j||�y)Nzx =   input(   )zx =   eval(input(   ))rzx = eval(input(   ''   ))rOrPs   rr�z#Test_input.test_prefix_preservation�s2��"��(���
�
�1�a��%��+���
�
�1�a�rc�0�d}d}|j||�y)Nzx = input()  #  foozx = eval(input())  #  foorOrPs   rr�z Test_input.test_trailing_comment����%��+���
�
�1�a�rc�v�d}|j|�d}|j|�d}|j|�y)N�x = eval(input())�x = eval(input(''))�x = eval(input(foo(5) + 9))r1r�s  rr�zTest_input.test_idempotency�s5��#�����q��%�����q��-�����q�rc�0�d}d}|j||�y)Nrr�rOrPs   rr]zTest_input.test_1�s����#���
�
�1�a�rc�0�d}d}|j||�y)Nr r�rOrPs   rr_zTest_input.test_2�rrc�0�d}d}|j||�y)Nr"zx = eval(input('prompt'))rOrPs   rrbzTest_input.test_3�r�rc�0�d}d}|j||�y)Nzx = input(foo(5) + 9)r�rOrPs   rrdzTest_input.test_4�s��'��-���
�
�1�a�rN)rHr=rIrr�r�r�r]r_rbrdrJrrr�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�Zy)�Test_tuple_params�tuple_paramsc�*�d}|j|�y)Nzdef foo(): passr1r�s  rr�z"Test_tuple_params.test_unchanged_1�r�rc�*�d}|j|�y)Nzdef foo(a, b, c): passr1r�s  rr�z"Test_tuple_params.test_unchanged_2�s��(�����q�rc�*�d}|j|�y)Nzdef foo(a=3, b=4, c=5): passr1r�s  rr�z"Test_tuple_params.test_unchanged_3�r�rc�0�d}d}|j||�y)Nz8
            def foo(((a, b), c)):
                x = 5zn
            def foo(xxx_todo_changeme):
                ((a, b), c) = xxx_todo_changeme
                x = 5rOrPs   rr]zTest_tuple_params.test_1�� ��
��
��	
�
�
�1�a�rc�0�d}d}|j||�y)Nz;
            def foo(((a, b), c), d):
                x = 5zq
            def foo(xxx_todo_changeme, d):
                ((a, b), c) = xxx_todo_changeme
                x = 5rOrPs   rr_zTest_tuple_params.test_2�r�rc�0�d}d}|j||�y)Nz@
            def foo(((a, b), c), d) -> e:
                x = 5zv
            def foo(xxx_todo_changeme, d) -> e:
                ((a, b), c) = xxx_todo_changeme
                x = 5rOrPs   rrbzTest_tuple_params.test_3�r�rc�0�d}d}|j||�y)Nz/
            def foo(((a, b), c)): x = 5; y = 7zV
            def foo(xxx_todo_changeme): ((a, b), c) = xxx_todo_changeme; x = 5; y = 7rOrPs   r�test_semicolonz Test_tuple_params.test_semicolon�s��
2��
Y���
�
�1�a�rc�0�d}d}|j||�y)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 = 5rOrPs   r�
test_keywordszTest_tuple_params.test_keywordsr�rc�0�d}d}|j||�y)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 = 5rOrPs   r�test_varargszTest_tuple_params.test_varargsr�rc�0�d}d}|j||�y)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 = 5rOrPs   r�test_multi_1zTest_tuple_params.test_multi_1� ��
��
��
	
�
�
�1�a�rc�0�d}d}|j||�y)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 = 5rOrPs   r�test_multi_2zTest_tuple_params.test_multi_2%r�rc�0�d}d}|j||�y)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 = 5rOrPs   r�test_docstringz Test_tuple_params.test_docstring1s ��
��

��	
�
�
�1�a�rc�*�d}|j|�y)N�lambda x: x + 5r1r�s  r�test_lambda_no_changez'Test_tuple_params.test_lambda_no_change?r�rc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)Nzlambda (x): x + 5r�zlambda(x): x + 5zlambda ((((x)))): x + 5zlambda((((x)))): x + 5rOrPs   r�test_lambda_parens_single_argz/Test_tuple_params.test_lambda_parens_single_argCsb��#��!���
�
�1�a��"��!���
�
�1�a��)��!���
�
�1�a��(��!���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)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)rOrPs   r�test_lambda_simplez$Test_tuple_params.test_lambda_simpleTsb��)��0���
�
�1�a��(��0���
�
�1�a��-��0���
�
�1�a��,��0���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzlambda (x,): x + f(x)zlambda x1: x1[0] + f(x1[0])zlambda (((x,))): x + f(x)rOrPs   r�test_lambda_one_tuplez'Test_tuple_params.test_lambda_one_tuplees2��'��-���
�
�1�a��+��-���
�
�1�a�rc�0�d}d}|j||�y)Nzlambda (x, y): x + x + f(x) + xz0lambda x_y: x_y[0] + x_y[0] + f(x_y[0]) + x_y[0]rOrPs   r�test_lambda_simple_multi_usez.Test_tuple_params.test_lambda_simple_multi_usens��1��B���
�
�1�a�rc�0�d}d}|j||�y)Nzlambda (x, y): y + xzlambda x_y: x_y[1] + x_y[0]rOrPs   r�test_lambda_simple_reversez,Test_tuple_params.test_lambda_simple_reversess��&��-���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)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 + zrOrPs   r�test_lambda_nestedz$Test_tuple_params.test_lambda_nestedxs2��/��D���
�
�1�a��3��D���
�
�1�a�rc�0�d}d}|j||�y)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])rOrPs   r�test_lambda_nested_multi_usez.Test_tuple_params.test_lambda_nested_multi_use�s��2��G���
�
�1�a�rN)rHr=rIrr�r�r�r]r_rbr�r�r�r�r�r�r�r�r�r�r�r�r�r�rJrrr�r��sk���E����	�	�	��	�	�
�
����"�"��
�
�rr�c�$�eZdZdZgd�Zd�Zd�Zy)�Test_methodattrs�methodattrs)�funcr�classc��|jD]J}d|z}|dk(rd}nd|z}|j||�d|z}|dk(rd}nd|z}|j||��Ly)Nza.im_%sr�za.__self__.__class__r1zself.foo.im_%s.foo_barz#self.foo.__self__.__class__.foo_barr2r3r5s    rr�zTest_methodattrs.test�sl���J�J�D��D� �A��w��*����%���J�J�q�!��(�4�/�A��w��9��-��4���J�J�q�!��rc��|jD]D}d|z}|j|�d|z}|j|�d|z}|j|��Fy)Nzfoo(im_%s + 5)r8r9r:r;s   rr�zTest_methodattrs.test_unchanged�sR���J�J�D� �4�'�A��N�N�1���$�&�A��N�N�1��#�d�*�A��N�N�1��rNr<rJrrr�r��s���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.�Z0y/)0�	Test_next�nextc�0�d}d}|j||�y)Nz	it.next()znext(it)rOrPs   rr]zTest_next.test_1���������
�
�1�a�rc�0�d}d}|j||�y)Nza.b.c.d.next()z
next(a.b.c.d)rOrPs   rr_zTest_next.test_2�r�rc�0�d}d}|j||�y)Nz(a + b).next()z
next((a + b))rOrPs   rrbzTest_next.test_3�r�rc�0�d}d}|j||�y)Nz
a().next()z	next(a())rOrPs   rrdzTest_next.test_4���������
�
�1�a�rc�0�d}d}|j||�y)Nza().next() + bz
next(a()) + brOrPs   rrfzTest_next.test_5�r�rc�0�d}d}|j||�y)Nzc(      a().next() + b)zc(      next(a()) + b)rOrPs   rrizTest_next.test_6�r�rc�0�d}d}|j||�y)NzU
            for a in b:
                foo(a)
                a.next()
            zT
            for a in b:
                foo(a)
                next(a)
            rOrPs   r�test_prefix_preservation_1z$Test_next.test_prefix_preservation_1�� ��
��

��
	
�
�
�1�a�rc�0�d}d}|j||�y)Nzq
            for a in b:
                foo(a) # abc
                # def
                a.next()
            zp
            for a in b:
                foo(a) # abc
                # def
                next(a)
            rOrPs   r�test_prefix_preservation_2z$Test_next.test_prefix_preservation_2�s ��
��
��	
�
�
�1�a�rc�4�d}d}|j||d��y)Nzj
            next = 5
            for a in b:
                foo(a)
                a.next()
            zn
            next = 5
            for a in b:
                foo(a)
                a.__next__()
            T�r'rOrPs   r�test_prefix_preservation_3z$Test_next.test_prefix_preservation_3��$��
��
��	
�
�
�1�a��
�.rc�4�d}d}|j||d��y)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�rOrPs   r�test_prefix_preservation_4z$Test_next.test_prefix_preservation_4�s$��
��
��	
�
�
�1�a��
�.rc�4�d}d}|j||d��y)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�rOrPs   r�test_prefix_preservation_5z$Test_next.test_prefix_preservation_5	r�rc�0�d}d}|j||�y)Nze
            for a in b:
                foo(foo(a), # abc
                    a.next())
            zd
            for a in b:
                foo(foo(a), # abc
                    next(a))
            rOrPs   r�test_prefix_preservation_6z$Test_next.test_prefix_preservation_6	r�rc�0�d}d}|j||�y)Nz[
            class A:
                def next(self):
                    pass
            z_
            class A:
                def __next__(self):
                    pass
            rOrPs   r�
test_method_1zTest_next.test_method_1	r�rc�0�d}d}|j||�y)Nzc
            class A(object):
                def next(self):
                    pass
            zg
            class A(object):
                def __next__(self):
                    pass
            rOrPs   r�
test_method_2zTest_next.test_method_2,	r�rc�0�d}d}|j||�y)NzX
            class A:
                def next(x):
                    pass
            z\
            class A:
                def __next__(x):
                    pass
            rOrPs   r�
test_method_3zTest_next.test_method_39	r�rc�0�d}d}|j||�y)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
            rOrPs   r�
test_method_4zTest_next.test_method_4F	s ��

��

��	
�
�
�1�a�rc�*�d}|j|�y)Nza
            class A:
                def next(self, a, b):
                    pass
            r1r�s  r�test_method_unchangedzTest_next.test_method_unchanged_	���
��
	
���q�rc�,�d}|j|d�y)Nzy
            next = foo

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

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_assign_tuple_1z'Test_next.test_shadowing_assign_tuple_1q	r�rc�,�d}|j|d�y)Nz�
            (a, (b, (next, c)), a) = foo

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_assign_tuple_2z'Test_next.test_shadowing_assign_tuple_2{	r�rc�,�d}|j|d�y)Nz~
            [next, a] = foo

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_assign_list_1z&Test_next.test_shadowing_assign_list_1�	r�rc�,�d}|j|d�y)Nz�
            [a, [b, [next, c]], a] = foo

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_assign_list_2z&Test_next.test_shadowing_assign_list_2�	r�rc�,�d}|j|d�y)Nz�
            def foo():
                __builtin__.next = foo

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

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_builtin_assign_in_tuplez&Test_next.test_builtin_assign_in_tuple�	r
rc�,�d}|j|d�y)Nz�
            def foo():
                [a, __builtin__.next] = foo

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_builtin_assign_in_listz%Test_next.test_builtin_assign_in_list�	r
rc�*�d}|j|�y)Nz�
            def foo():
                A.next = foo

            class A:
                def next(self, a, b):
                    pass
            r1r�s  r�test_assign_to_nextzTest_next.test_assign_to_next�	���
��	
���q�rc�*�d}|j|�y)Nz�
            def foo():
                (a, A.next) = foo

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

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

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_1z!Test_next.test_shadowing_import_1�	r�rc�,�d}|j|d�y)Nz�
            import bar, bar.foo as next

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_2z!Test_next.test_shadowing_import_2�	r�rc�,�d}|j|d�y)Nz�
            import bar, bar.foo as next, baz

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_3z!Test_next.test_shadowing_import_3�	r�rc�,�d}|j|d�y)Nz�
            from x import next

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_from_1z&Test_next.test_shadowing_import_from_1�	r�rc�,�d}|j|d�y)Nz�
            from x.a import next

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_from_2z&Test_next.test_shadowing_import_from_2
r�rc�,�d}|j|d�y)Nz�
            from x import a, next, b

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_from_3z&Test_next.test_shadowing_import_from_3
r�rc�,�d}|j|d�y)Nz�
            from x.a import a, next, b

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_import_from_4z&Test_next.test_shadowing_import_from_4
r�rc�,�d}|j|d�y)Nz�
            def next(a):
                pass

            class A:
                def next(self, a, b):
                    pass
            r�rTr�s  r�test_shadowing_funcdef_1z"Test_next.test_shadowing_funcdef_1!
r
rc�2�d}d}|j||d�y)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__()
            r�r2rPs   r�test_shadowing_funcdef_2z"Test_next.test_shadowing_funcdef_2,
s#��	
��	
��	
�
�
�1�a�D�Erc�,�d}|j|d�y)NzW
            def f():
                global next
                next = 5
            r�rTr�s  r�test_shadowing_global_1z!Test_next.test_shadowing_global_1C
���
��
	
���Q� K�Lrc�,�d}|j|d�y)Nz]
            def f():
                global a, next, b
                next = 5
            r�rTr�s  r�test_shadowing_global_2z!Test_next.test_shadowing_global_2K
r*rc�,�d}|j|d�y)Nze
            for next in it():
                pass

            b = 5
            c = 6
            r�rTr�s  r�test_shadowing_for_simplez#Test_next.test_shadowing_for_simpleS
r�rc�,�d}|j|d�y)Nzh
            for next, b in it():
                pass

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

            b = 5
            c = 6
            r�rTr�s  r�test_shadowing_for_tuple_2z$Test_next.test_shadowing_for_tuple_2g
r�rc�0�d}d}|j||�y)Nzgnext = g.nextzgnext = g.__next__rOrPs   r�test_noncall_access_1zTest_next.test_noncall_access_1q
��� ��$���
�
�1�a�rc�0�d}d}|j||�y)Nz
f(g.next + 5)zf(g.__next__ + 5)rOrPs   r�test_noncall_access_2zTest_next.test_noncall_access_2v
rrc�0�d}d}|j||�y)Nzf(g().next + 5)zf(g().__next__ + 5)rOrPs   r�test_noncall_access_3zTest_next.test_noncall_access_3{
s��!��%���
�
�1�a�rN)1rHr=rIrr]r_rbrdrfrir�r�r�r�r�r�r�r�r�r�r�r�rrrrr	rrrrrrrrrrr!r#r%r'r)r,r.r0r2r4r7r9rJrrr�r��s����E��
�
�
�
�
�
�
�
/�/�"
/������2�M�M�M�M�M�	M�	M�	M�	�	�	�M�M�M�M�M�M�M�	M�F�.M�M�M�M�M��
�
rr�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�Test_nonzero�nonzeroc�0�d}d}|j||�y)Nzb
            class A:
                def __nonzero__(self):
                    pass
            z_
            class A:
                def __bool__(self):
                    pass
            rOrPs   rr]zTest_nonzero.test_1�
r�rc�0�d}d}|j||�y)Nzj
            class A(object):
                def __nonzero__(self):
                    pass
            �g
            class A(object):
                def __bool__(self):
                    pass
            rOrPs   rr_zTest_nonzero.test_2�
r�rc�*�d}|j|�y)Nr?r1r�s  rr�zTest_nonzero.test_unchanged_1�
r�rc�*�d}|j|�y)Nzm
            class A(object):
                def __nonzero__(self, a):
                    pass
            r1r�s  rr�zTest_nonzero.test_unchanged_2�
r�rc�*�d}|j|�y)NzE
            def __nonzero__(self):
                pass
            r1r�s  r�test_unchanged_funcz Test_nonzero.test_unchanged_func�
s��
��	
���q�rN)	rHr=rIrr]r_r�r�rCrJrrr;r;�
s ���E�����rr;c�^�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�Test_numliterals�numliteralsc�0�d}d}|j||�y)N�0755�0o755rOrPs   r�test_octal_1zTest_numliterals.test_octal_1�
s�������
�
�1�a�rc�0�d}d}|j||�y)Nza = 12L�a = 12rOrPs   r�test_long_int_1z Test_numliterals.test_long_int_1�
��������
�
�1�a�rc�0�d}d}|j||�y)Nza = 12lrLrOrPs   r�test_long_int_2z Test_numliterals.test_long_int_2�
rNrc�0�d}d}|j||�y)Nz	b = 0x12lzb = 0x12rOrPs   r�
test_long_hexzTest_numliterals.test_long_hex�
r�rc�\�d}d}|j||�d}d}|j||�y)Nzb =   0x12Lz
b =   0x12zb = 0755 # spamzb = 0o755 # spamrOrPs   r�test_comments_and_spacingz*Test_numliterals.test_comments_and_spacing�
s2�������
�
�1�a��!��"���
�
�1�a�rc�*�d}|j|�y)N�5r1r�s  r�test_unchanged_intz#Test_numliterals.test_unchanged_int�
s�������q�rc�*�d}|j|�y)Nz5.0r1r�s  r�test_unchanged_floatz%Test_numliterals.test_unchanged_float�
s�������q�rc�*�d}|j|�y)NrIr1r�s  r�test_unchanged_octalz%Test_numliterals.test_unchanged_octal�
��������q�rc�*�d}|j|�y)N�0xABCr1r�s  r�test_unchanged_hexz#Test_numliterals.test_unchanged_hex�
r\rc�*�d}|j|�y)Nz5.0e10r1r�s  r�test_unchanged_expz#Test_numliterals.test_unchanged_exp�
��������q�rc�*�d}|j|�y)Nz5 + 4jr1r�s  r�test_unchanged_complex_intz+Test_numliterals.test_unchanged_complex_int�
rbrc�*�d}|j|�y)Nz
5.4 + 4.9jr1r�s  r�test_unchanged_complex_floatz-Test_numliterals.test_unchanged_complex_float�
rrc�P�d}|j|�d}|j|�y)N�4jz4.4jr1r�s  r�test_unchanged_complex_barez,Test_numliterals.test_unchanged_complex_bare�
s$�������q�������q�rN)rHr=rIrrJrMrPrRrTrWrYr[r_rardrfrirJrrrErE�
sH���E��
�
�
�
��������rrEc�0�eZdZdZddiZd�Zd�Zd�Zd�Zy)	�Test_renames�renames�sys)�maxint�maxsizec���t|jj��D]@\}\}}d|�d|��}d|�d|��}|j||�d|z}|j	|��By)Nr�r�r�)�listrIrJr(r.)r�modrLrMrQrRr�s       rrPzTest_renames.test_import_from�
s^��#�D�L�L�$6�$6�$8�9�O�C��#�s�'*�C�0�A�'*�C�0�A��J�J�q�!��$�s�*�A��N�N�1��
 :rc��t|jj��D],\}\}}d|�d|�d�}d|�d|�d�}|j||��.y)Nr�r�r��rqrIrJr(�rrrrLrMrQrRs      rrTz Test_renames.test_import_from_assH��#�D�L�L�$6�$6�$8�9�O�C��#�s�25�s�;�A�25�s�;�A��J�J�q�!�� :rc
��t|jj��D]8\}\}}d|�d|�d|�d|�d�	}d|�d|�d|�d|�d�	}|j||��:y)NrYrZr9r��)
                rtrus      rr\z%Test_renames.test_import_module_usagesZ��#�D�L�L�$6�$6�$8�9�O�C��#�s��C��c�+�A��C��c�+�A�
�J�J�q�!�� :rc
��t|jj��D]8\}\}}d|�d|�d|�d|�d�	}d|�d|�d|�d|�d�	}|j||��:y)Nr[r�rZr9rwrtrus      r�XXX_test_from_import_usagez'Test_renames.XXX_test_from_import_usagesZ��#�D�L�L�$6�$6�$8�9�O�C��#�s��C��c�+�A��C��c�+�A�
�J�J�q�!�� :rN)	rHr=rIrrIrPrTr\ryrJrrrkrk�
s(���E��,��G���
�rrkc�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�Test_unicode�unicodec��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzunicode( x)zstr( x)z unicode(x )z str(x )z u'h'z 'h'rOrPs   r�test_whitespacezTest_unicode.test_whitespace'sJ�������
�
�1�a�������
�
�1�a�������
�
�1�a�rc�0�d}d}|j||�y)Nzunicode(x, y, z)zstr(x, y, z)rOrPs   r�test_unicode_callzTest_unicode.test_unicode_call4r�rc�0�d}d}|j||�y)Nzunichr(u'h')zchr('h')rOrPs   r�test_unichrzTest_unicode.test_unichr9s�������
�
�1�a�rc�0�d}d}|j||�y)Nzu"x"z"x"rOrPs   r�test_unicode_literal_1z#Test_unicode.test_unicode_literal_1>s�������
�
�1�a�rc�0�d}d}|j||�y)Nzur'x'zr'x'rOrPs   r�test_unicode_literal_2z#Test_unicode.test_unicode_literal_2Cs�������
�
�1�a�rc�0�d}d}|j||�y)Nz
UR'''x''' z	R'''x''' rOrPs   r�test_unicode_literal_3z#Test_unicode.test_unicode_literal_3Hr�rc�\�d}d}|j||�d}d}|j||�y)N�'\\\u20ac\U0001d121\\u20ac'z'\\\\u20ac\\U0001d121\\u20ac'�r'\\\u20ac\U0001d121\\u20ac'rOrPs   r�test_native_literal_escape_uz)Test_unicode.test_native_literal_escape_uMs2��.��0���
�
�1�a��/��/���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzb'\\\u20ac\U0001d121\\u20ac'zbr'\\\u20ac\U0001d121\\u20ac'rOrPs   r�test_bytes_literal_escape_uz(Test_unicode.test_bytes_literal_escape_uVs2��/��/���
�
�1�a��0��0���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzu'\\\u20ac\U0001d121\\u20ac'r�zur'\\\u20ac\U0001d121\\u20ac'r�rOrPs   r�test_unicode_literal_escape_uz*Test_unicode.test_unicode_literal_escape_u_s2��/��.���
�
�1�a��0��/���
�
�1�a�rc�x�d}|dz}|dz}|j||�|dz}|dz}|j||�y)Nz(from __future__ import unicode_literals
r�r�rO)r�frQrRs    r�$test_native_unicode_literal_escape_uz1Test_unicode.test_native_unicode_literal_escape_uhsO��7��
�2�2��
�2�2���
�
�1�a��
�3�3��
�3�3���
�
�1�a�rN)rHr=rIrr~r�r�r�r�r�r�r�r�r�rJrrr{r{$s9���E���
�
�
�
�
���rr{c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�Test_filter�filterc�\�d}d}|j||�d}d}|j||�y)Nz#x =   filter(    foo,     'abc'   )z)x =   list(filter(    foo,     'abc'   ))zx =   filter(  None , 'abc'  )z x =   [_f for _f in 'abc' if _f]rOrPs   rr�z$Test_filter.test_prefix_preservationvs2��5��;���
�
�1�a��0��2���
�
�1�a�rc���d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d}d	}|j||�y)
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)]rOrPs   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}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)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]rOrPs   r�test_filter_trailersz Test_filter.test_filter_trailers�se��,��3���
�
�1�a��.��4���
�
�1�a��>��;���
�
�1�a��
A��;���
�
�1�a�rc���d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d	}|j|�d
}|j|�d}|j|�d}|j|�d
}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)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'))r1�rrRs  r�test_filter_nochangez Test_filter.test_filter_nochange�sE��*�����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}|j|�d}d}|j||�d}|j|�y)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�s<��H�����q��H��N���
�
�1�a��=�����q�rN)	rHr=rIrr�r�r�r�r�rJrrr�r�ss!���E���.�$&�P	rr�c�L��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Z�xZS)
�Test_maprc�X��|jd|z|�tt|�||�y)Nz!from future_builtins import map; )r.rr�r(�rrQrRr<s   �rr(zTest_map.check��(������:�Q�>��B�
�h��#�A�q�)rc�0�d}d}|j||�y)Nzx =    map(   f,    'abc'   )z#x =    list(map(   f,    'abc'   ))rOrPs   rr�z!Test_map.test_prefix_preservation�s��/��5���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)	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]rOrPs   r�test_map_trailerszTest_map.test_map_trailers�sb��&��,���
�
�1�a��%�� ���
�
�1�a��+��'���
�
�1�a��)��/���
�
�1�a�rc�0�d}d}|j||�y)Nzx = map(f, 'abc')   #   fooz!x = list(map(f, 'abc'))   #   foorOrPs   rr�zTest_map.test_trailing_comment�s��-��3���
�
�1�a�rc�,�d}|j|d�y)Nzx = map(None, a, b, c)z5cannot convert map(None, ...) with multiple argumentsrTr�s  r�!test_None_with_multiple_argumentsz*Test_map.test_None_with_multiple_arguments�s��(�����Q�!2�	3rc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d}|j||�d
}d}|j||d�y)
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(r/rPs   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���d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d	}|j|�d
}|j|�d}|j|�d}|j|�d
}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)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'))r1r�s  r�test_map_nochangezTest_map.test_map_nochange$sE��'�����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}|j|�d}d}|j||�d}|j|�y)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s<��H�����q��K��Q���
�
�1�a��:�����q�r)
rHr=rIrr(r�r�r�r�r�r�r�rrs@rr�r��s2����E�*��
�"�
3�
 ;�D&�P	rr�c�:��eZdZdZ�fd�Zd�Zd�Zd�Zd�Z�xZ	S)�Test_zip�zipc�X��|jd|z|�tt|�||�y)Nz!from future_builtins import zip; )r.rr�r(r�s   �rr(zTest_zip.checkZr�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)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)))rOrPs   r�test_zip_basiczTest_zip.test_zip_basic^sJ����!���
�
�1�a��"��(���
�
�1�a��$��*���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)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]rOrPs   r�test_zip_trailerszTest_zip.test_zip_trailersks2��%��+���
�
�1�a��(��.���
�
�1�a�rc���d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d	}|j|�d
}|j|�d}|j|�d}|j|�d
}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)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))r1r�s  r�test_zip_nochangezTest_zip.test_zip_nochangetsE��#�����q��.�����q��!�����q��!�����q��$�����q�� �����q��&�����q��"�����q�� �����q�� �����q�� �����q��#�����q��-�����q��0�����q��&�����q��/�����q��*�����q��(�����q��(�����q�rc�|�d}|j|�d}d}|j||�d}|j|�y)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�s<��D�����q��G��M���
�
�1�a��6�����q�r)
rHr=rIrr(r�r�r�r�rrs@rr�r�Ws"����E�*���&�P	rr�c��eZdZdZd�Zy)�Test_standarderror�
standarderrorc��d}d}|j||�d}d}|j||�d}d}|j||�y)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))rOrPs   rr�zTest_standarderror.test�sJ��(��$���
�
�1�a��,��(���
�
�1�a��/��+���
�
�1�a�rN)rHr=rIrr�rJrrr�r��s���E�rr�c��eZdZdZd�Zy)�
Test_types�typesc�8�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d}|j||�d
}d}|j||�d}d
}|j||�y)Nztypes.StringType�bytesztypes.DictTyper�ztypes . IntType�intztypes.ListTyperqztypes.LongTypeztypes.NoneTypez
type(None)ztypes.StringTypesz(str,)rOrPs   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)rHr=rIrr�rJrrr�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�Zy)�Test_idioms�idiomsc��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzwhile 1: foo()zwhile True: foo()zwhile   1: foo()zwhile   True: foo()z8
            while 1:
                foo()
            z;
            while True:
                foo()
            rOrPs   r�
test_whilezTest_idioms.test_while�sP�� ��#���
�
�1�a��"��%���
�
�1�a��
��
��	
�
�
�1�a�rc��d}|j|�d}|j|�d}|j|�d}|j|�y)Nzwhile 11: foo()zwhile 0: foo()zwhile foo(): foo()zwhile []: foo()r1r�s  r�test_while_unchangedz Test_idioms.test_while_unchanged�sF��!�����q�� �����q��$�����q��!�����q�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x) == T�isinstance(x, T)zif   type(x) == T: pass�if   isinstance(x, T): passrOrPs   r�test_eq_simplezTest_idioms.test_eq_simple��2����"���
�
�1�a��)��-���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)NzT == type(x)r�zif   T == type(x): passr�rOrPs   r�test_eq_reversezTest_idioms.test_eq_reverse
r�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x+y) == d.get('T')�isinstance(x+y, d.get('T'))ztype(   x  +  y) == d.get('T')�isinstance(x  +  y, d.get('T'))rOrPs   r�test_eq_expressionzTest_idioms.test_eq_expression
�2��)��-���
�
�1�a��0��1���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x) is Tr�zif   type(x) is T: passr�rOrPs   r�test_is_simplezTest_idioms.test_is_simple
r�rc�\�d}d}|j||�d}d}|j||�y)NzT is type(x)r�zif   T is type(x): passr�rOrPs   r�test_is_reversezTest_idioms.test_is_reverse
r�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x+y) is d.get('T')r�ztype(   x  +  y) is d.get('T')r�rOrPs   r�test_is_expressionzTest_idioms.test_is_expression'
r�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x) is not T�not isinstance(x, T)zif   type(x) is not T: pass�if   not isinstance(x, T): passrOrPs   r�test_is_not_simplezTest_idioms.test_is_not_simple0
�2��"��&���
�
�1�a��-��1���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)NzT is not type(x)r�zif   T is not type(x): passr�rOrPs   r�test_is_not_reversezTest_idioms.test_is_not_reverse9
r�rc�\�d}d}|j||�d}d}|j||�y)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'))rOrPs   r�test_is_not_expressionz"Test_idioms.test_is_not_expressionB
s2��-��1���
�
�1�a��4��5���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x) != Tr�zif   type(x) != T: passr�rOrPs   r�test_ne_simplezTest_idioms.test_ne_simpleK
�2����&���
�
�1�a��)��1���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)NzT != type(x)r�zif   T != type(x): passr�rOrPs   r�test_ne_reversezTest_idioms.test_ne_reverseT
r�rc�\�d}d}|j||�d}d}|j||�y)Nztype(x+y) != d.get('T')r�ztype(   x  +  y) != d.get('T')r�rOrPs   r�test_ne_expressionzTest_idioms.test_ne_expression]
s2��)��1���
�
�1�a��0��5���
�
�1�a�rc�*�d}|j|�y)Nztype(x).__name__r1r�s  r�test_type_unchangedzTest_idioms.test_type_unchangedf
r�rc�d�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�d}d}|j||�d
}d}|j||�d}d}|j||�y)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 commentsrOrPs   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�8�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�d}d}|j||�d
}d}|j||�y)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)
            rOrPs   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�P�d}|j|�d}|j|�y)NzM
            v = list(t)
            w.sort()
            foo(w)
            zN
            v = list(t)
            v.sort(u)
            foo(v)
            r1r�s  r�test_sort_unchangedzTest_idioms.test_sort_unchanged s,��
��
	
���q��
��
	
���q�rN)rHr=rIrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rJrrr�r��se���E��&��������������b�HP�d
rr�c��eZdZdZd�Zy)�Test_basestring�
basestringc�0�d}d}|j||�y)Nzisinstance(x, basestring)zisinstance(x, str)rOrPs   r�test_basestringzTest_basestring.test_basestring2s��+��$���
�
�1�a�rN)rHr=rIrrrJrrr�r�/s���E�rr�c��eZdZdZd�Zd�Zy)�Test_buffer�bufferc�0�d}d}|j||�y)Nz
x = buffer(y)zx = memoryview(y)rOrPs   r�test_bufferzTest_buffer.test_buffer:rrc�0�d}d}|j||�y)Nzbuffer(y)[4:5]zmemoryview(y)[4:5]rOrPs   r�test_slicingzTest_buffer.test_slicing?r5rN)rHr=rIrrr	rJrrrr7s���E��
rrc��eZdZdZd�Zd�Zy)�Test_future�futurec��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzfrom __future__ import bracesr*z'# comment
from __future__ import bracesz
# comment
z'from __future__ import braces
# commentz

# commentrOrPs   r�test_futurezTest_future.test_futureGsJ��/�����
�
�1�a��:�����
�
�1�a��:�����
�
�1�a�rc�&�|jd�y)Nr��rGr�s r�test_run_orderzTest_future.test_run_orderTs�����w�'rN)rHr=rIrrrrJrrrrDs���E��(rrc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�Test_itertools�	itertoolsc�d�dD]+}dD]$}||dz|zz}||z}|j||��&�-y)N)z
itertools.r*)rr�r��irO)rr r!rr�rQrRs       r�checkallzTest_itertools.checkallZsA��$�A�-���Q�s�U�1�W�%���A�J���
�
�1�a� �.�$rc�0�d}d}|j||�y)Nzitertools.izip(a, b)z	zip(a, b)rOrPs   r�test_0zTest_itertools.test_0ds��
#�����
�
�1�a�rc�0�d}d}|j||�y)Nz%s(f, a)�rrPs   rr]zTest_itertools.test_1ks�������
�
�a��rc�\�d}d}|j||�d}d}|j||�y)Nzitertools.ifilterfalse(a, b)zitertools.filterfalse(a, b)zitertools.izip_longest(a, b)zitertools.zip_longest(a, b)rOrPs   r�test_qualifiedzTest_itertools.test_qualifiedps2��.��-���
�
�1�a��.��-���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzifilterfalse(a, b)zfilterfalse(a, b)zizip_longest(a, b)zzip_longest(a, b)rOrPs   rr_zTest_itertools.test_2ys2��$��#���
�
�1�a��$��#���
�
�1�a�rc�0�d}d}|j||�y)Nz    %s(f, a)rrPs   rr�zTest_itertools.test_space_1�s�������
�
�a��rc�\�d}d}|j||�d}d}|j||�y)Nz     itertools.ifilterfalse(a, b)z    itertools.filterfalse(a, b)z     itertools.izip_longest(a, b)z    itertools.zip_longest(a, b)rOrPs   rr�zTest_itertools.test_space_2�s2��2��1���
�
�1�a��2��1���
�
�1�a�rc�*�|jddd�y)Nrr�r�rr�s rrzTest_itertools.test_run_order�s�����u�e�X�6rN)rHr=rIrrrr]rr_r�r�rrJrrrrWs/���E�!���
���
�7rrc�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�Test_itertools_imports�itertools_importsc��d}d}|j||�d}d}|j||�d}d}|j||�y)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 chainrOrPs   r�test_reducedz#Test_itertools_imports.test_reduced�sJ��3��'���
�
�1�a��8��,���
�
�1�a��5��)���
�
�1�a�rc�0�d}d}|j||�y)Nz%#foo
from itertools import imap, izipz#foo
rOrPs   r�
test_commentsz$Test_itertools_imports.test_comments�s��4�����
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nz from itertools import imap, izipr*zfrom itertools import iziprOrPs   r�	test_nonez Test_itertools_imports.test_none�s2��.�����
�
�1�a��(�����
�
�1�a�rc���d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d}|j|�y)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.)rrQrRr�s    r�test_import_asz%Test_itertools_imports.test_import_as�ss��;��/���
�
�1�a��;��'���
�
�1�a��0�����
�
�1�a��>�����
�
�1�a��/�����q�rc���dD]Z}d|��}d|��}|j||�d|�d�}d|�d�}|j||�d|�d�}d|�d�}|j||��\y)N)�filterfalse�zip_longestzfrom itertools import izfrom itertools import zfrom itertools import imap, iz, foozfrom itertools import bar, izfrom itertools import bar, rO)rr,rQrRs    r�test_ifilter_and_zip_longestz3Test_itertools_imports.test_ifilter_and_zip_longest�sf��0�D�/3�5�A�.2�4�A��J�J�q�!��:>�@�A�37�9�A��J�J�q�!��9=�?�A�8<�>�A��J�J�q�!��1rc�*�d}|j|�y)Nzfrom itertools import *r1r�s  r�test_import_starz'Test_itertools_imports.test_import_star����%�����q�rc�*�d}|j|�y)Nr&r1r�s  rr�z%Test_itertools_imports.test_unchanged�s��'�����q�rN)rHr=rIrr'r)r+r-r1r3r�rJrrr#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_importrxc����tt���g�_t	��_d�_�fd�}ddlm}||_	y)NTc�r���jj|��jxs|�jvSr)�
files_checkedr��
always_exists�
present_files)r,rs �r�fake_existsz&Test_import.setUp.<locals>.fake_exists�s3������%�%�d�+��%�%�E�$�$�2D�2D�*D�Err��
fix_import)
rr7rr:�setr<r;�
lib2to3.fixesr?�exists)rr=r?r<s`  �rrzTest_import.setUp�s?���
�k�4�&�(� ��� �U���!���	F�	-�'�
�rc�N�ddlm}tjj|_y)Nrr>)rAr?�os�pathrB)rr?s  r�tearDownzTest_import.tearDown�s��,��G�G�N�N�
�rc�p��d|_tt|�||�d|_tt|�|�y)NTF)r;rr7r(r.r�s   �r�
check_bothzTest_import.check_both�s3���!���
�k�4�&�q�!�,�"���
�k�4�*�1�-rc���d�}d|_tdg�|_dtjj
ddddf}|d	�d
|d�f}|D]��g|_�|_|jd�tjj��r#tjj��d
z�nd�t�fd�|D��}|jd�|jt|j�|���y)Nc�r�tjjj|j	d��S)N�/)rDrE�pathsepr,�split)rEs r�pz)Test_import.test_files_checked.<locals>.p�s#���7�7�?�?�'�'��
�
�3��8�8rF�__init__.pyz.pyz.pycz.soz.slz.pydz
/spam/eggs.pyzni.pyz../../shrubbery.pyz
import jamz/jam�jamc3�(�K�|]	}�|z���y�wrrJ)�.0�extr,s  �r�	<genexpr>z1Test_import.test_files_checked.<locals>.<genexpr>s�����!L�8K��$��*�8K�s�)r;r@r<rDrE�sepr:rr.�dirname�addr)rrN�expected_extensions�
names_to_test�expected_checksr,s     @r�test_files_checkedzTest_import.test_files_checked�s����	9�#��� �-��1���$�b�g�g�k�k�6�5�%��P���?�+�W�a�8L�6M�N�
�!�D�!#�D�� �D�M��N�N�<�(��w�w���t�$��w�w���t�,�v�5����!�!L�8K�!L�L�O����
�.����S��!3�!3�4�o�F�"rc�Z�d}d|_tdg�|_|j|�y)N�
import barF�bar.py�r;r@r<r.r�s  r�test_not_in_packagezTest_import.test_not_in_packages)����"��� �(��_������q�rc�\�d}d|_tddg�|_|j|�y)Nz1from __future__ import absolute_import
import barFrOr^r_r�s  r�!test_with_absolute_import_enabledz-Test_import.test_with_absolute_import_enableds-��@��"��� �-��!:�;������q�rc�b�d}d}d|_tddg�|_|j||�y)Nr]�from . import barFrOr^)r;r@r<r(rPs   r�test_in_packagezTest_import.test_in_packages4������"��� �-��!:�;����
�
�1�a�rc��d}d}d|_tddtjjzg�|_|j
||�y)Nr]rdFrO�bar)r;r@rDrErUr<r(rPs   r�test_import_from_packagez$Test_import.test_import_from_package$sA������"��� �-�������1D�!E�F����
�
�1�a�rc�*�d}|j|�y)Nrdr1r�s  r�test_already_relative_importz(Test_import.test_already_relative_import+s�������q�rc�0�d}d}|j||�y)Nzimport bar # Foozfrom . import bar # FoorOrPs   r�test_comments_and_indentz$Test_import.test_comments_and_indent/s����%���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzfrom foo import bar, bazzfrom .foo import bar, bazzfrom foo import barzfrom .foo import barzfrom foo import (bar, baz)zfrom .foo import (bar, baz)�rHrPs   r�	test_fromzTest_import.test_from4sJ��&��'������1��!��"������1��(��)������1�rc�0�d}d}|j||�y)Nzfrom green.eggs import hamzfrom .green.eggs import hamrnrPs   r�test_dotted_fromzTest_import.test_dotted_fromAs��(��)������1�rc�0�d}d}|j||�y)Nz"from green.eggs import ham as spamz#from .green.eggs import ham as spamrnrPs   r�test_from_aszTest_import.test_from_asFs��0��1������1�rc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)	Nz
import foozfrom . import foo�import foo, barzfrom . import foo, barzimport foo, bar, xzfrom . import foo, bar, xzimport x, y, zzfrom . import x, y, zrnrPs   r�test_importzTest_import.test_importKsb����������1����$������1�� ��'������1����#������1�rc�\�d}d}|j||�d}d}|j||�y)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 drnrPs   rr-zTest_import.test_import_as\s2����$������1��+��2������1�rc�^�d|_tddg�|_d}|j|d�y)NFzfoo.pyrOruz#absolute and local imports together)r;r@r<r3r�s  r�test_local_and_absolutez#Test_import.test_local_and_absolutees2��"��� �(�M�!:�;��������Q� E�Frc�0�d}d}|j||�y)Nzimport foo.barzfrom . import foo.barrnrPs   r�test_dotted_importzTest_import.test_dotted_importls����#������1�rc�0�d}d}|j||�y)Nzimport foo.bar as bangzfrom . import foo.bar as bangrnrPs   r�test_dotted_import_asz!Test_import.test_dotted_import_asqs��$��+������1�rc�0�d}d}|j||�y)Nz1
        # prefix
        import foo.bar
        z8
        # prefix
        from . import foo.bar
        rnrPs   r�test_prefixzTest_import.test_prefixvs ��
��
��	
����1�r)rHr=rIrrrFrHr[r`rbrerhrjrlrorqrsrvr-ryr{r}rrrs@rr7r7�si����E�(�+�.�G�0������
��
�
�"�G��
�
	rr7c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�Test_set_literal�set_literalc��d}d}|j||�d}d}|j||�d}d}|j||�d}|j||�d}d}|j||�d	}|j||�d
}d}|j||�d}d
}|j||�d}d}|j||�y)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}rOrPs   rrSzTest_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}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)	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}rOrPs   r�test_listcompszTest_set_literal.test_listcomps�sb��%�� ���
�
�1�a��/��*���
�
�1�a��0��+���
�
�1�a��-��(���
�
�1�a�rc�8�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�d}d}|j||�d
}d}|j||�y)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}
rOrPs   rr~z Test_set_literal.test_whitespace�s��������
�
�1�a�������
�
�1�a�������
�
�1�a�������
�
�1�a��"�����
�
�1�a��'��"���
�
�1�a��
��
���
�
�1�a�rc�\�d}d}|j||�d}d}|j||�y)Nzset((1, 2)) # Hiz{1, 2} # HizZ
            # Foo
            set( # Bar
               (1, 2)
            )
            z2
            # Foo
            {1, 2}
            rOrPs   rr)zTest_set_literal.test_comments�s8��"�����
�
�1�a��
��
��	
�
�
�1�a�rc���d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�d}|j|�y)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))r1r�s  rr�zTest_set_literal.test_unchanged�sj�������q�������q�������q��
$�����q��(�����q��*�����q�rN)	rHr=rIrrSr�r~r)r�rJrrr�r��s"���E�!�F�"�@�$rr�c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�Test_sys_exc�sys_excc�0�d}d}|j||�y)Nzsys.exc_typezsys.exc_info()[0]rOrPs   rrzTest_sys_exc.test_0s�������
�
�1�a�rc�0�d}d}|j||�y)Nz
sys.exc_valuezsys.exc_info()[1]rOrPs   rr]zTest_sys_exc.test_1	s�������
�
�1�a�rc�0�d}d}|j||�y)Nzsys.exc_tracebackzsys.exc_info()[2]rOrPs   rr_zTest_sys_exc.test_2s�������
�
�1�a�rc�0�d}d}|j||�y)Nzsys.exc_type # Foozsys.exc_info()[0] # FoorOrPs   rrbzTest_sys_exc.test_3s�� ��%���
�
�1�a�rc�0�d}d}|j||�y)Nzsys.  exc_typezsys.  exc_info()[0]rOrPs   rrdzTest_sys_exc.test_4�����!���
�
�1�a�rc�0�d}d}|j||�y)Nzsys  .exc_typezsys  .exc_info()[0]rOrPs   rrfzTest_sys_exc.test_5r�rN)
rHr=rIrrr]r_rbrdrfrJrrr�r�s%���E��
�
�
�
�
rr�c�X�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�
Test_paren�parenc�0�d}d}|j||�y)Nz[i for i in 1, 2 ]z[i for i in (1, 2) ]rOrPs   rrzTest_paren.test_0&s��$��&���
�
�1�a�rc�0�d}d}|j||�y)Nz[i for i in 1, 2, ]z[i for i in (1, 2,) ]rOrPs   rr]zTest_paren.test_1+s��%��'���
�
�1�a�rc�0�d}d}|j||�y)Nz[i for i  in     1, 2 ]z[i for i  in     (1, 2) ]rOrPs   rr_zTest_paren.test_20s��)��+���
�
�1�a�rc�0�d}d}|j||�y)Nz[i for i in 1, 2 if i]z[i for i in (1, 2) if i]rOrPs   rrbzTest_paren.test_35s��(��*���
�
�1�a�rc�0�d}d}|j||�y)Nz[i for i in 1,    2    ]z[i for i in (1,    2)    ]rOrPs   rrdzTest_paren.test_4:s��*��,���
�
�1�a�rc�0�d}d}|j||�y)Nz(i for i in 1, 2)�(i for i in (1, 2))rOrPs   rrfzTest_paren.test_5?s��#��%���
�
�1�a�rc�0�d}d}|j||�y)Nz(i for i in 1   ,2   if i)z(i for i in (1   ,2)   if i)rOrPs   rrizTest_paren.test_6Ds��,��.���
�
�1�a�rc�*�d}|j|�y)Nz[i for i in (1, 2)]r1r�s  r�test_unchanged_0zTest_paren.test_unchanged_0Ir4rc�*�d}|j|�y)Nz[i for i in foo()]r1r�s  rr�zTest_paren.test_unchanged_1Mr{rc�*�d}|j|�y)Nz[i for i in (1, 2) if nothing]r1r�s  rr�zTest_paren.test_unchanged_2Qr�rc�*�d}|j|�y)Nr�r1r�s  rr�zTest_paren.test_unchanged_3Ur4rc�*�d}|j|�y)Nz[i for i in m]r1r�s  rr�zTest_paren.test_unchanged_4Yr	rN)rHr=rIrrr]r_rbrdrfrir�r�r�r�r�rJrrr�r�#sC���E��
�
�
�
�
�
�
����rr�c�"�eZdZdZd�Zd�Zd�Zy)�Test_metaclass�	metaclassc�>�|jd�|jd�|jd�|jd�|jd�|jd�|jd�d}|j|�d	}|j|�y)
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
        r1r�s  rr�zTest_metaclass.test_unchangedas������(�)����.�/����8�9����A�B����6�7����@�A����K�L�
��	
���q��
��	
���q�rc�\�d}d}|j||�d}d}|j||�y)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!
        rOrPs   rr)zTest_metaclass.test_commentsvs>��
��

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

��
	
�
�
�1�a�rc���d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d}|j||�d
}d}|j||�d}d
}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)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
        rOrPs   r�	test_metazTest_metaclass.test_meta�sD��
��

��	
�
�
�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)rHr=rIrr�r)r�rJrrr�r�]s���E��*�2prr�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�Test_getcwdu�getcwduc��d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�y)	Nz
os.getcwduz	os.getcwdzos.getcwdu()�os.getcwd()zmeth = os.getcwduzmeth = os.getcwdzos.getcwdu(args)zos.getcwd(args)rOrPs   rrSzTest_getcwdu.test_basicsb�������
�
�1�a�������
�
�1�a��#��"���
�
�1�a��"��!���
�
�1�a�rc�0�d}d}|j||�y)Nzos.getcwdu() # Foozos.getcwd() # FoorOrPs   rr�zTest_getcwdu.test_commentrrc�v�d}|j|�d}|j|�d}|j|�y)Nr�z	getcwdu()zos.getcwdb()r1r�s  rr�zTest_getcwdu.test_unchangeds5�������q�������q�������q�rc�0�d}d}|j||�y)Nz<
            if 1:
                os.getcwdu()
            z;
            if 1:
                os.getcwd()
            rOrPs   r�test_indentationzTest_getcwdu.test_indentation&rfrc��d}d}|j||�d}d}|j||�d}d}|j||�y)Nz
os .getcwdu()zos .getcwd()zos.  getcwduzos.  getcwdzos.getcwdu (  )zos.getcwd (  )rOrPs   r�test_multilationzTest_getcwdu.test_multilation1sJ�������
�
�1�a�������
�
�1�a��!�� ���
�
�1�a�rN)	rHr=rIrrSr�r�r�r�rJrrr�r�s ���E��"�
�	�rr�c�d�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�
Test_operator�operatorc�0�d}d}|j||�y)Nzoperator.isCallable(x)zcallable(x)rOrPs   r�test_operator_isCallablez&Test_operator.test_operator_isCallableCs��$�����
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)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)rOrPs   r�test_operator_sequenceIncludesz,Test_operator.test_operator_sequenceIncludesHsJ��-��%���
�
�1�a��.��&���
�
�1�a��/��'���
�
�1�a�rc�0�d}d}|j||�y)Nzoperator.isSequenceType(x)z>import collections.abc
isinstance(x, collections.abc.Sequence)rOrPs   r�test_operator_isSequenceTypez*Test_operator.test_operator_isSequenceTypeUs��(��M���
�
�1�a�rc�0�d}d}|j||�y)Nzoperator.isMappingType(x)z=import collections.abc
isinstance(x, collections.abc.Mapping)rOrPs   r�test_operator_isMappingTypez)Test_operator.test_operator_isMappingTypeZs��'��L���
�
�1�a�rc�0�d}d}|j||�y)Nzoperator.isNumberType(x)z,import numbers
isinstance(x, numbers.Number)rOrPs   r�test_operator_isNumberTypez(Test_operator.test_operator_isNumberType_s��&��;���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzoperator.repeat(x, n)zoperator.mul(x, n)zoperator .repeat(x, n)zoperator .mul(x, n)zoperator.  repeat(x, n)zoperator.  mul(x, n)rOrPs   r�test_operator_repeatz"Test_operator.test_operator_repeatdsJ��#�� ���
�
�1�a��$��!���
�
�1�a��%��"���
�
�1�a�rc��d}d}|j||�d}d}|j||�d}d}|j||�y)Nzoperator.irepeat(x, n)zoperator.imul(x, n)zoperator .irepeat(x, n)zoperator .imul(x, n)zoperator.  irepeat(x, n)zoperator.  imul(x, n)rOrPs   r�test_operator_irepeatz#Test_operator.test_operator_irepeatqsJ��$��!���
�
�1�a��%��"���
�
�1�a��&��#���
�
�1�a�rc�0�d}d}|j||�y)Nz
isCallable(x)z"You should use 'callable(x)' here.rT�rr��ts   r�test_bare_isCallablez"Test_operator.test_bare_isCallable~s����0�����Q��"rc�0�d}d}|j||�y)NzsequenceIncludes(x, y)z.You should use 'operator.contains(x, y)' here.rTr�s   r�test_bare_sequenceIncludesz(Test_operator.test_bare_sequenceIncludes�s��$��<�����Q��"rc�0�d}d}|j||�y)NzisSequenceType(z)z>You should use 'isinstance(z, collections.abc.Sequence)' here.rTr�s   r�!test_bare_operator_isSequenceTypez/Test_operator.test_bare_operator_isSequenceType�s����L�����Q��"rc�0�d}d}|j||�y)NzisMappingType(x)z=You should use 'isinstance(x, collections.abc.Mapping)' here.rTr�s   r� test_bare_operator_isMappingTypez.Test_operator.test_bare_operator_isMappingType�s����K�����Q��"rc�0�d}d}|j||�y)NzisNumberType(y)z4You should use 'isinstance(y, numbers.Number)' here.rTr�s   r�test_bare_operator_isNumberTypez-Test_operator.test_bare_operator_isNumberType�s����B�����Q��"rc�0�d}d}|j||�y)Nzrepeat(x, n)z)You should use 'operator.mul(x, n)' here.rTr�s   r�test_bare_operator_repeatz'Test_operator.test_bare_operator_repeat�s����7�����Q��"rc�0�d}d}|j||�y)Nzirepeat(y, 187)z,You should use 'operator.imul(y, 187)' here.rTr�s   r�test_bare_operator_irepeatz(Test_operator.test_bare_operator_irepeat�s����:�����Q��"rN)rHr=rIrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rJrrr�r�?sM���E��
��
�
�
��#�
#�
#�
#�
#�
#�
#rr�c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�
Test_exitfunc�exitfuncc�0�d}d}|j||�y)NzI
            import sys
            sys.exitfunc = my_atexit
            ze
            import sys
            import atexit
            atexit.register(my_atexit)
            rOrPs   rr#zTest_exitfunc.test_simple�� ��
��
��
	
�
�
�1�a�rc�0�d}d}|j||�y)NzO
            import sys, crumbs
            sys.exitfunc = my_func
            zY
            import sys, crumbs, atexit
            atexit.register(my_func)
            rOrPs   r�test_names_importzTest_exitfunc.test_names_import�rfrc�0�d}d}|j||�y)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)
            rOrPs   r�test_complex_expressionz%Test_exitfunc.test_complex_expression�r�rc�\�d}d}|j||�d}d}|j||�y)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)
            rOrPs   rr)zTest_exitfunc.test_comments�s>��
��
��
	
�
�
�1�a��
��
��	
�
�
�1�a�rc�0�d}d}|j||�y)Nz]
            import sys
            def f():
                sys.exitfunc = func
            zz
            import sys
            import atexit
            def f():
                atexit.register(func)
             rOrPs   r�test_in_a_functionz Test_exitfunc.test_in_a_function�s ��
��

��	
�
�
�1�a�rc�6�d}d}d}|j|||�y)Nzsys.exitfunc = fzatexit.register(f)zKCan't find sys import; Please add an atexit import at the top of your file.r2)rrQrR�msgs    r�test_no_sys_importz Test_exitfunc.test_no_sys_import�s#��"��$�� ���
�
�1�a��rc�*�d}|j|�y)Nzf(sys.exitfunc)r1r�s  rr�zTest_exitfunc.test_unchanged�r�rN)rHr=rIrr#r�r�r)r�r�r�rJrrr�r��s*���E�
�	�
��,��rr�c�"�eZdZdZd�Zd�Zd�Zy)�Test_asserts�assertsc�D�gd�}|D]\}}|j||��y)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)rO)r�testsrQrRs    r�test_deprecated_namesz"Test_asserts.test_deprecated_names�s'��

���D�A�q��J�J�q�!��rc�8�d}d}|j||�d}d}|j||�d}d}|j||�d}d}|j||�d	}d
}|j||�d}d}|j||�d
}d}|j||�y)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()rOrPs   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�H�|jd�|jd�y)Nzself.assertEqualsOnSaturdayz!self.assertEqualsOnSaturday(3, 5)r1r�s rr�zTest_asserts.test_unchanged's�����4�5����:�;rN)rHr=rIrr�r�r�rJrrr�r��s���E��$�.<rr�)BrDrrr�rr6rr�test.test_lib2to3r�TestCaser	rLrZrwr�r�r�r�r�rrr@rlr�r�r�r�r�rrr(r>rEr^rirmr|r�r�r�r�r;rErkr{r�r�r�r�r�r�r�rrrr#r7r�r�r�r�r�r�r�r�rJrr�<module>r�s��(�
���'�%�7N�G�$�$�7N�r�m��68�=�8�tC��C�J9�-�9�v/�-�/�b!�-�!�Fg��g�T1�
�1�f$�
�$�LQ�-�Q�f}��}�~{��{�z+�
�+�\#�M�#�L4�m�4�8d�
�d�LF7�-�F7�P	�m�	�-�]�-�^�]��4(�m�(�V_�_�D�=�"3��*>�M�#4�>�

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

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists