Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_fstring.cpython-39.opt-1.pyc

a

��g���@svddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
dZGdd�dej�Ze
dkrre��dS)�N)�temp_cwd�use_old_parser)�assert_python_failurezglobal variablec@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	�
e�d
�dd��Ze	�
e�d
�dd��Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%dBdC�Z&dDdE�Z'dFdG�Z(dHdI�Z)dJdK�Z*dLdM�Z+dNdO�Z,dPdQ�Z-dRdS�Z.dTdU�Z/dVdW�Z0dXdY�Z1dZd[�Z2d\d]�Z3d^d_�Z4d`da�Z5dbdc�Z6ddde�Z7dfdg�Z8dhdi�Z9djdk�Z:dldm�Z;dndo�Z<dpdq�Z=e	�
e�dr�dsdt��Z>dudv�Z?dwdx�Z@dydz�ZAd{d|�ZBd}d~�ZCdd��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�S)��TestCasec
Csn|D]d}|j|d��D|�||��t|�Wd�n1s@0YWd�q1s^0YqdS)N��str)ZsubTest�assertRaisesRegex�eval)�selfZexception_typeZregexZ
error_stringsr�r�-/usr/local/lib/python3.9/test/test_fstring.py�assertAllRaiseszTestCase.assertAllRaisecCs�Gdd�d�}|�}|�}t�dd�|�|_|�|�t|��|�|�d�|�t|�t|��|�|�d�d�|�|�d�d�|�t|��|d�d�|�t|��|d�d�dS)Nc@seZdZdd�ZdS)z(TestCase.test__format__lookup.<locals>.XcSsdS)N�classr�r
�specrrr�
__format__&sz3TestCase.test__format__lookup.<locals>.X.__format__N��__name__�
__module__�__qualname__rrrrr�X%srcSsdS)N�instancerrrrr�<lambda>.�z/TestCase.test__format__lookup.<locals>.<lambda>r�r)�types�
MethodTyper�assertEqual�format�type)r
r�x�yrrr�test__format__lookup#szTestCase.test__format__lookupcCsRGdd�d�}|�}d}t�|�}t|dd�}|�|j�t|�|�|j�dS)Nc@seZdZdd�Zdd�ZdS)zTestCase.test_ast.<locals>.XcSs
d|_dS)NF��called�r
rrr�__init__Asz%TestCase.test_ast.<locals>.X.__init__cSs
d|_dS)NT�r#r%rrr�__call__Csz%TestCase.test_ast.<locals>.X.__call__N)rrrr&r(rrrrr@sr�
a = 10
f'{a * x()}'r�exec)�ast�parse�compileZassertFalser$r*Z
assertTrue)r
rr �expr�t�crrr�test_ast>s
zTestCase.test_astcCs�d}t�|�}|�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)Nr)�r���)r+r,rr�Module�len�body�Assign�lineno�Expr�value�	JoinedStr�values�FormattedValue�BinOp�left�Name�op�Mult�right�Call�
col_offset�r
r.r/�binoprrr�test_ast_line_numbersVs0
 zTestCase.test_ast_line_numberscCs�d}t�|�}|�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()}'r2rr3r'r4����)r+r,rrr6r7r8r;r<r=r:r>�Constantrr?r@rArBrCrDrErFrGZAdd)r
r.r/Zbinop1Zbinop2rrr�.test_ast_line_numbers_multiple_formattedvaluesusX
      z7TestCase.test_ast_line_numbers_multiple_formattedvaluescCs�d}t�|�}|�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()}-"}'r2rr3r4r5�)r+r,rrr6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErGrOrrF)r
r.r/rI�callrrr�test_ast_line_numbers_nested�sJ
 z%TestCase.test_ast_line_numbers_nestedz8The old parser gets the offsets incorrectly for fstringscCs~d}t�|�}|�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()}'
r2rr3�r4r'r5�
�rMrN)r+r,rrr6r7r8r9r:r;r<r=r>r?rOrr@rArBrCrDrErFrGrHrrr�*test_ast_line_numbers_duplicate_expression�sp
       z3TestCase.test_ast_line_numbers_duplicate_expressioncCsDt�d�}|�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"r3rr4r2��)r+r,rr7r8r:rr;r<r=r>rOr?rB�
end_linenorG�end_col_offset)r
r/�_r.�namerrr�(test_ast_numbers_fstring_with_formattings 
   z1TestCase.test_ast_numbers_fstring_with_formattingcCsd}t�|�}|�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�dS)	Nz?
a = 10
f'''
  {a
     *
       x()}
non-important content
'''
r2rr3r4r'�r5)r+r,rrr6r7r8r9r:r;r<r=r>rOrr?rGr@rArBrCrDrErFrHrrr�'test_ast_line_numbers_multiline_fstring1sF	
     z0TestCase.test_ast_line_numbers_multiline_fstringcCsd}t�|�}|�t|�tj�|�t|j�d�|jdjjdj}|�t|�tj	�|�|j
d�|�|jd�|�|jd�|�|j
d�d}t�|�}|�t|�tj�|�t|j�d�|jdjjd}|�t|�tj�|�t|j�d�|j\}}}|�t|�tj�|�|j
d�|�|jd	�|�|jd
�|�|j
d�|j}|�t|�tj	�|�|j
t��rzdnd�|�|jt��r�dnd�|�|jt��r�d
nd�|�|j
t��r�dnd�|�t|�tj�|�|j
d�|�|jd	�|�|jd
�|�|j
d�dS)Nz
x = (
    f" {test(t)}"
)r3rr4rK�zv
x = (
        'PERL_MM_OPT', (
            f'wat'
            f'some_string={f(x)} '
            f'wat'
        ),
)
r'r_rL�rTrUrNrV�)r+r,rrr6r7r8r<r>rFr:rZrGr[�eltsr=rOr)r
r.r/rRZfstringZwat1ZmiddleZwat2rrr�&test_ast_line_numbers_with_parenthesescsD
	
z/TestCase.test_ast_line_numbers_with_parenthesescCs,dd�}|�|j�dd�}|�|j�dS)NcSsddS�NzNot a docstringrrrrr�f�sz"TestCase.test_docstring.<locals>.fcSsddSrfrrrrr�g�sz"TestCase.test_docstring.<locals>.g)ZassertIsNone�__doc__)r
rgrhrrr�test_docstring�szTestCase.test_docstringcCs:|�td��t�d�Wd�n1s,0YdS)Nzmalformed node or stringzf'x')r�
ValueErrorr+Zliteral_evalr%rrr�test_literal_eval�szTestCase.test_literal_evalcCs<dg}d}t�|�}t|dd�}t|�|�|dd�dS)Nrzx[0] = 'foo' f'{3}'r*rZfoo3)r+r,r-r*r)r
r r.r/r0rrr�test_ast_compile_time_concat�s
z%TestCase.test_ast_compile_time_concatcCs|�tdddg�dS)Nz&cannot mix bytes and nonbytes literalszf'' b''zb'' f''�r
�SyntaxErrorr%rrr�test_compile_time_concat_errors�s��z(TestCase.test_compile_time_concat_errorscCs(|��d�|�dd�|�dd�dS)Nr�a� �rr%rrr�test_literal�szTestCase.test_literalcCs|�tdgd��dS)Nzf-string: unterminated string)zf'{"x'zf'{"x}'zf'{("x'zf'{("x}'rnr%rrr�test_unterminated_string�s�z!TestCase.test_unterminated_stringcCsb|�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'{((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((}')r
ro�assertRaisesr	r%rrr�test_mismatched_parens�s �����zTestCase.test_mismatched_parenscCsr|�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'{ {{}} }')rr
�	TypeErrorr%rrr�test_double_braces�s8�zTestCase.test_double_bracescCs�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## Zghizabc## defghi�abcZ	abcdefghi�4z
abcdefghidef z{x}z{x}defz{xz{xdefz{{x}}z{{x}}defz{{xz{{xdefzx}}zx}}defzdefx}}�2Zdef2�1Z1def2Z1def�-zdef-defr�f-string: expecting '}'z
f'{3' f'}'�rr
ro�r
r rrr�test_compile_time_concat�s8�z!TestCase.test_compile_time_concatcCsNddi}|�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
�drrr�
test_commentss��zTestCase.test_commentscCs�ddd�}d}d}tdd�D] }|�t||��|d|�q|�t|d	�d
�|dd�|dd
�}|�t|�|dd�dd}|�t|�d�dS)NrcSsdd||dS)Nzf'z{x} �'r)�n�extrarrr�
build_fstr0sz2TestCase.test_many_expressions.<locals>.build_fstrrr3�irr��i��z{x:{width}} �zf'{1}' 'x' 'y'iA1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy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y1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy1xy)r)�rangerr	)r
r�r �width�i�srrr�test_many_expressions+s
 
zTestCase.test_many_expressionsc	Cs�d}d}t�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�|�ddd	�d��d
�|�dd�dd
�d���d
�|�ddd�dd
�d��d�|�dd�dd	�dd���d�|�dddddik�oH|�d��d
�|�tddg�t��rrdnd}|�t|dg�|�tddg�|�tddg�dS)Nrzr'z12.34567zresult: �.zresult:      12.35�0r�r3rr��0xz
       0xar i����r�z
      -0xar4rTr�zf'{"s"!r{":10"}}'�invalid syntax�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"}}')�decimalZDecimalrr
ror)r
r�Z	precisionr<�err_msgrrr�!test_format_specifier_expressionsDs:
"&& &�������z*TestCase.test_format_specifier_expressionscCs.Gdd�d�}|�}|�|�d|��d�dS)Nc@seZdZdd�Zdd�ZdS)z*TestCase.test_side_effect_order.<locals>.XcSs
d|_dS)Nr�r�r%rrrr&lsz3TestCase.test_side_effect_order.<locals>.X.__init__cSs|jd7_t|j�S)Nr3)r�rrrrrrnsz5TestCase.test_side_effect_order.<locals>.X.__format__N)rrrr&rrrrrrksrrrz1 2rs)r
rr rrr�test_side_effect_orderjszTestCase.test_side_effect_ordercCs(|�tdgd��|�tdddg�dS)Nz&f-string: empty expression not allowed)zf'{}'z
f'{ }'f' {} 'zf'{!r}'zf'{ !r}'zf'{10:{ }}'zf' { } 'z
f'''{	
}'''zf'{!x}'z	f'{ !xr}'zf'{!x:}'z	f'{!x:a}'z
f'{ !xr:}'zf'{ !xr:a}'zf'{!}'zf'{:}'zf'{!'zf'{!s:'zf'{:'zf'{:x'z'invalid non-printable character U\+00A0uf'''{ }'''� rnr%rrr�test_missing_expressionus�"��z TestCase.test_missing_expressioncCsR|�d�d�t�rdnd}|�t|ddg�|�tddg�|�tdd	g�dS)
N)r4z(3,)r�r�zf'{,}'r�z
f'{3)+(4}'z!EOL while scanning string literalzf'{
}'�rrr
ro�r
r�rrr�test_parens_in_expressions�s����z#TestCase.test_parens_in_expressionscCs�|�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��td�}Wd�n1�s00Y|�|d�|�dd��d�|�dd��d�d}|�dd�|�d|��d�|�d|��d�|�dd�dS)N�	z\tr2z2	r4z2	3z	3uΔz\u0394u2Δu2Δ3uΔ3z
\U00000394rrz\x20z2 z2 3z 3z	f'\{6*7}'z\42�\�*Zspam�&z\Nz\Nspamz\&)rZassertWarns�DeprecationWarningr	)r
r<Z	AMPERSANDrrr�test_backslashes_in_string_part�sX(z(TestCase.test_backslashes_in_string_partcCs|�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'rnr%rrr�%test_misformed_unicode_character_name�s�z.TestCase.test_misformed_unicode_character_namecCs|�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}'rnr%rrr�&test_no_backslashes_in_expression_part�s�z/TestCase.test_no_backslashes_in_expression_partcCs4|�dd�|�dd�|�dd�|�dd�dS)z@
        Only literal curly braces begin an expression.
        z{1+1}z{1+1Nrsr%rrr�test_no_escapes_for_bracessz#TestCase.test_no_escapes_for_bracescCs |�d�d�|�d�d�dS)Nrr�r5�7rsr%rrr�test_newlines_in_expressionss�z%TestCase.test_newlines_in_expressionscsxd�|��fdd�d��d�|��fdd�d�d�d�|��fd	d�d�d�d
�t�r`dnd}|�t|d
g�dS)NrTcs�|S�Nr�r!�r rrrrz&TestCase.test_lambda.<locals>.<lambda>�8z'88888'cs�|Sr�rr�r�rrrr�10z
'88888'   cs�|Sr�rr�r�rrrrz
88888     r�r�zf'{lambda x:x}'r�r�rr�r�test_lambdas�zTestCase.test_lambdacCs4dd�}|d�}|�t|�d�|�t|�d�dS)Ncssd|dV��dV�dS)Nzy:r2rr�rrr�fn'szTestCase.test_yield.<locals>.fnr'rK)r�next)r
r�rhrrr�
test_yield$szTestCase.test_yieldcCs>dd�}|d�}t|�}|�|d�d�|�|�d�d�dS)Nc3sd�fdd�V��VdS)N�x:cs�|Sr�rr�r�rrr1rz6TestCase.test_yield_send.<locals>.fn.<locals>.<lambda>rr�rr�rr�0sz$TestCase.test_yield_send.<locals>.fnrzr'�(�stringzx:string)r�r�send)r
r�rhZ
the_lambdarrr�test_yield_send/s
zTestCase.test_yield_sendcCst|�d�d�|�d�d�|�d�d�|�d�d�|�d�d�|�d�d�|�d�d�|�d�d�dS)Nr zeric'szxeric"syzxeric"szeric"syrsr%rrr�+test_expressions_with_triple_quoted_strings8sz4TestCase.test_expressions_with_triple_quoted_stringscCs�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~Z98abcrZX98abcZ98XabcZ98abcX�YZX98YabcZX98abcYZ98XabcY�ZZX98YabcZrs)r
r r!rrr�test_multiple_varsDszTestCase.test_multiple_varscCs0dd�}|�|d��d�|�|d��d�dS)Ncs�fdd�}|S)Ncs
d���S)Nr�rrr�rr�innerUsz3TestCase.test_closure.<locals>.outer.<locals>.innerr)r r�rr�r�outerTsz$TestCase.test_closure.<locals>.outerZ987zx:987r5zx:7rs)r
r�rrr�test_closureSszTestCase.test_closurecs<d��fdd�}|�|dd�d�d}|�|dd�d�dS)	Nr2csd|�|���S�N�x=r)r r�r�rrrg^sz"TestCase.test_arguments.<locals>.f�foorzzx=foofoo    �barzx=        20rs)r
rgr rr�r�test_arguments\s
zTestCase.test_argumentscCsd}|�d|��d�dS)N�{�v:zv:123rs)r
r<rrr�test_localseszTestCase.test_localscCs8|�t��dt��Wd�n1s*0YdS)Nr�)rv�	NameErrorr<r%rrr�test_missing_variableiszTestCase.test_missing_variablecCsfGdd�d�}|�|�d�d�|�|��d�|�|���d�|�d��d�|�d��d�dS)Nc@seZdZdd�ZdS)z,TestCase.test_missing_format_spec.<locals>.OcSs|sdS|S)N�*rrrrrrosz7TestCase.test_missing_format_spec.<locals>.O.__format__Nrrrrr�Onsr�r r�r4�3rs)r
r�rrr�test_missing_format_specmsz!TestCase.test_missing_format_speccCs||�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_localrrr�test_global{s���zTestCase.test_globalcCsrd}|�d|��d�|�d|��d�d}|�d|�d|��d�|�d|��d�|�d|�d|��d�dS)	Nzreally a localr�zg:really a localzg:'really a local'r�r�z!g:really a local l:local variablez#g:really a local l:'local variable'rs)r
r�r�rrr�test_shadowed_global�s���zTestCase.test_shadowed_globalcCsdd�}|�|d��d�dS)NcSsdt|�Sr�rr�rrrr��szTestCase.test_call.<locals>.foorzzx=10rs)r
r�rrr�	test_call�szTestCase.test_callcCs0d}|�d�d�d�|�|�d�d�dS)NrTrr4Z000Z555rs)r
r!rrr�test_nested_fstrings�szTestCase.test_nested_fstringscCs:gd�}dd�|D�}t�r dnd}|�t|||�dS)N)zfu''zuf''zFu''zfU''zUf''zuF''zufr''zurf''zfur''zfru''zrfu''zruf''zFUR''zFur''zfb''zfB''zFb''zFB''zbf''zbF''zBf''zBF''cSsg|]}|�dd��qS)r��")�replace)�.0Zcaserrr�
<listcomp>�rz9TestCase.test_invalid_string_prefixes.<locals>.<listcomp>r�zunexpected EOF while parsing)rr
ro)r
Zsingle_quote_casesZdouble_quote_cases�	error_msgrrr�test_invalid_string_prefixes�s���z%TestCase.test_invalid_string_prefixescCst|�d�d�|�d�d�|�d�d�|�d�d�|�ddd�dD���d�|�ddd�dD���d�dS)	Nr4r�zexpr=cSsi|]\}}||�qSrr�r�r r!rrr�
<dictcomp>�rz9TestCase.test_leading_trailing_spaces.<locals>.<dictcomp>))r3r2zexpr={1: 2}cSsi|]\}}||�qSrrr�rrrr��rrsr%rrr�test_leading_trailing_spaces�s��z%TestCase.test_leading_trailing_spacescCsP|�ddk�d�|�ddk��d�|�ddk�d�|�ddkd�d�dS)Nr4r'�Truez.3ZTrursr%rrr�test_not_equal�szTestCase.test_not_equalcCs|�ddk�d�dS)Nrr3�Falsersr%rrr�test_equal_equal�szTestCase.test_equal_equalcCs�|�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      rqz'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�r%rrr�test_conversions�s�
�zTestCase.test_conversionscCs|�tdgd��dS)Nr�)zf'' = 3z
f'{0}' = xz
f'{x}' = xrnr%rrr�test_assignment�s�zTestCase.test_assignmentcCs|�tdddg�dS)Nr�zdel f''z
del '' f''rnr%rrr�test_dels
��zTestCase.test_delcCsp|�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{>'rxryr4z>10z
}}}}}}}}}3r2z
{{{{{{{{{2)r
rorr%rrr�test_mismatched_braces
s�
�zTestCase.test_mismatched_bracescsd�fdd�}�fdd�}�fdd�}|dd�|d	d
�|dd�|d	d
�|dd
�|d	d
�dS)Ncs$d}|�rd}nd}��||�dS�Nrr3r2rs�r Zexpected�flagr%rr�test_fstring6s
z2TestCase.test_if_conditional.<locals>.test_fstringcs$d}|�rd}nd}��||�dSr�rsr�r%rr�test_concat_empty>s
z7TestCase.test_if_conditional.<locals>.test_concat_emptycs(d}d|��rd}nd}��||�dS)Nrrrr3r2rsr�r%rr�test_concat_non_emptyFs

z;TestCase.test_if_conditional.<locals>.test_concat_non_emptyrr2rrr3r)r
r�r�r�rr%r�test_if_conditional1s




zTestCase.test_if_conditionalcCsFd}|�|�d�|�|��d�|�|��d�|�|��d�dS)N�testz'test'rsr�rrr�test_empty_format_specifierWs
z$TestCase.test_empty_format_specifiercCspddd�}d}|�|d�d�|�|d�d�|�||�d�|�dj|d�d�|�dj|d�d�dS)	Nr�Zinteger)rqrrrqz{d[a]})r�z{d[0]})rr)r
r�rqrrr�test_str_format_differences^s�z$TestCase.test_str_format_differencescCs(|�tdddg�|�tdddg�dS)NZunsupportedzf'{(lambda: 0):x}'zf'{(0,):x}'zUnknown format codezf'{1000:j}')r
r{rkr%rrr�test_errorsis����zTestCase.test_errorsz6The old parser only supports <fstring> as the filenamec	Cs�t��d}tj�|d�}t|d��}|�d�Wd�n1s@0Yt|dd�\}}}Wd�n1sp0Y|�|�dd�|�dS)Nzt.py�wzf"{a b}"�ascii)ZPYTHONIOENCODING�backslashreplace)	r�os�path�join�open�writerr��encode)r
�cwdZ	file_pathrgr\�stderrrrr�test_filename_in_syntaxerrorts(�*z%TestCase.test_filename_in_syntaxerrorcCs,td�D]}|�d|��dt|��qdS)Ni�zi:)r�rr)r
r�rrr�	test_loopszTestCase.test_loopcCsXdddd�}|�|d�d�|�|d�d�|�|d�d�|�|d�d�dS)NZdquoteZsquoter�)r�r�r�r�r�r�rsr�rrr�	test_dict�s�zTestCase.test_dictcCs$|�td�d�|�td�d�dS)Nzf"\
"rzf"\
")rr	r%rrr�test_backslash_char�szTestCase.test_backslash_charcs�d�|�d���dt���|�d���dt���|�d���dt���|�d���dt���|�d���dt���d�|�d�d��dt�d��|�d����dt�d��|�d�d��dtt��d��|�d�d��dtt��d��|�d�d��dtt��d��d�|�d	d
�d��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"��d"�|��d"�|�d#��d"�|��d#�|�d$�d$�d%�|��d&�d'��fd(d)�}d�|�|d*d+��d,�|��d*�|�|d-d+��d*�|��d-�Gd.d/�d/�}|�d0|���d1�|�d0|���d1�|�d0|����d2�|�d0|�d3��d4�|�d0|�d5��d6�|�d0|�d��d7�|�ttd8�d9�|�d:��d;�d:t��d;�|�d<��d;�d<t��d;�|�d=��d;�d=t��d;�|�d>��d;�d>t��d;�dS)?NzA stringr�zx =g����	�@z.2frz^20�	z3*x+15=r4raz	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
=3rr3r�r��5rT�=��=10�
        20cs�}|�|Sr�r)rqZoldxr�rrrg�sz)TestCase.test_debug_conversion.<locals>.fz3=)rqr�r'c@seZdZdd�Zdd�ZdS)z)TestCase.test_debug_conversion.<locals>.CcSs
d|��S)NzFORMAT-r)r
r�rrrr�sz4TestCase.test_debug_conversion.<locals>.C.__format__cSsdS)NZREPRrr%rrr�__repr__�sz2TestCase.test_debug_conversion.<locals>.C.__repr__N)rrrrrrrrr�C�srzC()=zC()=REPRzC()=FORMAT-rrzC()=FORMAT- r zC()=FORMAT-xzC()=********REPR********zf'{C=]'r�zXx=r�zXx  =zXx=  zXx  =  )r�reprrrrrvror	)r
ttenπ�pirgrrr�r�test_debug_conversion�sn"""��   zTestCase.test_debug_conversioncCs6d}|�|d�d�|�d}�d�|�|d�dS)Nrrrrzr�rsr�rrr�test_walrus�szTestCase.test_walruscCsJt�r
dnd}|�t|��tddd�Wd�n1s<0YdS)Nr�r�z
f'{a $ b}'�?r*)rrror-r�rrr�!test_invalid_syntax_error_messagesz*TestCase.test_invalid_syntax_error_messagecCsBt�d�}|�t|��dd�Wd�n1s40YdS)NzCannot specify ',' with ','.r3z,,��re�escaperrk�r
r�rrr�(test_with_two_commas_in_format_specifiers
z1TestCase.test_with_two_commas_in_format_specifiercCsBt�d�}|�t|��dd�Wd�n1s40YdS)NzCannot specify '_' with '_'.r3�__rr!rrr�,test_with_two_underscore_in_format_specifiers
z5TestCase.test_with_two_underscore_in_format_specifiercCsBt�d�}|�t|��dd�Wd�n1s40YdS)N� Cannot specify both ',' and '_'.r3z,_rr!rrr�8test_with_a_commas_and_an_underscore_in_format_specifiers
zATestCase.test_with_a_commas_and_an_underscore_in_format_specifiercCsBt�d�}|�t|��dd�Wd�n1s40YdS)Nr%r3z_,rr!rrr�7test_with_an_underscore_and_a_comma_in_format_specifiers
z@TestCase.test_with_an_underscore_and_a_comma_in_format_specifierN)Irrrr
r"r1rJrPrSr�ZskipIfrrWr^r`rerjrlrmrprtrurwr|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
rrrrrr"r$r&r'rrrrrs�4-
B
25		#&(7

			
 
!'&

h
r�__main__)r+rrrr�r�Ztest.supportrrZtest.support.script_helperrr�rr�mainrrrr�<module>
s*	


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