403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.230
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/test_tools/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/test_tools/__pycache__/test_unparse.cpython-36.pyc
3

�w2_� �@sdZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZe�ej
jed�Zejje��ddlZWdQRXdd�ZdZdZd	Zd
ZdZdZd
ZdZdZdZdZdZGdd�dej �Z!Gdd�de!�Z"Gdd�de!�Z#e$dkr�ej%�dS)z>Tests for the unparse.py script in the Tools/parser directory.�N)�basepath�toolsdir�skip_if_missing�parsercCsLt|d��}tj|j�d}WdQRXt|d|d��}|j�}WdQRX|S)znRead and return the contents of a Python source file (as a
    string), taking into account the file encoding.�rbrN�r)�encoding)�open�tokenize�detect_encoding�readline�read)�filenameZpyfiler�source�r�A/opt/alt/python36/lib64/python3.6/test/test_tools/test_unparse.py�read_pyfiles
rzQdef f():
    for x in range(10):
        break
    else:
        y = 2
    z = 3
zIdef g():
    while True:
        break
    else:
        y = 2
    z = 3
zQfrom . import fred
from .. import barney
from .australia import shrimp as prawns
zzdef f():
    x = 1
    def g():
        nonlocal x
        x = 2
        y = 7
        def h():
            nonlocal x, y
zOtry:
    1 / 0
except ZeroDivisionError as e:
    raise ArithmeticError from e
z@f1(arg)
@f2
class Foo: pass
z=if cond1:
    suite1
elif cond2:
    suite2
else:
    suite3
z,if cond1:
    suite1
elif cond2:
    suite2
zctry:
    suite1
except ex1:
    suite2
except ex2:
    suite3
else:
    suite4
finally:
    suite5
zwith f():
    suite1
zwith f() as x:
    suite1
z$with f() as x, g() as y:
    suite1
c@seZdZdd�Zddd�ZdS)�ASTTestCasecCs|jtj|�tj|��dS)N)ZassertEqual�ast�dump)�self�ast1�ast2rrr�assertASTEqual{szASTTestCase.assertASTEqual�internalcCsLt||dtj�}tj�}tj||�|j�}t||dtj�}|j||�dS)N�exec)	�compilerZ
PyCF_ONLY_AST�io�StringIO�unparseZUnparser�getvaluer)r�code1rrZunparse_buffer�code2rrrr�check_roundtrip~szASTTestCase.check_roundtripN)r)�__name__�
__module__�__qualname__rr#rrrrrzsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=S)>�UnparseTestCasecCs|jd�|jd�dS)Nz
f'{f"{0}"*3}'z
f'{f"{y}"*3}')r#)rrrr�
test_fstrings�s
zUnparseTestCase.test_fstringscCs|jd�dS)Nzdel x, y, z)r#)rrrr�test_del_statement�sz"UnparseTestCase.test_del_statementcCs|jd�|jd�dS)Nz45 << 2z13 >> 7)r#)rrrr�test_shifts�s
zUnparseTestCase.test_shiftscCs|jt�dS)N)r#�for_else)rrrr�
test_for_else�szUnparseTestCase.test_for_elsecCs|jt�dS)N)r#�
while_else)rrrr�test_while_else�szUnparseTestCase.test_while_elsecCs6|jd�|jd�|jd�|jd�|jd�dS)Nz(-1)**7z(-1.)**8z(-1j)**6znot True or FalsezTrue or not False)r#)rrrr�test_unary_parens�s




z!UnparseTestCase.test_unary_parenscCs|jd�dS)Nz3 .__abs__())r#)rrrr�test_integer_parens�sz#UnparseTestCase.test_integer_parenscCs,|jd�|jd�|jd�|jd�dS)NZ1e1000z-1e1000Z1e1000jz-1e1000j)r#)rrrr�test_huge_float�s


zUnparseTestCase.test_huge_floatcCs |jtd��|jtd��dS)N���?li�ll����)r#�str)rrrr�test_min_int�szUnparseTestCase.test_min_intcCs,|jd�|jd�|jd�|jd�dS)NZ7jz-7jZ0jz-0j)r#)rrrr�test_imaginary_literals�s


z'UnparseTestCase.test_imaginary_literalscCs|jd�dS)Nz(lambda: int)())r#)rrrr�test_lambda_parentheses�sz'UnparseTestCase.test_lambda_parenthesescCs|jd�|jd�dS)Nz
1 < 4 <= 5za is b is c is not d)r#)rrrr�test_chained_comparisons�s
z(UnparseTestCase.test_chained_comparisonscCs||jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�dS)
Nz
def f(): passzdef f(a): passzdef f(b = 2): passzdef f(a, b): passzdef f(a, b = 2): passzdef f(a = 5, b = 2): passzdef f(*, a = 1, b = 2): passzdef f(*, a = 1, b): passzdef f(*, a, b = 2): passz&def f(a, b = None, *, c, **kwds): passz'def f(a=2, *args, c=5, d, **kwds): passzdef f(*args, **kwargs): pass)r#)rrrr�test_function_arguments�s










z'UnparseTestCase.test_function_argumentscCs|jt�dS)N)r#�relative_import)rrrr�test_relative_import�sz$UnparseTestCase.test_relative_importcCs|jt�dS)N)r#�nonlocal_ex)rrrr�
test_nonlocal�szUnparseTestCase.test_nonlocalcCs|jt�dS)N)r#�
raise_from)rrrr�test_raise_from�szUnparseTestCase.test_raise_fromcCs|jd�dS)Nzb'123')r#)rrrr�
test_bytes�szUnparseTestCase.test_bytescCs6|jd�|jd�|jd�|jd�|jd�dS)Nzdef f(a : int): passzdef f(a: int = 5): passzdef f(*args: [int]): passzdef f(**kwargs: dict): passzdef f() -> None: pass)r#)rrrr�test_annotations�s




z UnparseTestCase.test_annotationscCs|jd�dS)Nz{'a', 'b', 'c'})r#)rrrr�test_set_literal�sz UnparseTestCase.test_set_literalcCs|jd�dS)Nz{x for x in range(5)})r#)rrrr�test_set_comprehension�sz&UnparseTestCase.test_set_comprehensioncCs|jd�dS)Nz{x: x*x for x in range(10)})r#)rrrr�test_dict_comprehension�sz'UnparseTestCase.test_dict_comprehensioncCs|jt�dS)N)r#�class_decorator)rrrr�test_class_decorators�sz%UnparseTestCase.test_class_decoratorscCs|jd�dS)Nz(class A(metaclass=type, *[], **{}): pass)r#)rrrr�test_class_definition�sz%UnparseTestCase.test_class_definitioncCs|jt�|jt�dS)N)r#�elif1�elif2)rrrr�
test_elifs�s
zUnparseTestCase.test_elifscCs|jt�dS)N)r#�try_except_finally)rrrr�test_try_except_finally�sz'UnparseTestCase.test_try_except_finallycCs,|jd�|jd�|jd�|jd�dS)Nza, *b, c = seqza, (*b, c) = seqza, *b[0], c = seqza, *(b, c) = seq)r#)rrrr�test_starred_assignment�s


z'UnparseTestCase.test_starred_assignmentcCs|jt�dS)N)r#�with_simple)rrrr�test_with_simple�sz UnparseTestCase.test_with_simplecCs|jt�dS)N)r#�with_as)rrrr�test_with_as�szUnparseTestCase.test_with_ascCs|jt�dS)N)r#�with_two_items)rrrr�test_with_two_items�sz#UnparseTestCase.test_with_two_itemscCs|jd�|jd�dS)Nz{**{'y': 2}, 'x': 1}z{**{'y': 2}, **{'x': 1}})r#)rrrr�test_dict_unpacking_in_dicts
z+UnparseTestCase.test_dict_unpacking_in_dictN)!r$r%r&r(r)r*r,r.r/r0r1r6r7r8r9r:r<r>r@rArBrCrDrErGrHrKrMrNrPrRrTrUrrrrr'�s<r'c@s:eZdZdZdZdejjdd�fZe	dd��Z
dd�ZdS)	�DirectoryTestCasez:Test roundtrip behaviour on all files in Lib and Lib/test.NZLib�testcCs�|jdk	r|jSg}xZ|jD]P}tjjt|�}x<tj|�D].}|jd�r:|jd�r:|j	tjj||��q:WqWt
jjd�s�t
j|d�}||_|S)Nz.pyZbadZcpu�
)�NAMES�test_directories�os�path�joinr�listdir�endswith�
startswith�appendrW�supportZis_resource_enabled�randomZsample)�cls�names�dZtest_dir�nrrr�	get_namess
zDirectoryTestCase.get_namesc
Cs�|j�}xt|D]l}tjjr&td|�tjj|�dkrPtjjrtd|�d��q|j|d��t	|�}|j
|�WdQRXqWdS)Nz
Testing %s�test_fstring.pyz	Skipping z: see issue 28002)r)ri)rhrWrb�verbose�printr[r\�basenameZsubTestrr#)rrerrrrr�
test_files#s
zDirectoryTestCase.test_files)r$r%r&�__doc__rYr[r\r]rZ�classmethodrhrmrrrrrVs
rV�__main__)&rnZunittestZtest.supportrWrr[rcr
rZtest.test_toolsrrrr\r]Zparser_pathrbZ
DirsOnSysPathrrr+r-r;r=r?rFrIrJrLrOrQrSZTestCaserr'rVr$�mainrrrr�<module>s>		
0

Youez - 2016 - github.com/yon3zu
LinuXploit