403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.59
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 :  C:/Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python315/Lib/test/__pycache__/test_listcomps.cpython-315.opt-2.pyc
R
>lqjgc��]PHs]PHs]PHs]PHs]PHs]QHGsQsQQ\O2s	Q\-s
Qs\Q6Xc\O2P!P!)�)�
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��``�\sQs]bsnPPPQD\1QksQsQsQsU1Qks	Qs
QsQsQ	s
Q
sQsQsQ
sQsQsQsQsQsQsQsQsQsQsQsQsQsQsQs Qs!Qs"Qs#Q s$Q!s%Q"s&Q#s'Q$s(Q%s)Q&s*Q's+Q(s,Q)s-Q*s.Q+s/Q,s0Q-s1Q.s2Q/s3Q0s4Q1s5Q2s6Q3s7Q4s8Q5s9Q6s:Q7s;Q8s<Q9s=Q:s>Q;s?Q<s@Q=sAQ>sBQ?sCQ@sDQAsEQBsFQCsGQDsHUsIU9sJ!)E�ListComprehensionTestc��[OU2oS9%f,QNoSFCDoUOUQ59^tt^2UQ6Xc@[OQ2O[OUQ2Q5oQo	LKUQ6Xc@[OQ2O[OUQ2Q5oQ	o	LSoQ
o	U%cUO2L-o
UV�2S9%f-O
2FDvq�UOU	V�2V�2J	PPP2CJ	P!Sc&o
SO[S
2S2Po
=
K6Po
=
hh9h)%fhCJ_9h)�module�class�function)�scopezZ
                        class _C:
                            {code}
                    z    )�codec�*�[UQ*U2!)�_C)�getattr��moddict�names&&�(C:\Python315\\Lib\test\test_listcomps.py�
get_output�:ListComprehensionTest._check_in_scopes.<locals>.get_outputns��&�w�t�}�d�;�;�z�
                        def _f():
                            {code}
                            return locals()
                        _out = _f()
                    c�$�UQ*U*!)�_out�rs&&rrrws��&�v��t�4�4rc��V*!�Nrrs&&rrr{s
��&�}�,r)rrr)
�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_scopescsG�����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+�*�*�s\�E6	�AE6	�AE6	�!E6	�4E�<E6	�3E6	�E3�
E3�E.�)E6	�.E3�3E6	�6F
�?F
c�:�QoQ,QN-oUOV2P!)zf
            items = [(lambda i=i: i) for i in range(5)]
            y = [x() for x in items]
        �y)r�����r/�r$r
r%s&  r�*test_lambdas_with_iteration_var_as_default�@ListComprehensionTest.test_lambdas_with_iteration_var_as_default��#������(�����d�,rc�:�QoQ,QN-oUOV2P!)zb
            items = [(lambda: i) for i in range(5)]
            y = [x() for x in items]
        r2�r6r6r6r6r6r7r8s&  r�test_lambdas_with_free_var�0ListComprehensionTest.test_lambdas_with_free_var�r;rc��QQ2oUOUO,QN2UOU2O2U2P!)c�```�\sQs]�snU1Qks\]2T`t,tFD	nU1QkMJ	tos\Tt,tFD	p2MJ	tosQsUs	U9s
!ttohttoh)�JListComprehensionTest.test_class_scope_free_var_with_class_cell.<locals>.Cc�:�[2R!r)�super)r$�	__class__s&�r�method�QListComprehensionTest.test_class_scope_free_var_with_class_cell.<locals>.C.method�s����� � rc�
:�R!rr)�is�r�<lambda>�SListComprehensionTest.test_class_scope_free_var_with_class_cell.<locals>.C.<lambda>�s���arr)�__name__�
__module__�__qualname__�__firstlineno__rF�ranger r2�__static_attributes__�__classdictcell__�
__classcell__)rI�xrE�
__classdict__sp0@@r�CrB�sD����
!�+0��(�3�(�Q�i�(�3�E�#�$�e����e�$�A�A��4��$s
�A�ArVr=)r!r2r"rF)r$rVs& 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�B:�QoUOUQ[,-Q5P!)z0
            res = [super for x in [1]]
        �res)r%)r/rD)r$r
rEs& �r�test_references_super�+ListComprehensionTest.test_references_super�s&�����	
���d�U�U�G�,<��=rc�:�QoUOU[Q5P!)z4
            res = [__class__ for x in [1]]
        �r(�r/�	NameError�r$r
s& r�test_references___class__�/ListComprehensionTest.test_references___class__������	
���d�9��5rc�:�QoUOU[Q5P!)z@
            res = [(lambda: __class__)() for _ in [1]]
        r^r_ras& r� test_references___class___nested�6ListComprehensionTest.test_references___class___nested�rdrc�l�QQ2oUOUO]*2U2P!)c�X`�\sQs]�s],Tt,tFD	oU1QkMJ	tosQsU9s!ttoh)�GListComprehensionTest.test_references___class___nested_used.<locals>._Cc�
:�R!rr)rEs�rrJ�PListComprehensionTest.test_references___class___nested_used.<locals>._C.<lambda>�s���9rr)rLrMrNrOrZrQrS)�_rEs0@rrrj�s���/0�c�2�c��$�c�2�C��2s�'r)r"rZ�r$rs& r�%test_references___class___nested_used�;ListComprehensionTest.test_references___class___nested_used�s$��	3�	3��
�
�b�f�f�Q�i�k�2�&rc�p�QoUOUQ],-QQ,Q5UOU[Q,Q5P!)zN
            __class__ = 2
            res = [__class__ for x in [1]]
        rZrr�r%r'r�r(r'r_ras& r�!test_references___class___defined�7ListComprehensionTest.test_references___class___defined��H����	
����u�q�c�l�H�j�3I�	�	K����d�9�g�Y��Grc�p�QoUOUQ],-QQ,Q5UOU[Q,Q5P!)zZ
            __class__ = 2
            res = [(lambda: __class__)() for x in [1]]
        rZrrrrrrsr_ras& r�(test_references___class___defined_nested�>ListComprehensionTest.test_references___class___defined_nested�rvrc�:�QoUOU[Q5P!)z9
            class i: [__classdict__ for x in y]
        r^r_ras& r�test_references___classdict__�3ListComprehensionTest.test_references___classdict__�rdrc�b�QQ2oUOQUO]*2P!)c�f`�\sQs]�sn],Tt,tFDoU1Qk2MJ	tosQsUsP!ttoh)�FListComprehensionTest.test_references___classdict___nested.<locals>._Cc�
:�R!rr)rUs�rrJ�OListComprehensionTest.test_references___classdict___nested.<locals>._C.<lambda>�s���Mrr)rLrMrNrOrZrQrR)rmrUs0@rrr�s"����78�c�:�c��)�,�c�:�C��:s�.rrZ)�assertInrZrns& r�$test_references___classdict___nested�:ListComprehensionTest.test_references___classdict___nested�s"��	;�	;��
�
�e�R�V�V�A�Y�'rc�:�QoUOU[Q5P!)zG
            class i: [__conditional_annotations__ for x in y]
        r^r_ras& r�+test_references___conditional_annotations__�AListComprehensionTest.test_references___conditional_annotations__�rdrc�:�QoUOU[Q5P!)zO
            class i: [lambda: __conditional_annotations__ for x in y]
        r^r_ras& r�2test_references___conditional_annotations___nested�HListComprehensionTest.test_references___conditional_annotations___nested�rdrc�:�QoUOU[Q5P!)z
            __class__ = 2
            class C:
                res = [__class__ for x in [1]]
            res = C.res
        r^r_ras& r�#test_references___class___enclosing�9ListComprehensionTest.test_references___class___enclosing�s����	
���d�9��5rc�:�QoUOU[Q5P!)zO
            [super for _ in [1]]
            [__class__ for _ in [1]]
        r^r_ras& r�*test_super_and_class_cell_in_sibling_comps�@ListComprehensionTest.test_super_and_class_cell_in_sibling_comps�s����	
���d�9��5rc�>�QoQ,QNQ]-oUOV2P!)zu
            items = [(lambda: i) for i in range(5)]
            i = 20
            y = [x() for x in items]
        r2rIr=r7r8s&  r�test_inner_cell_shadows_outer�3ListComprehensionTest.test_inner_cell_shadows_outer�s'����
���b�1�����d�,rc�>�QoQ]],Q]-oUOV2P!)z�
            def f(x):
                return [lambda: x for x in range(x)], x
            fns, x = f(2)
            y = [fn() for fn in fns]
        r2rTr7r8s&  r�&test_inner_cell_shadows_outer_no_store�<ListComprehensionTest.test_inner_cell_shadows_outer_no_store�s+������A���Q�'�����d�,rc�B�QoQ,QN-oUOVQQ,Q5P!)zt
            items = [(lambda: y) for i in range(5)]
            y = 2
            z = [x() for x in items]
        �zrr�r')r4r4r4r4r4r7r8s&  r�%test_closure_can_jump_over_comp_scope�;ListComprehensionTest.test_closure_can_jump_over_comp_scopes-����
��(�����d�X�z�4J��Krc�@�QoQ],-oUOVQQ,Q5P!)z�
            def f():
                return [lambda: x for x in (x, [1])[1]]
            x = ...
            y = [fn() for fn in f()]
        r2rrr�r7r8s&  r�test_cell_inner_free_outer�0ListComprehensionTest.test_cell_inner_free_outers.�������*�����d�X�z�4J��Krc�r�QoQ],-oUOVQQ,Q5UOUQ,[Q5P!)zj
            g = 2
            def f():
                return g
            y = [g for x in [1]]
        r2rrr�r�r'r(r_r8s&  r�test_free_inner_cell_outer�0ListComprehensionTest.test_free_inner_cell_outersE�������*�����d�X�z�4J��K����d�G�9�Y��Grc�>�QoQ]
Q,QN-oUOV2P!)z�
            y = 10
            items = [(lambda: y) for y in range(5)]
            x = y
            y = 20
            out = [z() for z in items]
        rT�outr=r7r8s&  r�'test_inner_cell_shadows_outer_redefined�=ListComprehensionTest.test_inner_cell_shadows_outer_redefined#s'������E�?�3�����d�,rc�>�QoQP-oUOVQP-Q5P!)zu
            def inner():
                return g
            [g for g in range(5)]
            x = inner()
        rT�g�r&r7r8s&  r�test_shadows_outer_cell�-ListComprehensionTest.test_shadows_outer_cell.s+������)�����d��b�	��:rc�H�QoQ]Q]Q],-oUOVQ]-Q5P!)zy
            global g
            x = g
            g = 2
            items = [g for g in [1]]
            y = g
        rTr2r r�r�r7r8s&  r�test_explicit_global�*ListComprehensionTest.test_explicit_global8�6������3��7�Q�C�0�����d��a���9rc�H�QoQ]Q]Q],-oUOVQ]-Q5P!)zy
            global g
            x = g
            g = 2
            items = [g for x in [1]]
            y = g
        rTr2r r�r�r7r8s&  r�test_explicit_global_2�,ListComprehensionTest.test_explicit_global_2Cr�rc�@�QoQ],-oUOVQ]-Q5P!)zr
            global g
            fns = [lambda: g for g in [2]]
            items = [fn() for fn in fns]
        r r�r�r7r8s&  r�test_explicit_global_3�,ListComprehensionTest.test_explicit_global_3Ns-����
�Q�C�.�����d��a���9rc�>�QoQ]-oUOVQQ,Q5P!)zK
            x = -1
            items = [(x:=y) for y in range(3)]
        rTrrr�r7r8s&  r�test_assignment_expression�0ListComprehensionTest.test_assignment_expressionWs,������(�����d�X�z�4J��Krc�6�QoQ]-oUOV2P!)z�
            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]()
        rTr7r8s&  r�test_free_var_in_comp_child�1ListComprehensionTest.test_free_var_in_comp_child`s"������(�����d�,rc�6�QoQP-oUOV2P!)z�
            lst = range(3)
            x = -1
            funcs = [lambda: x for x in lst]
            items = [x + 1 for x in lst]
        rTr7r8s&  r�test_shadow_with_free_and_local�5ListComprehensionTest.test_shadow_with_free_and_localk�"������)�����d�,rc�8�QoQ],-oUOV2P!)z<
            x = [1]
            y = [x for x in x]
        rTr7r8s&  r�test_shadow_comp_iterable_name�4ListComprehensionTest.test_shadow_comp_iterable_nameus$�������*�����d�,rc�>�QoQ]-oUOVQQ,Q5P!)z
            x = 1
            def g():
                [x for x in range(3)]
                return x
            g()
        rTrrr�r7r8s&  r�test_nested_free�&ListComprehensionTest.test_nested_free}s,������(�����d�X�z�4J��Krc�6�QoQ]-oUOV2P!)zz
            import sys
            [i for i in range(2)]
            i = 20
            sys._getframe().f_locals
        rIr7r8s&  r�test_introspecting_frame_locals�5ListComprehensionTest.test_introspecting_frame_locals�r�rc�B�QoQ]],,QN,-oUOV2P!)zX
            l = [2, 3]
            y = [[x ** 2 for x in range(x)] for x in l]
        r2)rr3r6r7r8s&  r�test_nested�!ListComprehensionTest.test_nested�s,�����!�Q���+�,�����d�,rc�t�QoQ,QN-oUOVQQ,Q5UOUQ,[Q5P!)zt
            l = [1, 2, 3]
            x = 3
            y = [x for [x ** x for x in range(x)][x - 1] in l]
        r2rrr�rr�)r5r5r5r_r8s&  r�
test_nested_2�#ListComprehensionTest.test_nested_2�sD����
�	�"�����d�X�z�4J��K����d�G�9�Y��Grc�:�QoQ,QN-oUOV2P!)zv
            l = [(1, 2), (3, 4), (5, 6)]
            y = [x for (x, [x ** x for x in range(x)][x - 1]) in l]
        r2)r3r5�r7r8s&  r�
test_nested_3�#ListComprehensionTest.test_nested_3�s#�����	�"�����d�,rc�T�QoQ]],]1]],]1]],]1,-oUOV2P!)z�
            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�r7r8s&  r�
test_nested_4�#ListComprehensionTest.test_nested_4�sB�����Q��F�A�;�!�Q����q�!�f�a�[�A�B�����d�,rc�:�QoUOU[Q5P!)z4
            [x for x in [1]]
            x
        r^r_ras& r�test_nameerror�$ListComprehensionTest.test_nameerror�s����
	
���d�9��5rc�8�QoQ],-oUOV2P!)z.
            y = [__x for __x in [1]]
        r2r7r8s&  r�test_dunder_name�&ListComprehensionTest.test_dunder_name�s$�������*�����d�,rc��QoUO[29^tt^2U2PPP2P!)%fhP!9h)c�8�],Tt,tFDpMJ	oW!ttoh)Fr�rTs 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�
1�
�C�2�
1�
1�
1���4�A	�A	c��QoUO[29^tt^2U2PPP2P!)%fhP!9h)c�L�P,o]],,Tt,tFDvW]$o]MJ
	to!ttohrr)�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�
1�
�C�2�
1�
1�
1�r�c�t�QoUOUQQ-Q]-QQ,Q5UOU[Q,Q5P!)	z�
            a = 1
            def f():
                func, = [(lambda: b) for b in [a]]
                return b, func()
            x = f()
        rT�brr�r&r'rrs)r4r3r_ras& 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�t�QoUOUQQ-Q]-QQ,Q5UOU[Q,Q5P!)	z�
            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()
        rTr�rrr�rrs)r4r4r3r_ras& r�!test_cell_in_nested_comprehension�7ListComprehensionTest.test_cell_in_nested_comprehension�sO����	
����3�	�"��Q�x��X�8N�	�	P�	
���d�9�g�Y��Grc�>�QoUOU[Q,Q5P!)zA
            y = 1
            [x + y for x in range(2)]
        rrsr_ras& r�test_name_error_in_class_scope�4ListComprehensionTest.test_name_error_in_class_scope�s"����	
���d�9�g�Y��Grc�F�QoQQQ,-oUOVQ]-Q,Q5P!)zI
            y = 2
            vals = [(x, y) for x in range(2)]
        �valsr2rr��rr3�r3r3r7r8s&  r�test_global_in_class_scope�0ListComprehensionTest.test_global_in_class_scope�s5�����F�F�+�,�����d��a��'���Krc�F�QoQQQ,-oUOVQ]-Q,Q5P!)z�
            class C:
                y = 2
                vals = [(x, y) for x in range(2)]
            vals = C.vals
        r�r2rr�r�r�r7r8s&  r�%test_in_class_scope_inside_function_1�;ListComprehensionTest.test_in_class_scope_inside_function_1�s5�����F�F�+�,�����d��a��*���Nrc�@�QoQQQ,-oUOVQ,Q5P!)z�
            y = 1
            class C:
                y = 2
                vals = [(x, y) for x in range(2)]
            vals = C.vals
        r�rr�r�r�r7r8s&  r�%test_in_class_scope_inside_function_2�;ListComprehensionTest.test_in_class_scope_inside_function_2s/�����F�F�+�,�����d�Z�L��Arc�v�QoQQQ,-oUOVQQ,Q5QQQ	,-oUOVQ,Q5P!)
a;
            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�rrr�r�rr4�r3r4r�r�r7r8s&  r�test_in_class_scope_with_global�5ListComprehensionTest.test_in_class_scope_with_globalsV��
���F�F�+�,�����d�X�w�4G��H��F�F�+�,�����d�Z�L��Arc�@�QoQQQ,-oUOVQ,Q5P!)a=
            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�rr�rrr7r8s&  r�!test_in_class_scope_with_nonlocal�7ListComprehensionTest.test_in_class_scope_with_nonlocal$s/��
���F�F�+�,�����d�Z�L��Arc�>�QoQ],-oUOVQ,Q5P!)zB
            items = [a for a in [1] if [a for _ in [0]]]
        r rr�r7r8s&  r�test_nested_has_free_var�.ListComprehensionTest.test_nested_has_free_var3s+�����Q�C�.�����d�W�I��>rc�r�QoUOUQ],-QQ,Q5UOUQ,-Q]-Q,Q5P!)zY
            z = 1
            items = [a for a in [1] if [x for x in [1] if z]]
        r rrr�r�rr�r7ras& r�,test_nested_free_var_not_bound_in_outer_comp�BListComprehensionTest.test_nested_free_var_not_bound_in_outer_comp:sL����	
���d�W�q�c�N�H�j�;Q��R����d�W�b�M�s�A�h��y��Qrc�6�QoUOUQ],-2P!)z]
            items = [_C for _C in [1] for [0, 1][[x for x in [1] if _C][0]] in [2]]
        r r7ras& r�test_nested_free_var_in_iter�2ListComprehensionTest.test_nested_free_var_in_iterBs!����	
���d�W�q�c�N�3rc�B�QoUOUQ],1]],1,-2P!)zM
            items = [(_C, [x for x in [1] if _C]) for _C in [0, 1]]
        r r7ras& r�test_nested_free_var_in_expr�2ListComprehensionTest.test_nested_free_var_in_exprHs/����	
���d�W��2�w��Q�C��.A�$B�Crc�:�QoUOUQ]QQ,-2P!)z�
            f = [(z, lambda y: [(x, y, z) for x in [3]]) for z in [1]]
            (z, func), = f
            out = func(2)
        r�r�)r5r4r3r7ras& r�test_nested_listcomp_in_lambda�4ListComprehensionTest.test_nested_listcomp_in_lambdaNs&����
	
���d�S�!�U�Y�K�$@�Arc�8�QoUOUQ]QP-2P!)z�
            (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
        �cr.r7ras& r�test_lambda_in_iter�)ListComprehensionTest.test_lambda_in_iterVs$����	
���d�S�!�S�$�$7�8rc�<�QoUOUQ],-Q,Q5P!)z*
            a = [1 for a in [0]]
        �arr�r7ras& r�.test_assign_to_comp_iter_var_in_outer_function�DListComprehensionTest.test_assign_to_comp_iter_var_in_outer_function`s(����	
���d�S�1�#�J�
�|��Drc��QoUOUQP	Q,-Q,Q5UOUQP	QQ,-Q,Q5UOU[Q,Q5P!)	z�
            def b():
                [a for b in [1] for _ in []]
                return b, locals()
            r, s = b()
            x = r is b
            y = list(s.keys())
        rTr2rr�r�rrrsr_ras& r�test_no_leakage_to_locals�/ListComprehensionTest.test_no_leakage_to_localsfsd����	
���d�S�$��R�$8�(���L����d�S�$��c�U�$;�Z�L��Q����d�9�g�Y��Grc
�T�QoUOUQ]],Q]],QP	P	,Q]],Q]-2P!)aJ
            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]
        r �items2�items3�items4r2r7ras& r�!test_iter_var_available_in_locals�7ListComprehensionTest.test_iter_var_available_in_localsssJ��	��	
�����!�Q���1�a�&��4��,��1�a�&��Q�
�		
rc	���QoUOQQ5oUOUQQ,Q],QP-2UOQQ5oUOUQQ,QPQQ,-[Q5P!)	z�
            value = ["ab"]
            result = snapshot = None
            try:
                result = [{func}(value) for value in value]
            except ValueError:
                snapshot = value
                raise
        �len��func�value�ab�result�snapshot�intr^�rr/�
ValueError�r$�templater
s&  r�test_comp_in_try_except�-ListComprehensionTest.test_comp_in_try_except�sz�������E��*�����d�W�t�f�h���Z�QU�$V�W����E��*�����d�W�t�f�h��j�SW�RX�$Y�%/�	�	1rc	���QoUOQQ5oUOUQQ,Q],QQ,-2UOQQ5oUOUQQ,QPQQ,-[Q5P!)	z�
            value = ["ab"]
            result = snapshot = None
            try:
                result = [{func}(value) for value in value]
            finally:
                snapshot = value
        r.r/r1r2r3r4r5r^r6r8s&  r�test_comp_in_try_finally�.ListComprehensionTest.test_comp_in_try_finally�s}�������E��*�����d�W�t�f�h���Z�RV�QW�$X�Y����E��*�����d�W�t�f�h��j�SW�RX�$Y�%/�	�	1rc�8�QoUOUQ]P,-2P!)z�
            value = [1, None]
            try:
                [v for v in value].sort()
            except TypeError:
                pass
        r1r7ras& r� test_exception_in_post_comp_call�6ListComprehensionTest.test_exception_in_post_comp_call�s$����	
���d�W�q�$�i�$8�9rc�x�Qo]PHoUOUQP
-QU-Q5QoUOUQ]-QU-Q5P!)zM
            val = "a" in [sys._getframe().f_locals for a in [0]][0]
        �val�sysr�zK
            val = [sys._getframe().f_locals["a"] for a in [0]][0]
        )rDr/)r$r
rDs&  r�test_frame_locals�'ListComprehensionTest.test_frame_locals�sQ����	����d�U�E�N��s�|��D���	
���d�U�A�J�E�3�<��@rc�`�[U[O2%fU!SO[9PIc&,U1QkUO
2DMJ	3Q5!U1QkUO
22Q5!)c3�R:�SF �DoROU2w�	J	P!3hr)�_recursive_replace)�.0rr$s& �r�	<genexpr>�;ListComprehensionTest._recursive_replace.<locals>.<genexpr>�s!��0D���0D�1�D�#�#�A�&�&�0D�s�')�	co_consts)�
isinstance�types�CodeType�replace�tuplerM)r$�
maybe_codesf&rrI�(ListComprehensionTest._recursive_replace�sr����*�e�n�n�5�5����!�!�E�E�2
�0:�0D�0D�2
�E�E�!��	�E�2
�0:�0D�0D�2
�-
�!��	rc�Z�[UQQ2oUOU2o[V22P!)z<string>�exec)�compilerIrV)r$�code_stringr&�cos&&& r�_replacing_exec�%ListComprehensionTest._replacing_exec�s'��
�[�*�f�
5��
�
$�
$�R�
(���R�rc��QoUOUQ],Q]-2UOUQ],Q]-UOQ5P!)za
            x = 3
            [x for x in (1, 2)]
            dir()
            y = [x]
        r2rT�r))r/rZras& r�test_code_replace�'ListComprehensionTest.test_code_replace�sL����	
���d�S�1�#�s�A�$6�7����d�S�1�#�s�A�$6�$�BV�BV��Wrc	�|�QoQOQ[U222oQOQ[U222oQ[[U22-[U2Tt-tFD	oQU0UaJ	toAoQUQUQ	UQ
UQ0	oUOVe2UOVeUOQ5P!ttoh)
�,z; c3�>�SF �DoQUQU0w�	J	P!3h)rTz = r�rJrIs& rrK�GListComprehensionTest.test_code_replace_extended_arg.<locals>.<genexpr>�s��7G���7G�!�!�A�3�c�!��
�7G�s�z, c3�8�SF �DoQU0w�	J
	P!3hr�rrcs& rrKrd�s��/?���/?�!��!��g�/?�s�r2rTz
            z
            [(z) for z6 in (range(300),)]
            dir()
            y = [z
]
        r])�joinrP�listr/rZ)r$�	num_names�assignments�	name_listrI�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�%B9c��QoUOUQ],-Q]-Q5QoUOUQ]Q],-Q]-Q,Q5UOUQ]Q],-Q]-QQ,Q5P!)	zG
            [x for x in [1]]
            y = [x for _ in [1]]
        r2rTr�zY
            x = 2
            [x for x in [1]]
            y = [x for _ in [1]]
        rr�rrr7ras& r�&test_multiple_comprehension_name_reuse�<ListComprehensionTest.test_multiple_comprehension_name_reuse�s�����	
���d�S�1�#�J�C��8��<���
	
���d�S�!�S�1�#�$6�C��8�W�I��V����d�S�!�S�1�#�$6�C��8�Z�Ya�Lb��crc
�b�QoQoQoUQ1UQ1UQ11FD�vqEUOU29^tt^2U2o[OUO2]*o]oUOo	UOUOU	O]*2UOUOU	O]*2UOUOUOU*
UOU*
U2PPP2CJ	P!)%fhCJ9h)c�~�[P	Q5Tt,tFDpMJ	oP!ttoh[c
oStPo=!Po=hh9h)T)�init_raises�r�	Exception�rTr.s  rrs�CListComprehensionTest.test_exception_locations.<locals>.init_raises��8��
�&�4�8�9�8�q��8�9��9���
����
��$�
%� �%�%�	<�<�7�<�<c�~�[P	Q5Tt,tFDpMJ	oP!ttoh[c
oStPo=!Po=hh9h)T)�next_raisesrtrvs  rr{�CListComprehensionTest.test_exception_locations.<locals>.next_raisesrxryc�~�[P	Q5Tt,tFDpMJ	oP!ttoh[c
oStPo=!Po=hh9h)T)�iter_raisesrtrvs  rr~�CListComprehensionTest.test_exception_locations.<locals>.iter_raisesrxryzBrokenIter(init_raises=True)zBrokenIter(next_raises=True)zBrokenIter(iter_raises=True))r�	traceback�
extract_tb�
__traceback__�__code__r!�lineno�co_firstlineno�
end_lineno�line�colno�	end_colno)
r$rsr{r~r0rk�excr�rrYs
&         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�CD	�D.
�%D.
r)KrLrMrNrOrVr/r9r>rWr[rbrfrortrxr{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�rrrrrrrrrrr"r%r+r:r=r@rErIrZr^rlror�rQrRrS)rErUs@@rrrbs�����-1�d�4�PR�#'�"E�H-�-�	'�>�6�6�'�
H�H�6�(�
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�P�UO[O22U!r)�addTest�doctest�DocTestSuite)�loader�tests�patterns&&&r�
load_testsr�s��	�M�M�'�&�&�(�)��Lr�__main__)r�rr�rO�unittest�test.supportrr��TestCaser�__test__r�rL�mainrrr�<module>r�s^�������#�U��px
+�H�-�-�x
+�t
��"���
�z���M�M�O�r

Youez - 2016 - github.com/yon3zu
LinuXploit