Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_fstring.cpython-311.pyc
�

�Ke{����ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	dZ
Gd�dej��Zedkrej
��dSdS)�N)�temp_cwd)�assert_python_failurezglobal variablec��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdFS)G�TestCasec���|D]m}|�|���5|�||��5t|��ddd��n#1swxYwYddd��n#1swxYwY�ndS)N��str)�subTest�assertRaisesRegex�eval)�self�exception_type�regex�
error_stringsr	s     �;/usr/local/apps/python3/lib/python3.11/test/test_fstring.py�assertAllRaisezTestCase.assertAllRaises��� �	�	�C����#��&�&�
�
��+�+�N�E�B�B�����I�I�I�������������������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��	�	s4�A%�A�A%�A�A%�A�A%�%A)	�,A)	c���Gd�d��}|��}|��}tjd�|��|_|�|�t	|����|�|�d��|�t	|��t	|����|�|�d��d��|�|�d��d��|�t|���|d��d��|�t|���|d��d��dS)Nc��eZdZd�ZdS)�(TestCase.test__format__lookup.<locals>.Xc��dS)N�class��r
�specs  r�
__format__z3TestCase.test__format__lookup.<locals>.X.__format__&s���w�N��__name__�
__module__�__qualname__rrrr�Xr%s#������
�
�
�
�
rr!c��dS)N�instancerrs  r�<lambda>z/TestCase.test__format__lookup.<locals>.<lambda>.s��:�rr�r#)�types�
MethodTyper�assertEqual�format�type)r
r!�x�ys    r�test__format__lookupzTestCase.test__format__lookup#sZ��	�	�	�	�	�	�	�	�
�A�C�C��
�A�C�C���'�(E�(E�q�I�I������A������+�+�+����A���)�)�)��������F�1�I�I�.�.�.�
	
������b�)�)�7�3�3�3�������b�)�)�:�6�6�6�	
����a���+�+�A�r�2�2�G�<�<�<�����a���+�+�A�r�2�2�G�<�<�<�<�<rc��Gd�d��}|��}d}tj|��}t|dd��}|�|j��t|��|�|j��dS)Nc��eZdZd�Zd�ZdS)�TestCase.test_ast.<locals>.Xc��d|_dS)NF��called�r
s r�__init__z%TestCase.test_ast.<locals>.X.__init__As
��#����rc��d|_dS)NT�r2r4s r�__call__z%TestCase.test_ast.<locals>.X.__call__Cs��"����qrN)rrr r5r8rrrr!r0@s2������
$�
$�
$�
�
�
�
�
rr!�
a = 10
f'{a * x()}'r%�exec)�ast�parse�compile�assertFalser3r:�
assertTrue)r
r!r+�expr�t�cs      r�test_astzTestCase.test_ast>s���	�	�	�	�	�	�	�	�
�A�C�C����
�I�d�O�O���A�r�6�"�"��	
�����"�"�"�	
�Q����	
�����!�!�!�!�!rc���d}tj|��}|�t|��tj��|�t|j��d��|�t|jd��tj��|�|jdjd��|�t|jd��tj	��|�t|jdj
��tj��|�t|jdj
j��d��|�t|jdj
jd��tj
��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|jdj
jdj
}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|jd��|�|jjd��|�|jjd��|�|jd��|�|jjd��|�|jjd��dS)Nr9�r���)r;r<r(r*�Module�len�body�Assign�lineno�Expr�value�	JoinedStr�values�FormattedValue�BinOp�left�Name�op�Mult�right�Call�
col_offset�r
r@rA�binops    r�test_ast_line_numberszTestCase.test_ast_line_numbersVs�����
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(�����a�f�Q�i���#�*�5�5�5��������)�1�-�-�-�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M��������)�1�-�-�-���������/��3�3�3���������/��2�9�1�=�=�=���q�	��&�q�)�/������e���c�i�0�0�0�����e�j�)�)�3�8�4�4�4�����e�h�����2�2�2�����e�k�*�*�C�H�5�5�5������q�)�)�)������*�A�.�.�.������+�Q�/�/�/�����)�1�-�-�-������.��2�2�2������/��3�3�3�3�3rc��d}tj|��}|�t|��tj��|�t|j��d��|�t|jd��tj��|�t|jdj��tj	��|�|jdj
d��|�t|jd��tj��|�t|jdj��tj	��|�t|jdjj��d��|�t|jdjjd��tj��|�t|jdjjdj��t��|�t|jdjjd��tj��|�t|jdjjd��tj��|�t|jdjjdj��t��|�t|jdjjd��tj��|�|jdj
d��|�|jdjj
d��|�|jdjjdj
d��|�|jdjjdj
d��|�|jdjjdj
d��|�|jdjjdj
d��|jdjjdj}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|j
d��|�|jj
d��|�|jj
d��|�|jd��|�|jjd��|�|jjd��|jdjjdj}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|j
d��|�|jj
d��|�|jj
d��|�|jd	��|�|jjd	��|�|jjd
��dS)Nz8
f'no formatted values'
f'eggs {a * x()} spam {b + y()}'rErrFr7rG����)r;r<r(r*rIrJrKrNrOrPrMrQ�Constantr	rRrSrTrUrVrWrXrYrZ�Add)r
r@rA�binop1�binop2s     r�.test_ast_line_numbers_multiple_formattedvaluesz7TestCase.test_ast_line_numbers_multiple_formattedvaluesus���$��
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>��������)�1�-�-�-�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�=�>�>��D�D�D�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�=�>�>��D�D�D�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M��������)�1�-�-�-���������/��3�3�3���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=������'��*�0������f���s�y�1�1�1�����f�k�*�*�C�H�5�5�5�����f�i���#�(�3�3�3�����f�l�+�+�S�X�6�6�6�������*�*�*������+�Q�/�/�/������,�a�0�0�0�����*�A�.�.�.������/��3�3�3������0�"�5�5�5������'��*�0������f���s�y�1�1�1�����f�k�*�*�C�H�5�5�5�����f�i���#�'�2�2�2�����f�l�+�+�S�X�6�6�6�������*�*�*������+�Q�/�/�/������,�a�0�0�0�����*�B�/�/�/������/��4�4�4������0�"�5�5�5�5�5rc�x�d}tj|��}|�t|��tj��|�t|j��d��|�t|jd��tj��|�|jdjd��|�t|jd��tj	��|�t|jdj
��tj��|�t|jdj
j��d��|�t|jdj
jd��tj
��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|jdj
jdj
}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|jd��|�|jjd��|�|jjd��|�|jd��|�|jjd��|�|jjd��|�t|jj��d��|�t|jjd��tj��|�t|jjdj
��t,��|�t|jjd��tj
��|�t|jjd��tj��|�t|jjdj
��t,��|�|jjdjd��|�|jjdjd��|�|jjdjd��|jjdj
}|�t|��tj��|�|jd��|�|jd��dS)Nz
a = 10
f'{a * f"-{x()}-"}'rErrFrGrH�)r;r<r(r*rIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrZrcr	rY)r
r@rAr\�calls     r�test_ast_line_numbers_nestedz%TestCase.test_ast_line_numbers_nested�s�����
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(�����a�f�Q�i���#�*�5�5�5��������)�1�-�-�-�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M��������)�1�-�-�-���������/��3�3�3���������/��2�9�1�=�=�=���q�	��&�q�)�/������e���c�i�0�0�0�����e�j�)�)�3�8�4�4�4�����e�h�����2�2�2�����e�k�*�*�C�M�:�:�:������q�)�)�)������*�A�.�.�.������+�Q�/�/�/�����)�1�-�-�-������.��2�2�2������/��3�3�3�����U�[�/�0�0�!�4�4�4�����e�k�0��3�4�4�c�l�C�C�C�����e�k�0��3�9�:�:�C�@�@�@�����e�k�0��3�4�4�c�6H�I�I�I�����e�k�0��3�4�4�c�l�C�C�C�����e�k�0��3�9�:�:�C�@�@�@������+�A�.�5�q�9�9�9������+�A�.�5�q�9�9�9������+�A�.�5�q�9�9�9��{�!�!�$�*������d���S�X�.�.�.������a�(�(�(������"�-�-�-�-�-rc�B�d}tj|��}|�t|��tj��|�t|j��d��|�t|jd��tj��|�|jdjd��|�t|jd��tj	��|�t|jdj
��tj��|�t|jdj
j��d��|�t|jdj
jd��tj
��|�t|jdj
jd��tj��|�t|jdj
jdj
��t��|�t|jdj
jd��tj
��|�t|jdj
jd��tj��|�t|jdj
jdj
��t��|�t|jdj
jd��tj
��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|jdj
jdj
}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|jd��|�|jjd��|�|jjd��|�|jd��|�|jjd��|�|jjd��|jdj
jdj
}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|jd��|�|jjd��|�|jjd��|�|jd	��|�|jjd	��|�|jjd
��|jdj
jdj
}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|jd��|�|jjd��|�|jjd��|�|jd��|�|jjd��|�|jjd��dS)
Nz)
a = 10
f'{a * x()} {a * x()} {a * x()}'
rErrF�rGr7rH�
�rarb)r;r<r(r*rIrJrKrLrMrNrOrPrQrRrcr	rSrTrUrVrWrXrYrZr[s    r�*test_ast_line_numbers_duplicate_expressionz3TestCase.test_ast_line_numbers_duplicate_expression�s����
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(�����a�f�Q�i���#�*�5�5�5��������)�1�-�-�-�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�=�>�>��D�D�D�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�=�>�>��D�D�D�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M��������)�1�-�-�-���������/��3�3�3���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���q�	��&�q�)�/������e���c�i�0�0�0�����e�j�)�)�3�8�4�4�4�����e�h�����2�2�2�����e�k�*�*�C�H�5�5�5������q�)�)�)������*�A�.�.�.������+�Q�/�/�/�����)�1�-�-�-������.��2�2�2������/��3�3�3���q�	��&�q�)�/������e���c�i�0�0�0�����e�j�)�)�3�8�4�4�4�����e�h�����2�2�2�����e�k�*�*�C�H�5�5�5������q�)�)�)������*�A�.�.�.������+�Q�/�/�/�����)�2�.�.�.������.��3�3�3������/��4�4�4���q�	��&�q�)�/������e���c�i�0�0�0�����e�j�)�)�3�8�4�4�4�����e�h�����2�2�2�����e�k�*�*�C�H�5�5�5������q�)�)�)������*�A�.�.�.������+�Q�/�/�/�����)�2�.�.�.������.��3�3�3������/��4�4�4�4�4rc�J�tjd��}|�t|j��d��|�|jdjd��|�t
|jd��tj��|�t
|jdj��tj	��|�t|jdjj
��d��|�t
|jdjj
d��tj��|�t
|jdjj
d��tj��|�t
|jdjj
d��tj��|jdjj
\}}}|j}|�t
|��tj
��|�|jd��|�|jd��|�|jd��|�|jd��dS)Nz%f"Here is that pesky {xxx:.3f} again"rFrrGrE��)r;r<r(rJrKrMr*rNrOrPrQrcrRrU�
end_linenorZ�end_col_offset)r
rA�_r@�names     r�(test_ast_numbers_fstring_with_formattingz1TestCase.test_ast_numbers_fstring_with_formattings����I�=�>�>������Q�V���a�(�(�(��������)�1�-�-�-�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G��V�A�Y�_�+�
��4���z������d���S�X�.�.�.������a�(�(�(������!�,�,�,������"�-�-�-�����,�b�1�1�1�1�1rc�(�d}tj|��}|�t|��tj��|�t|j��d��|�t|jd��tj��|�|jdjd��|�t|jd��tj	��|�t|jdj
��tj��|�t|jdj
j��d��|�t|jdj
jd��tj
��|�t|jdj
jdj
��t��|�t|jdj
jd��tj��|�t|jdj
jd��tj
��|�t|jdj
jdj
��t��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|jdj
jdj
}|�t|��tj��|�t|j��tj��|�t|j��tj��|�t|j��tj��|�|jd��|�|jjd��|�|jjd��|�|jd��|�|jjd��|�|jjd��d	}tj|��}|�t|��tj��|�t|j��d��|�t|jd��tj��|�t|jdj
��tj��|�t|jdj
j��d��|�t|jdj
jd��tj��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdjd��|�|jdj
jd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdjd��|�|jdj
jdj
jd��|�|jdj
jdj
jd��|�|jdj
jdj
jd
��|�|jdj
jdj
jd��dS)Nz?
a = 10
f'''
  {a
     *
       x()}
non-important content
'''
rErrFrGr7�rHz$
a = f'''
          {blech}
    '''
ri�)r;r<r(r*rIrJrKrLrMrNrOrPrQrcr	rRrZrSrTrUrVrWrXrYrtrur[s    r�'test_ast_line_numbers_multiline_fstringz0TestCase.test_ast_line_numbers_multiline_fstring/s�����
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(�����a�f�Q�i���#�*�5�5�5��������)�1�-�-�-�����a�f�Q�i���#�(�3�3�3�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�=�>�>��D�D�D�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M�����a�f�Q�i�o�4�Q�7�8�8�#�,�G�G�G�����a�f�Q�i�o�4�Q�7�=�>�>��D�D�D��������)�1�-�-�-���������/��3�3�3���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=��������-�q�1�1�1���������3�Q�7�7�7���������/��2�=�q�A�A�A���������/��2�=�q�A�A�A���������/��2�=�q�A�A�A���q�	��&�q�)�/������e���c�i�0�0�0�����e�j�)�)�3�8�4�4�4�����e�h�����2�2�2�����e�k�*�*�C�H�5�5�5������q�)�)�)������*�A�.�.�.������+�Q�/�/�/�����)�1�-�-�-������.��2�2�2������/��3�3�3���

�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(�����a�f�Q�i���#�*�5�5�5�����a�f�Q�i�o�.�.��
�>�>�>�����Q�V�A�Y�_�3�4�4�a�8�8�8�����a�f�Q�i�o�4�Q�7�8�8�#�:L�M�M�M��������)�1�-�-�-���������/��3�3�3���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=���������/��2�9�1�=�=�=��������-�q�1�1�1���������3�Q�7�7�7���������/��2�=�q�A�A�A���������/��2�=�q�A�A�A���������/��2�=�q�A�A�A���������/��2�8�?��C�C�C���������/��2�8�C�Q�G�G�G���������/��2�8�C�R�H�H�H���������/��2�8�G��L�L�L�L�Lrc���d}tj|��}|�t|��tj��|�t|j��d��|jdjjdj}|�t|��tj	��|�|j
d��|�|jd��|�|jd��|�|j
d��d}tj|��}|�t|��tj��|�t|j��d��|jdjjd}|�t|��tj��|�t|j��d��|j\}}}|�t|��tj��|�|j
d��|�|jd	��|�|jd
��|�|j
d��|j}|�t|��tj	��|�|j
d��|�|jd��|�|jd
��|�|j
d��|�t|��tj��|�|j
d��|�|jd	��|�|jd
��|�|j
d��dS)Nz
x = (
    f" {test(t)}"
)rFrrGr_�zv
x = (
        'PERL_MM_OPT', (
            f'wat'
            f'some_string={f(x)} '
            f'wat'
        ),
)
r7rzr`�rmrb�)r;r<r(r*rIrJrKrOrQrYrMrtrZru�eltsrPrc)r
r@rArj�fstring�wat1�middle�wat2s        r�&test_ast_line_numbers_with_parenthesesz/TestCase.test_ast_line_numbers_with_parentheses~s(����
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(��v�a�y��%�a�(�.������d���S�X�.�.�.������a�(�(�(������!�,�,�,������!�,�,�,�����,�b�1�1�1���
�I�d�O�O������a���#�*�-�-�-�����Q�V���a�(�(�(��&��)�/�&�q�)������g����
�6�6�6�����W�^�,�,�a�0�0�0�$�^���f�d�����d���S�\�2�2�2������a�(�(�(������!�,�,�,������"�-�-�-�����,�b�1�1�1��|������d���S�X�.�.�.������a�(�(�(������!�,�,�,������"�-�-�-�����,�b�1�1�1�����d���S�\�2�2�2������a�(�(�(������!�,�,�,������"�-�-�-�����,�b�1�1�1�1�1rc�z�d�}|�|j��d�}|�|j��dS)Nc�
�ddS�NzNot a docstringrrrr�fz"TestCase.test_docstring.<locals>.f�s��"�"�"�"rc�
�ddSr�rrrr�gz"TestCase.test_docstring.<locals>.g�s��
�
�
�
r)�assertIsNone�__doc__)r
r�r�s   r�test_docstringzTestCase.test_docstring�sT��	#�	#�	#����!�)�$�$�$�	�	�	�	
���!�)�$�$�$�$�$rc��|�td��5tjd��ddd��dS#1swxYwYdS)Nzmalformed node or stringzf'x')r�
ValueErrorr;�literal_evalr4s r�test_literal_evalzTestCase.test_literal_eval�s���
�
#�
#�J�0J�
K�
K�	%�	%���V�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s�>�A�Ac��dg}d}tj|��}t|dd��}t|��|�|dd��dS)Nr%zx[0] = 'foo' f'{3}'r:r�foo3)r;r<r=r:r()r
r+r@rArBs     r�test_ast_compile_time_concatz%TestCase.test_ast_compile_time_concat�sW��
�D��(���I�d�O�O���A�r�6�"�"���Q��������1��v�&�&�&�&�&rc�B�|�tdddg��dS)Nz&cannot mix bytes and nonbytes literalszf'' b''zb'' f''�r�SyntaxErrorr4s r�test_compile_time_concat_errorsz(TestCase.test_compile_time_concat_errors�s4�����K�D�+�+��	 �	 �	 �	 �	 rc��|��d��|�dd��|�dd��dS)Nr%�a� �r(r4s r�test_literalzTestCase.test_literal�sJ������b�!�!�!�����s�#�#�#�����s�#�#�#�#�#rc�B�|�tdgd���dS)Nzf-string: unterminated string)zf'{"x'zf'{"x}'zf'{("x'zf'{("x}'r�r4s r�test_unterminated_stringz!TestCase.test_unterminated_string�s8�����K�)H����	 �	 �	 �	 �	 rc�j�|�tddg��|�tddg��|�tddg��|�tddg��|�tdd	g��|�ttd
��dS)NzJf-string: closing parenthesis '\}' does not match opening parenthesis '\('zf'{((}'zJf-string: closing parenthesis '\)' does not match opening parenthesis '\['z	f'{a[4)}'zJf-string: closing parenthesis '\]' does not match opening parenthesis '\('z	f'{a(4]}'zJf-string: closing parenthesis '\}' does not match opening parenthesis '\['zf'{a[4}'zf'{a(4}'a�f'{((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((}')rr��assertRaisesrr4s r�test_mismatched_parenszTestCase.test_mismatched_parens�s������K�*G�&��	 �	 �	 �	
���K�*G�(��	�	�	�	
���K�*G�(��	�	�	�	
���K�*G�'��	�	�	�	
���K�*G�'��	�	�	�	
���+�t�-C�D�D�D�D�Drc��|�dd��|�dd��|�dd��|�dd��|�dd��|�dd��|�dd��|�dd��|�d	d	��|�d
d
��|�dd��|�dd��|�d
d
��|�dd��|�dd��|�dd��|�dd��d��|�dd��d��|�dd��d��|�dd��d��|�d�d�d��|�d�d�d��|�d�d�d��|�d�d�d��|�d�d��|�tddg��dS) N�{za{z{bza{b�}za}z}bza}bz{}za{}z{b}z{}cza{b}za{}cz{b}cza{b}c�
z{10z}10z}{z}{10z}a{z}a{10z10{z10}z10}{z}a{}z10}a{}z{{}}zunhashable typezf'{ {{}} }')r(r�	TypeErrorr4s r�test_double_braceszTestCase.test_double_braces�s��������$�$�$������&�&�&������&�&�&�����%�(�(�(������$�$�$������&�&�&������&�&�&�����%�(�(�(�����$�'�'�'�����5�)�)�)�����5�)�)�)�����5�)�)�)�����F�+�+�+�����F�+�+�+�����F�+�+�+�����W�-�-�-�����b���E�*�*�*�����b���E�*�*�*��������f�-�-�-��������w�/�/�/����B����E�*�*�*����B����E�*�*�*����B����f�-�-�-����B�)�)�)�8�4�4�4�	
���F��f�-�-�-����I�'8�*��	 �	 �	 �	 �	 rc���d}|�d|�d�d��|�d|�d�d��|�d|�d|d��d��|�d	|��d
��|�d|��d��|�d	|��d
��|�d
|��d��|�d|��d��|�d|��d��|�|�d�d��|�|�d��|�|�d��|�|�d��|�|�d�d��|�d|�d�d��|�d|��d��|�|�d|��d��|��d��|��d��|��d��|��d��|��d��|��d��|��d��|�tddg��dS)N�defzabc## �ghizabc## defghi�abc�	abcdefghi�4z
abcdefghidef z{x}z{x}defz{xz{xdefz{{x}}z{{x}}defz{{xz{{xdefzx}}zx}}defzdefx}}�2�def2�1�1def2�1def�-zdef-defr%�f-string: expecting '}'z
f'{3' f'}'�r(rr��r
r+s  r�test_compile_time_concatz!TestCase.test_compile_time_concats��������+�Q�+�+�+�^�<�<�<����+�!�+�+�+�[�9�9�9����4�!�4�4�q�9�4�4�o�F�F�F�����!���x�0�0�0��������g�.�.�.�����!���x�0�0�0�����A����4�4�4�����!���x�0�0�0�����!���x�0�0�0����A����x�0�0�0����A��E�*�*�*����q��u�-�-�-����q��E�*�*�*����A����V�,�,�,����������1�1�1��������V�,�,�,����A���A����3�3�3������$�$�$�����B�'�'�'������+�+�+�����b�!�!�!������$�$�$�����R�(�(�(������+�+�+����K�)B�)��	 �	 �	 �	 �	 rc���ddi}|�d�d��|�|d�d��|�tdgd���|�tddg��dS)N�#�hashz+f-string expression part cannot include '#')zf'{1#}'z	f'{3(#)}'zf'{#}'�f-string: unmatched '\)'zf'{)#}'r��r
�ds  r�
test_commentszTestCase.test_comments6s���
�&�M�����C��3�'�'�'����A�c�F��f�-�-�-����K�)V����	 �	 �	 �
	
���K�)D�&��	 �	 �	 �	 �	 rc���dd�}d}d}tdd��D]4}|�t||����|dz|z���5|�t|d��d	z��|dzd
z��|dd��}|�t|��|dzd
z��ddz}|�t|��d��dS)Nr%c��dd|zz|zdzS)Nzf'z{x} �'r)�n�extras  r�
build_fstrz2TestCase.test_many_expressions.<locals>.build_fstrKs���6�A�:�&��.��4�4rr!rF�ir���i��z{x:{width}} �zf'{1}' 'x' 'y'i�1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1x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C���	=�	=�A����T�*�*�Q�-�-�0�0�1�S�5�!�)�<�<�<�<�	
����j�j��o�o�c�1�2�2�Q�s�U�W�4E�F�F�F��J�s�N�+�+������a���1�S�5�#�+�.�.�.�
�t�#������a���,�/�/�/�/�/rc	��d}d}tjd��}|�d||�d|����d��|�d||�d|����d��|�d||d�d|d����d��|�d|d	�d
d�d|d����d��|�d|d	�d
d�d|d����d��|�ddd	�d��d
��|�dd�dd
�d���d
��|�ddd�dd
�d��d��|�dd�dd	�dd���d��|�dddddiko|�d��d
��|�tddg��|�tddg��|�tddg��|�tddg��dS)Nr�r7z12.34567zresult: �.zresult:      12.35�0r�rFrr��0xz
       0xar+i����r�z
      -0xarGrmr�zf'{"s"!r{":10"}}'�f-string: invalid syntaxzf'{4:{/5}}'z'f-string: expressions nested too deeplyz,f'result: {value:{width:{0}}.{precision:1}}'�&f-string: invalid conversion characterzf'{"s"!{"r"}}')�decimal�Decimalr(rr�)r
r��	precisionrOs    r�!test_format_specifier_expressionsz*TestCase.test_format_specifier_expressions_s������	���
�+�+�����?�E�5�?�?�9�?�?�?�?�AU�V�V�V����A�E�5�A�A�Y�A�A�A�A�CW�X�X�X����C�E�5�C�C�C�Y�C�C�C�C�C�EY�Z�Z�Z����B�E�1�B�a�B�B�B�I�B�B�B�B�B�DX�Y�Y�Y����E�E�A�E��E�E�E�y�E�E�E�E�E�G[�\�\�\����B��������6�6�6����B��/�/�a�/��/�/�/��>�>�>����C�-�#�-�-��-�-�-�-�|�<�<�<����C��1�1�q�1�1�3�1�1�1�<�@�@�@����B�9��q��e��!5��9�9�9�9�<�H�H�H����K�)B�4��	 �	 �	 �	
���K�)C�*��	 �	 �	 �
	
���K�)R�K��	 �	 �	 �
	
���K�)Q�2��	 �	 �	 �	 �	 rc�j�Gd�d��}|��}|�|�d|��d��dS)Nc��eZdZd�Zd�ZdS)�*TestCase.test_side_effect_order.<locals>.Xc��d|_dS)Nr)r�r4s rr5z3TestCase.test_side_effect_order.<locals>.X.__init__�s
������rc�J�|xjdz
c_t|j��S)NrF)r�r	rs  rrz5TestCase.test_side_effect_order.<locals>.X.__format__�s�����!�����4�6�{�{�"rN)rrr r5rrrrr!r��s2������
�
�
�
#�
#�
#�
#�
#rr!r�z1 2r�)r
r!r+s   r�test_side_effect_orderzTestCase.test_side_effect_order�s]��	#�	#�	#�	#�	#�	#�	#�	#�
�A�C�C�����A������U�+�+�+�+�+rc�2�|�tdgd���|�tdgd���|�tdgd���|�tdgd���|�td	d
dg��dS)Nz&f-string: empty expression not allowed)zf'{}'z
f'{ }'f' {} 'zf'{10:{ }}'zf' { } 'z
f'''{	
}'''z(f-string: expression required before '!')zf'{!r}'zf'{ !r}'zf'{!}'zf'''{	
!a}'''zf'{!'zf'{!s:'zf'{!x}'z	f'{ !xr}'zf'{!x:}'z	f'{!x:a}'z
f'{ !xr:}'zf'{ !xr:a}'z(f-string: expression required before ':')zf'{:}'zf'{ :!}'zf'{:2}'zf'''{	
:a}'''zf'{:'z(f-string: expression required before '=')zf'{=}'zf'{ =}'zf'{ =:}'z
f'{   =!}'zf'''{	
=}'''zf'{='z'invalid non-printable character U\+00A0uf'''{ }'''� r�r4s r�test_missing_expressionz TestCase.test_missing_expression�s������K�)Q�	�	�	�
	 �
	 �
	 �	
���K�)S����	 �	 �	 �*	
���K�)S����	 �	 �	 �	
���K�)S����	 �	 �	 �	
���K�)S�,�#��	 �	 �	 �	 �	 rc���|�d�d��|�tdddg��|�tddg��|�tddg��dS)	N)rGz(3,)r�zf'{,}'r�z
f'{3)+(4}'zunterminated string literalzf'{
}'r�r4s r�test_parens_in_expressionsz#TestCase.test_parens_in_expressions�s������4��&�)�)�)�	
���K�)C�%�%��	 �	 �	 �
	
���K�)D�)��	 �	 �	 �	
���K�)F�&��	 �	 �	 �	 �	 rc�B�|�tdgd���dS)N�invalid syntax)zf'{.}'z
f'{.}'z

f'{.}'r�r4s r�!test_newlines_before_syntax_errorz*TestCase.test_newlines_before_syntax_error�s2�����K�)9�4�4�4�	6�	6�	6�	6�	6rc��|�dd��|�dd��|�dd��|�d�d�d��|�d�dd��d��|�dd��d��|�dd��|�d	d	��|�d	d	��|�d�d�d
��|�d�dd��d��|�dd��d��|�dd��|�d
d
��|�d
d
��|�d�d�d
��|�d�dd��d��|�dd��d��|�dd��|�d�d�d
��|�d�dd��d��|�dd��d��|�d
d
��|�dd��|�dd��|�dd��|�dd��|�dd��|�d�d�d��|�d�dd��d��|�dd��d��|�dd��|�dd��|�dd��|�t��5td��}ddd��n#1swxYwY|�|d��|�dd��d��|�dd��d��d}|�dd��|�d|��d��|�d|��d��|�dd��dS)N�	z\trEz2	rGz2	3z	3uΔz\u0394u2Δu2Δ3uΔ3z
\U00000394r�z\x20z2 z2 3z 3z	f'\{6*7}'z\42�\�*�spam�&z\Nz\Nspamz\&)r(�assertWarns�DeprecationWarningr)r
rO�	AMPERSANDs   r�test_backslashes_in_string_partz(TestCase.test_backslashes_in_string_part�s��������%�%�%������&�&�&������'�'�'����A����5�)�)�)����A������f�-�-�-�����a���5�)�)�)�����H�-�-�-�����I�.�.�.�����Y�/�/�/����A����y�1�1�1����A���Q���*�5�5�5�����!���y�1�1�1������1�1�1�����
�6�6�6������7�7�7����A�)�)�)�9�5�5�5����A�,�,��,�,�j�9�9�9����)�a�)�)�9�5�5�5����:�H�E�E�E����A�=�=�=�y�I�I�I����A�@�@�Q�@�@�*�M�M�M����=�!�=�=�y�I�I�I����;�Y�G�G�G����<�j�I�I�I����;�Y�G�G�G�����#�&�&�&�����'�*�*�*�����7�+�+�+����A����T�*�*�*����A���1����.�.�.��������T�*�*�*�����4�(�(�(�����E�*�*�*�����4�(�(�(�
�
�
�0�
1�
1�	'�	'���&�&�E�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'������'�'�'�����c���V�,�,�,�����c���V�,�,�,��	�	
���)�3�/�/�/����*�y�*�*�I�6�6�6����*�y�*�*�I�6�6�6����+�U�3�3�3�3�3s�>M�M�!Mc�B�|�tdgd���dS)Nzi\(unicode error\) 'unicodeescape' codec can't decode bytes in position .*: malformed \\N character escape)
zf'\N'zf'\N 'zf'\N  'zf'\N{'z f'\N{GREEK CAPITAL LETTER DELTA'z'\N'z'\N 'z'\N  'z'\N{'z'\N{GREEK CAPITAL LETTER DELTA'r�r4s r�%test_misformed_unicode_character_namez.TestCase.test_misformed_unicode_character_names=��	
���K�*V�
�
�
�	 �	 �	 �	 �	 rc�B�|�tdgd���dS)Nz3f-string expression part cannot include a backslash)z
f'{\'a\'}'zf'{\t3}'zf'{\}'zrf'{\'a\'}'z	rf'{\t3}'zrf'{\}'zrf'{"\N{LEFT CURLY BRACKET}"}'zf'{\n}'r�r4s r�&test_no_backslashes_in_expression_partz/TestCase.test_no_backslashes_in_expression_part*s8�����K�)^����		 �		 �		 �		 �		 rc��|�dd��|�dd��|�dd��|�dd��dS)z@
        Only literal curly braces begin an expression.
        z{1+1}z{1+1Nr�r4s r�test_no_escapes_for_bracesz#TestCase.test_no_escapes_for_braces6sc��
	
����w�/�/�/�����V�,�,�,�����v�.�.�.����L�g�V�V�V�V�Vrc�b�|�d�d��|�d�d��dS)Nrr�rH�7r�r4s r�test_newlines_in_expressionsz%TestCase.test_newlines_in_expressions@sI�����A���%�%�%���� ��
�	�	�	�	�	rc���d�|��fd�d���d��|��fd�d��d�d��|��fd�d��d�d	��|�td
dg��dS)Nrmc����|zS�Nr�r,r+s �rr$z&TestCase.test_lambda.<locals>.<lambda>G����a��c�r�8z'88888'c����|zSrrrs �rr$z&TestCase.test_lambda.<locals>.<lambda>Hrr�10z
'88888'   c����|zSrrrs �rr$z&TestCase.test_lambda.<locals>.<lambda>Irrz
88888     r�zf'{lambda x:x}'r�r�s @r�test_lambdazTestCase.test_lambdaEs����
�����\�\�\�\�\�3�/�/�3�Y�?�?�?����\�\�\�\�\�3�/�/�6�6��E�E�E����\�\�\�\�\�3�/�/�4�4�l�C�C�C�	
���K�)C�.��	 �	 �	 �	 �	 rc��d�}|d��}|�t|��d��|�t|��d��dS)Nc3�(K�d|dzV���dV��dS)Nzy:rEr)r,s r�fnzTestCase.test_yield.<locals>.fnTs+�����q��s�������u�u�J�J�J�Jrr7r_)r(�next)r
r
r�s   r�
test_yieldzTestCase.test_yieldQs^��	�	�	�
�B�q�E�E������a���!�$�$�$�����a���$�'�'�'�'�'rc���d�}|d��}t|��}|�|d��d��|�|�d��d��dS)Nc3�$�K�d�fd�V���V�dS)N�x:c����|zSrr)r�r+s �rr$z6TestCase.test_yield_send.<locals>.fn.<locals>.<lambda>^s����A��rr�r+s`rr
z$TestCase.test_yield_send.<locals>.fn]s-�����0�o�o�o�o�.�.�0�0�0�0�0�0�0rr�r7�(�stringzx:string)rr(�send)r
r
r��
the_lambdas    r�test_yield_sendzTestCase.test_yield_send\sq��	1�	1�	1�
�B�r�F�F���!�W�W�
������A����+�+�+��������)�)�:�6�6�6�6�6rc�v�|�d�d��|�d�d��|�d�d��|�d�d��|�d�d��|�d�d��|�d�d��|�d�d��dS)Nr+zeric'szxeric"syzxeric"szeric"syr�r4s r�+test_expressions_with_triple_quoted_stringsz4TestCase.test_expressions_with_triple_quoted_stringses������G��s�+�+�+����L�*�H�5�5�5�	
���0�2�J�?�?�?����,�.�	�:�:�:����,�.�	�:�:�:����4�6�
�C�C�C����8�:�J�G�G�G����9�;�Z�H�H�H�H�Hrc���d}d}|�|�|��d��|�d|�|��d��|�|�d|��d��|�|�|�d�d��|�d|�d|��d	��|�d|�|�d�d
��|�|�d|�d�d��|�d|�d|�d�d
��dS)N�br��98abcr!�X98abc�98Xabc�98abcX�Y�X98Yabc�X98abcY�98XabcY�Z�X98YabcZr�)r
r+r,s   r�test_multiple_varszTestCase.test_multiple_varsqs���������A��q���G�,�,�,�����Q�����X�.�.�.����A������X�.�.�.����A��q����X�.�.�.�����Q������i�0�0�0�����Q������i�0�0�0����A�������i�0�0�0�����Q�������z�2�2�2�2�2rc��d�}|�|d����d��|�|d����d��dS)Nc����fd�}|S)Nc���d���S)Nrrrs�r�innerz3TestCase.test_closure.<locals>.outer.<locals>.inner�s����A�x�x�rr)r+r)s` r�outerz$TestCase.test_closure.<locals>.outer�s!���
 �
 �
 �
 �
 ��Lr�987zx:987rHzx:7r�)r
r*s  r�test_closurezTestCase.test_closure�sa��	�	�	�
	
������u������1�1�1�������q�����U�+�+�+�+�+rc���d��fd�}|�|dd��d��d}|�|dd��d��dS)NrEc���d|�z|���S�N�x=r)r+r�r,s  �rr�z"TestCase.test_arguments.<locals>.f�s���%��!��U�%�%�%�%r�foor�zx=foofoo    �barzx=        20r�)r
r�r+r,s   @r�test_argumentszTestCase.test_arguments�sn���
��	&�	&�	&�	&�	&�	
�����5�"���~�6�6�6��������2�r���N�3�3�3�3�3rc�<�d}|�d|��d��dS)N�{�v:zv:123r�)r
rOs  r�test_localszTestCase.test_locals�s)��������e���w�/�/�/�/�/rc��|�t��5dt��ddd��dS#1swxYwYdS)Nr6)r��	NameErrorrOr4s r�test_missing_variablezTestCase.test_missing_variable�s���
�
�
�y�
)�
)�	�	���L�L�L�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�3�7�7c�>�Gd�d��}|�|��d�d��|�|���d��|�|����d��|�d��d��|�d��d��dS)Nc��eZdZd�ZdS)�,TestCase.test_missing_format_spec.<locals>.Oc��|sdS|S)N�*rrs  rrz7TestCase.test_missing_format_spec.<locals>.O.__format__�s�����3��rNrrrr�Or=�s#������
�
�
�
�
rr@r+r?rG�3r�)r
r@s  r�test_missing_format_specz!TestCase.test_missing_format_spec�s���	�	�	�	�	�	�	�	�	
���A�A�C�C���S�)�)�)����A�A�C�C��3�'�'�'����A�A�C�C���C�(�(�(����A���#�&�&�&����A���C�(�(�(�(�(rc�z�|�dt��d��|�dt��d��d}|�dt�d|��d��|�dt��d��|�dt�d|��d��|�dt���dS)	N�g:zg:global variablezg:'global variable'�local variable� l:z"g:global variable l:local variablez$g:global variable l:'local variable'zmodule 'unittest' from)r(�a_global�assertIn�unittest)r
�a_locals  r�test_globalzTestCase.test_global�s�������h���*=�>�>�>����*�h�*�*�,A�B�B�B�"�����4�h�4�4�7�4�4�=�	?�	?�	?����*�h�*�*�.�	0�	0�	0����6�h�6�6�7�6�6�?�	A�	A�	A�	
�
�
�.�8�
�>�>�>�>�>rc��d}|�d|��d��|�d|��d��d}|�d|�d|��d��|�d|��d��|�d|�d|��d��dS)	Nzreally a localrDzg:really a localzg:'really a local'rErFz!g:really a local l:local variablez#g:really a local l:'local variable'r�)r
rGrJs   r�test_shadowed_globalzTestCase.test_shadowed_global�s���#������h���*<�=�=�=����*�h�*�*�,@�A�A�A�"�����4�h�4�4�7�4�4�<�	>�	>�	>����*�h�*�*�-�	/�	/�	/����6�h�6�6�7�6�6�>�	@�	@�	@�	@�	@rc�L�d�}|�|d���d��dS)Nc�&�dt|��zSr/rrs rr1zTestCase.test_call.<locals>.foo�s���#�a�&�&�=� rr�zx=10r�)r
r1s  r�	test_callzTestCase.test_call�s9��	!�	!�	!�	
���C�C��G�G��v�.�.�.�.�.rc�v�d}|�d�dz�d��|�|�dz�d��dS)NrmrrG�000�555r�)r
r,s  r�test_nested_fstringszTestCase.test_nested_fstrings�sI��
�����q�F�1�H���.�.�.����q�F�1�H���.�.�.�.�.rc�d�gd�}d�|D��}|�td||z��dS)N)zfu''zuf''zFu''zfU''zUf''zuF''zufr''zurf''zfur''zfru''zrfu''zruf''zFUR''zFur''zfb''zfB''zFb''zFB''zbf''zbF''zBf''zBF''c�:�g|]}|�dd����S)r��")�replace)�.0�cases  r�
<listcomp>z9TestCase.test_invalid_string_prefixes.<locals>.<listcomp>�s&��T�T�T��d�l�l�3��4�4�T�T�Trr�r�)r
�single_quote_cases�double_quote_casess   r�test_invalid_string_prefixesz%TestCase.test_invalid_string_prefixes�sa��&�&�&��,U�T�AS�T�T�T�����K�)9�.�1C�C�	E�	E�	E�	E�	Erc�J�|�d�d��|�d�d��|�d�d��|�d�d��|�dd�dD����d��|�dd�dD����d��dS)NrGrAzexpr=c��i|]\}}||��	Srr�rYr+r,s   r�
<dictcomp>z9TestCase.test_leading_trailing_spaces.<locals>.<dictcomp>����"?�"?�"?�D�A�q�1�a�"?�"?�"?r))rFrEzexpr={1: 2}c��i|]\}}||��	Srrras   rrbz9TestCase.test_leading_trailing_spaces.<locals>.<dictcomp>�rcrr�r4s r�test_leading_trailing_spacesz%TestCase.test_leading_trailing_spaces�s������Q��#�&�&�&����a��3�'�'�'����A��#�&�&�&����A��3�'�'�'����A�"?�"?�J�"?�"?�"?�A�A�&�	(�	(�	(����B�"?�"?�J�"?�"?�"?�B�B�&�	(�	(�	(�	(�	(rc���|�ddk�d��|�ddk��d��|�ddk�d��|�ddkd�d��dS)NrGr7�Truez.3�Trur�r4s r�test_not_equalzTestCase.test_not_equal�s~��
	
���A�q�D��F�+�+�+����A�q�D���V�,�,�,����A�q�D��f�-�-�-����A�q�D����/�/�/�/�/rc�<�|�ddk�d��dS)NrrF�Falser�r4s r�test_equal_equalzTestCase.test_equal_equal�s&��	
���A�q�D��G�,�,�,�,�,rc�&�|�dd�d��|�dd�d��|�dd�d��|�dd�d��|�d�d��|�d�d��|�d�d��|�d�d��|�dd�d	��|�td
gd���|�tdgd
���dS)Ng��Q�	@z10.10z
      3.14z
3.14      r�z'a'za!rz!<10.10z
3.14!!!!!!r�)zf'{3!g}'zf'{3!A}'zf'{3!3}'zf'{3!G}'zf'{3!!}'zf'{3!:}'z	f'{3! s}'r�)zf'{x!s{y}}'z	f'{3!ss}'z
f'{3!ss:}'zf'{3!ss:s}'r�r4s r�test_conversionszTestCase.test_conversionssT�����D���,�7�7�7����D�*�*�L�9�9�9����D�*�*�L�9�9�9����D�*�*�L�9�9�9����C��3�'�'�'����C��U�+�+�+����C��U�+�+�+�	
���E��U�+�+�+�	
���D�*�*�L�9�9�9����K�)Q����	 �	 �	 �	
���K�)B����	 �	 �	 �	 �	 rc�B�|�tdgd���dS)Nr�)zf'' = 3z
f'{0}' = xz
f'{x}' = xr�r4s r�test_assignmentzTestCase.test_assignment%s8�����K�):����	 �	 �	 �	 �	 rc�B�|�tdddg��dS)Nr�zdel f''z
del '' f''r�r4s r�test_delzTestCase.test_del,s4�����K�)9�&�)��	 �	 �	 �	 �	 rc�F�|�tdgd���|�tdgd���|�d�d��|�d�d��|�dd�d��d	��|�d
d�d��d��dS)Nz#f-string: single '}' is not allowed)zf'{{}'zf'{{}}}'zf'}'zf'x}'zf'x}x'z
f'\u007b}'zf'{3:}>10}'zf'{3:}}>10}'r�)zf'{3:{{>10}'zf'{3'zf'{3!'zf'{3:'zf'{3!s'zf'{3!s:'z	f'{3!s:3'zf'x{'zf'x{x'zf'{x'zf'{3:s'zf'{{{'zf'{{}}{'zf'{'zf'x{<'zf'x{>'zf'{i='r�r�rGz>10z
}}}}}}}}}3rEz
{{{{{{{{{2)rr�r(r4s r�test_mismatched_braceszTestCase.test_mismatched_braces2s������K�)N�
�
�
�	 �	 �	 �	
���K�)B����	 �	 �	 �*	
���C��3�'�'�'����C��3�'�'�'����A�s�����,�7�7�7����A�s�����,�7�7�7�7�7rc����fd�}�fd�}�fd�}|dd��|dd��|dd��|dd��|dd��|dd��dS)Nc�H��d}|�rd}nd}��||��dS�NrrFrEr��r+�expected�flagr
s   �r�test_fstringz2TestCase.test_if_conditional.<locals>.test_fstring_s:����D��v�
���������T�8�,�,�,�,�,rc�H��d}|�rd}nd}��||��dSrwr�rxs   �r�test_concat_emptyz7TestCase.test_if_conditional.<locals>.test_concat_emptygs:����D��y�
���������T�8�,�,�,�,�,rc�L��d}d|��rd}nd}��||��dS)Nrr�rFrEr�rxs   �r�test_concat_non_emptyz;TestCase.test_if_conditional.<locals>.test_concat_non_emptyos>����D��a�z�z�
���������T�8�,�,�,�,�,rr%rEr�rFr)r
r{r}rs`   r�test_if_conditionalzTestCase.test_if_conditionalZs����
	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	��R�������S�!������"�a� � � ���#�q�!�!�!���b�!�$�$�$���c�1�%�%�%�%�%rc���d}|�|�d��|�|��d��|�|��d��|�|��d��dS)N�testz'test'r�r�s  r�test_empty_format_specifierz$TestCase.test_empty_format_specifier�ss�������A���(�(�(����A���&�)�)�)����A���F�+�+�+����A���H�-�-�-�-�-rc�j�ddd�}d}|�|d�d��|�|d�d��|�||�d��|�d�|���d��|�d�|���d��dS)	Nr�integer)r�rrr�z{d[a]})r�z{d[0]})r(r))r
r�r�s   r�test_str_format_differencesz$TestCase.test_str_format_differences�s�����
�
��
�����A�a�D��I�.�.�.����A�c�F��h�/�/�/����A�a�D��I�.�.�.�������1��-�-�x�8�8�8�������1��-�-�y�9�9�9�9�9rc�~�|�tdddg��|�tdddg��dS)N�unsupportedzf'{(lambda: 0):x}'zf'{(0,):x}'zUnknown format codezf'{1000:j}')rr�r�r4s r�test_errorszTestCase.test_errors�s]�����I�}�2�+��	 �	 �	 �	
���J�(=�+�+��	�	�	�	�	rc��t��5}tj�|d��}t	|dd���5}|�d��ddd��n#1swxYwYt
|d���\}}}ddd��n#1swxYwY|�|�dd��|��dS)	Nzt.py�wzutf-8)�encodingzf"{a b}"�ascii)�PYTHONIOENCODING�backslashreplace)	r�os�path�join�open�writerrH�encode)r
�cwd�	file_pathr�rv�stderrs      r�test_filename_in_syntaxerrorz%TestCase.test_filename_in_syntaxerror�sK��
�Z�Z�	K�3�����S�&�1�1�I��i��w�7�7�7�
$�1����
�#�#�#�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$�0��BI�K�K�K�L�A�q�&�		K�	K�	K�	K�	K�	K�	K�	K�	K�	K�	K����	K�	K�	K�	K�	
�
�
�i�&�&�w�0B�C�C�V�L�L�L�L�Ls5�3B�A$�B�$A(	�(B�+A(	�,B�B�Bc�|�td��D]+}|�d|��dt|��z���,dS)Ni�zi:)r�r(r	)r
r�s  r�	test_loopzTestCase.test_loop�sJ���t���	6�	6�A����X�!�X�X�t�c�!�f�f�}�5�5�5�5�	6�	6rc��dddd�}|�|d�d��|�|d�d��|�|d�d��|�|d�d��dS)N�dquote�squoter2)rWr�r1r�rWr1r�r�s  r�	test_dictzTestCase.test_dict�s������
�
��	
���a��f��(�3�3�3����a��f��(�3�3�3����A�e�H���.�.�.����A�e�H���.�.�.�.�.rc��|�td��d��|�td��d��dS)Nzf"\
"r%zf"\
")r(rr4s r�test_backslash_charzTestCase.test_backslash_char�sB��	
����i���"�-�-�-�����i���"�-�-�-�-�-rc	�0��d�|�d���dt���z��|�d���dt���z��|�d���dt���z��|�d���dt���z��|�d���dt���z��d�|�d�d��dt	�d��z��|�d����dt	�d��z��|�d�d��dt	t���d��z��|�d�d��dt	t���d��z��|�d�d��dt	t���d��z��d�|�d	d
�zdz��d��d
}|�d|d��d��|�dd��d��|�ddd��d�d��d}|�d|�d�d��|�dd
��d��|�ddk�d ��|�ddk�d!��|�ddk�d!��|�ddk�d ��|�d"x��d"��|��d"��|�d#x��d"��|��d#��|�d$�d$��d%�|��d&�d'���fd(�}d�|�|d)�*���d+��|��d)��|�|d,�*���d)��|��d,��Gd-�d.��}|�d/|����d0��|�d/|����d0��|�d/|�����d1��|�d/|��d2��d3��|�d/|��d4��d5��|�d/|��d��d6��|�ttd7��d8�|�d9��d:�d9t���zd:z��|�d;��d:�d;t���zd:z��|�d<��d:�d<t���zd:z��|�d=��d:�d=t���zd:z��dS)>NzA stringr0zx =g����	�@z.2fr%z^20�	z3*x+15=rGr~z	3*x+15=42gffffff?@utenπ=utenπ=31.40u"Σ"=uΣu	"Σ"='Σ'z3.1415=go���!	@z.1fz*^20z*****3.1415=3.1*****uπualpha α pi=u	 ω omegaualpha α pi='π' ω omegaz
3
=z
3
=3rrFrkrg�5rm�=��=10�
        20c����}|�|Srr)r��oldxr+s  �rr�z)TestCase.test_debug_conversion.<locals>.f�s����D��A��Krz3=)r�r�r7c��eZdZd�Zd�ZdS)�)TestCase.test_debug_conversion.<locals>.Cc��d|��S)NzFORMAT-r)r
r�s  rrz4TestCase.test_debug_conversion.<locals>.C.__format__s��$��}�}�$rc��dS)N�REPRrr4s r�__repr__z2TestCase.test_debug_conversion.<locals>.C.__repr__s���vrN)rrr rr�rrr�Cr�s2������
%�
%�
%�
�
�
�
�
rr�zC()=zC()=REPRzC()=FORMAT-r�zC()=FORMAT- r+zC()=FORMAT-xzC()=********REPR********zf'{C=]'r1zXx=rzXx  =zXx=  zXx  =  )r(�reprr	r�r)r�r�r)r
�tenπ�pir�r�r+s     @r�test_debug_conversionzTestCase.test_debug_conversion�s*���������A���$��a���.�1�1�1�����A���5�4��7�7�?�3�3�3�����A���D�3�q�6�6�M�2�2�2�����A���D�4��7�7�N�3�3�3�����A���D�5��8�8�O�4�4�4�������A����d�V�A�u�-=�-=�&=�>�>�>�����A����4�&��B�-�-�#7�8�8�8�����A�����v�d�1�g�g�u�/E�/E�(E�F�F�F�����A�����v�c�!�f�f�e�/D�/D�(D�E�E�E�����A�����v�e�A�h�h��/F�/F�(F�G�G�G�
������A�a�C��F���{�3�3�3�������E����-�8�8�8�	
����D���]�3�3�3�	
���,�v�,�,�,�3�3�5K�L�L�L������3�R�3�3�3�5P�Q�Q�Q�	
��������	�	�	�	
���A�q�D��G�,�,�,����A�q�D��F�+�+�+����A�q�D��F�+�+�+����A�q�D��G�,�,�,�����V�Q���,�,�,�����C� � � �����T�Q��c�*�*�*�����A�������C��3�'�'�'���	
���A���\�2�2�2�	�	�	�	�	�

�����A�A��I�I�I���-�-�-�����D�!�!�!����A�A��F�F�F��d�+�+�+�����A����	�	�	�	�	�	�	�	�	
����A�A�C�C���J�/�/�/�����A�A�C�C���j�1�1�1�����A�A�C�C����]�3�3�3�����A�A�C�C����n�5�5�5�����A�A�C�C����n�5�5�5����)�A�A�C�C�)�)�)�+E�F�F�F����+�t�Y�7�7�7�
������Q����E�$�q�'�'�M�#�$5�6�6�6�	
����Q����g�d�1�g�g�o�c�&9�:�:�:�����Q����g�d�1�g�g�o�c�&9�:�:�:�����Q����	�$�q�'�'�(9�#�(=�>�>�>�>�>rc��d}|�|d�d��|�dx}�d��|�|d��dS)Nr�r�r�r�rr�r�s  r�test_walruszTestCase.test_walrus$s]����	
���A���\�2�2�2�	
����U�Q��t�,�,�,�����B�����rc��|�td��5tddd��ddd��dS#1swxYwYdS)Nr�z
f'{a $ b}'�?r:)rr�r=r4s r�!test_invalid_syntax_error_messagez*TestCase.test_invalid_syntax_error_message.s���
�
#�
#�K�1K�
L�
L�	/�	/��L�#�v�.�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s
�;�?�?c��tjd��}|�t|��5dd�ddd��dS#1swxYwYdS)NzCannot specify ',' with ','.rFz,,��re�escaperr��r
�	error_msgs  r�(test_with_two_commas_in_format_specifierz1TestCase.test_with_two_commas_in_format_specifier2����I�<�=�=�	�
�
#�
#�J�	�
:�
:�	�	��I�I�I�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��A�A�	Ac��tjd��}|�t|��5dd�ddd��dS#1swxYwYdS)NzCannot specify '_' with '_'.rF�__r�r�s  r�,test_with_two_underscore_in_format_specifierz5TestCase.test_with_two_underscore_in_format_specifier7r�r�c��tjd��}|�t|��5dd�ddd��dS#1swxYwYdS)N� Cannot specify both ',' and '_'.rFz,_r�r�s  r�8test_with_a_commas_and_an_underscore_in_format_specifierzATestCase.test_with_a_commas_and_an_underscore_in_format_specifier<����I�@�A�A�	�
�
#�
#�J�	�
:�
:�	�	��I�I�I�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	r�c��tjd��}|�t|��5dd�ddd��dS#1swxYwYdS)Nr�rFz_,r�r�s  r�7test_with_an_underscore_and_a_comma_in_format_specifierz@TestCase.test_with_an_underscore_and_a_comma_in_format_specifierAr�r�c�h�tjd��}|�t|��5t	ddd��ddd��n#1swxYwYtjd��}|�t|��5t	ddd��ddd��dS#1swxYwYdS)Nz"cannot use starred expression herezf'{*a}'r�r:z)cannot use double starred expression herezf'{**a}')r�r�rr�r=r�s  r�)test_syntax_error_for_starred_expressionsz2TestCase.test_syntax_error_for_starred_expressionsFs-���I�B�C�C�	�
�
#�
#�K��
;�
;�	,�	,��I�s�F�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,��I�I�J�J�	�
�
#�
#�K��
;�
;�	-�	-��J��V�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s#�A�A�A�B'�'B+�.B+N)Hrrr rr-rCr]rgrkrprxr|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr%r,r3r7r:rBrKrMrPrTr^rerirlrnrprrrtr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrsJ���������=�=�=�6"�"�"�04�4�4�>26�26�26�h+.�+.�+.�Z@5�@5�@5�D2�2�2�.MM�MM�MM�^32�32�32�j%�%�%�%�%�%�'�'�'� � � �$�$�$�
 � � �E�E�E�.! �! �! �F � � �> � � � 0�0�0�2# �# �# �J	,�	,�	,�8 �8 �8 �t � � �&6�6�6�54�54�54�n � � �&
 �
 �
 �W�W�W����

 �
 �
 �	(�	(�	(�7�7�7�
I�
I�
I�
3�
3�
3�,�,�,�4�4�4�0�0�0����)�)�)�?�?�?�@�@�@�/�/�/�/�/�/�
E�E�E�6	(�	(�	(�0�0�0�-�-�-� � � �B � � � � � �&8�&8�&8�P$&�$&�$&�L.�.�.�	:�	:�	:�	�	�	�M�M�M�6�6�6�	/�	/�	/�.�.�.�]?�]?�]?�P � � �/�/�/����
���
���
���
-�-�-�-�-rr�__main__)r;r�r�r&r�rI�test.support.os_helperr�test.support.script_helperrrGrr�mainrrr�<module>r�s����
�
�
�	�	�	�	�	�	�	�	�������������+�+�+�+�+�+�<�<�<�<�<�<���q-�q-�q-�q-�q-�x� �q-�q-�q-�f)�z����H�M�O�O�O�O�O��r