Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_with.cpython-312.opt-1.pyc

�

'Μgo��P�dZdZdZddlZddlZddlZddlmZddlm	Z	m
Z
mZGd�de	�Zd	�Z
Gd
�de�Ze
d��ZGd
�de�ZGd�de�ZGd�dej&�ZGd�de�ZGd�dej&e�ZGd�dej&e�ZGd�deej&�ZGd�dej&�ZGd�dej&�ZGd�d ej&�ZGd!�d"ej&�Zed#k(rej<�yy)$z7Unit tests for the with statement specified in PEP 343.z
Mike Blandzmbland at acm dot org�N)�deque)�_GeneratorContextManager�contextmanager�nullcontextc�*��eZdZ�fd�Zd�Zd�Z�xZS)�MockContextManagerc�H��t�|�|�d|_d|_d|_y�NF)�super�__init__�enter_called�exit_called�	exit_args)�self�args�	__class__s  ��+/usr/local/lib/python3.12/test/test_with.pyrzMockContextManager.__init__s'���
���$��!��� ������c�:�d|_tj|�S�NT)r
r�	__enter__�rs rrzMockContextManager.__enter__s�� ���'�1�1�$�7�7rc�T�d|_|||f|_tj||||�Sr)rrr�__exit__�r�type�value�	tracebacks    rrzMockContextManager.__exit__s6�������y�1���'�0�0��t�16�	�C�	Cr)�__name__�
__module__�__qualname__rrr�
__classcell__)rs@rrrs����8�Crrc����fd�}|S)Nc���t�||�S�N)r)r�kwds�funcs  �r�helperz#mock_contextmanager.<locals>.helper!s���!�$��d�3�3r�)r'r(s` r�mock_contextmanagerr* s
���4��Mrc��eZdZd�Zy)�MockResourcec� �d|_d|_yr
)�yielded�stoppedrs rrzMockResource.__init__'s�������rN�rr r!rr)rrr,r,&s��rr,c#�^K�t�}	d|_|��d|_y#d|_wxYw�wr)r,r.r/)�mocks r�mock_contextmanager_generatorr3,s,�����>�D������
�����t���s�-�!�-�	*�-c��eZdZd�Zd�Zd�Zy)�Nestedc� �||_d|_yr%)�managers�entered�rr7s  rrzNested.__init__8s�� ��
���rc�D�|j�td��t�|_g}	|jD]<}|j	|j��|jj
|��>	|S#|jtj��s�Y|SxYw)NzContext is not reentrant)
r8�RuntimeErrorrr7�appendr�
appendleftr�sys�exc_info)r�vars�mgrs   rrzNested.__enter__<s����<�<�#��9�:�:��w�����	��}�}�����C�M�M�O�,����'�'��,�%����	� �4�=�=�#�,�,�.�1��2���s�AA8�8$Bc���|}|jD]}	|j|�rd}�d|_||ur|�y#t$r"}t|�||jf}Yd}~�Kd}~wwxYw�N)NNN)r8r�
BaseExceptionr�
__traceback__)rr?�exrA�es     rrzNested.__exit__Jsq�����<�<�C�
3��3�<�<��$�+�B�� ����
�X���H���!�
3��1�g�q�!�/�/�2���
3�s�4�	A�A�AN�rr r!rrrr)rrr5r56s����
rr5c��eZdZd�Zd�Zd�Zy)�
MockNestedc�Z�tj|g|���d|_d|_d|_yr
)r5rr
rrr9s  rrzMockNested.__init__[s*������(�x�(�!��� �����rc�:�d|_tj|�Sr)r
r5rrs rrzMockNested.__enter__as�� �������%�%rc�J�d|_||_tj|g|���Sr)rrr5r�rr?s  rrzMockNested.__exit__es%�����!������t�/�h�/�/rNrHr)rrrJrJZs���&�0rrJc�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�FailureTestCasec�6�d�}|jt|�y)Nc�:�t5ddd�y#1swYyxYwr%��foor)rr�fooNotDeclaredz5FailureTestCase.testNameError.<locals>.fooNotDeclaredms������s��)�assertRaises�	NameError)rrUs  r�
testNameErrorzFailureTestCase.testNameErrorls��	����)�^�4rc�\��Gd�dt���fd�}|jtd|�y)Nc��eZdZd�Zy)�<FailureTestCase.testEnterAttributeError1.<locals>.LacksEnterc��yr%r)rs    rrzEFailureTestCase.testEnterAttributeError1.<locals>.LacksEnter.__exit__s���rN)rr r!rr)rr�
LacksEnterr[r���
rr^c�B����}|5ddd�y#1swYyxYwr%r))rTr^s �r�
fooLacksEnterz?FailureTestCase.testEnterAttributeError1.<locals>.fooLacksEntervs����,�C��������the context manager��object�assertRaisesRegex�	TypeError)rrar^s  @r�testEnterAttributeError1z(FailureTestCase.testEnterAttributeError1qs)���	��	�	�	
���y�*?��Orc�\��Gd�dt���fd�}|jtd|�y)Nc��eZdZy)�CFailureTestCase.testEnterAttributeError2.<locals>.LacksEnterAndExitN�rr r!r)rr�LacksEnterAndExitrk|s��rrmc�B����}|5ddd�y#1swYyxYwr%r))rTrms �r�fooLacksEnterAndExitzFFailureTestCase.testEnterAttributeError2.<locals>.fooLacksEnterAndExits���#�%�C����rbrcrd)rrorms  @r�testEnterAttributeError2z(FailureTestCase.testEnterAttributeError2{s*���	��	�	�	
���y�*?�AU�Vrc�\��Gd�dt���fd�}|jtd|�y)Nc��eZdZd�Zy)�9FailureTestCase.testExitAttributeError.<locals>.LacksExitc��yr%r)rs rrzCFailureTestCase.testExitAttributeError.<locals>.LacksExit.__enter__�r]rN)rr r!rr)rr�	LacksExitrs�r_rruc�B����}|5ddd�y#1swYyxYwr%r))rTrus �r�fooLacksExitz<FailureTestCase.testExitAttributeError.<locals>.fooLacksExit�s����+�C����rbzthe context manager.*__exit__rd)rrwrus  @r�testExitAttributeErrorz&FailureTestCase.testExitAttributeError�s)���	��	�	�	
���y�*I�<�Xrc�8�d�}|jt||�y)Nc��t|dd�y)N��single)�compile)�ss r�shouldRaiseSyntaxErrorzGFailureTestCase.assertRaisesSyntaxError.<locals>.shouldRaiseSyntaxError�s���A�r�8�$r)rV�SyntaxError)r�codestrrs   r�assertRaisesSyntaxErrorz'FailureTestCase.assertRaisesSyntaxError�s��	%����+�'=�w�Grc�H�|jd�|jd�y)Nzwith mock as None:
  passzwith mock as (None):
  pass�r�rs r�testAssignmentToNoneErrorz)FailureTestCase.testAssignmentToNoneError�s$���$�$�%A�B��$�$�
�	rc�H�|jd�|jd�y)Nzwith mock as None,:
  passzwith mock as (None,):
  passr�rs r�,testAssignmentToTupleOnlyContainingNoneErrorz<FailureTestCase.testAssignmentToTupleOnlyContainingNoneError�s$���$�$�%B�C��$�$�
�	rc�&�|jd�y)Nz%with mock as (foo, None, bar):
  passr�rs r�(testAssignmentToTupleContainingNoneErrorz8FailureTestCase.testAssignmentToTupleContainingNoneError�s���$�$�
�	rc����Gd�dt����fd�}�jt|��j�jd�y)Nc��eZdZd�Zd�Zy)�4FailureTestCase.testEnterThrows.<locals>.EnterThrowsc��td��)NzEnter threw�r;rs rrz>FailureTestCase.testEnterThrows.<locals>.EnterThrows.__enter__�s
��"�=�1�1rc��yr%r)�rrs  rrz=FailureTestCase.testEnterThrows.<locals>.EnterThrows.__exit__�r]rN�rr r!rrr)rr�EnterThrowsr��s��
2�
rr�c�\����}d�_|5�_	ddd�y#1swYyxYwr%rS)�ctr�rs ��r�shouldThrowz4FailureTestCase.testEnterThrows.<locals>.shouldThrow�s'�����B��D�H��t�x�����s�"�+)rerVr;�assertEqualrT)rr�r�s` @r�testEnterThrowszFailureTestCase.testEnterThrows�s:���	�&�	�	�	
���,��4�������4�(rc�Z��Gd�dt���fd�}|jt|�y)Nc��eZdZd�Zd�Zy)�2FailureTestCase.testExitThrows.<locals>.ExitThrowsc��yr%r)rs rrz<FailureTestCase.testExitThrows.<locals>.ExitThrows.__enter__�s��rc��td��)N�*r�r�s  rrz;FailureTestCase.testExitThrows.<locals>.ExitThrows.__exit__�s
��"�2�&�&rNr�r)rr�
ExitThrowsr��s��
�
'rr�c�@����5	ddd�y#1swYyxYwr%r))r�s�rr�z3FailureTestCase.testExitThrows.<locals>.shouldThrow�s���������s��)rerVr;)rr�r�s  @r�testExitThrowszFailureTestCase.testExitThrows�s&���	'��	'�
	�	
���,��4rN)
rr r!rXrhrprxr�r�r�r�r�r�r)rrrPrPks8��5�
P�W�Y�H�
���
)�$	5rrPc�F�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z		dd	�Z
d
�Zy)�ContextmanagerAssertionMixinc�$�td�|_y)Nztest exception)r;�TEST_EXCEPTIONrs r�setUpz"ContextmanagerAssertionMixin.setUp�s��*�+;�<��rc��|j|j�|j|j�|j	|j
d�yr%)�
assertTruer
�assertFalserr�r�r�mock_managers  r�assertInWithManagerInvariantsz:ContextmanagerAssertionMixin.assertInWithManagerInvariants�s>������1�1�2�����1�1�2�����/�/��6rc��|j|j�|j|j�|j|j|�yr%)r�r
rr�r)rr�rs   r� assertAfterWithManagerInvariantsz=ContextmanagerAssertionMixin.assertAfterWithManagerInvariants�s<������1�1�2�����0�0�1�����/�/��;rc�(�|j|d�yrC)r�r�s  r�'assertAfterWithManagerInvariantsNoErrorzDContextmanagerAssertionMixin.assertAfterWithManagerInvariantsNoError�s���-�-�l��	 rc�p�|j|j�|j|j�yr%)r�r.r�r/�r�mock_generators  r�assertInWithGeneratorInvariantsz<ContextmanagerAssertionMixin.assertInWithGeneratorInvariants�s(������.�.�/�����/�/�0rc�p�|j|j�|j|j�yr%�r�r.r/r�s  r�)assertAfterWithGeneratorInvariantsNoErrorzFContextmanagerAssertionMixin.assertAfterWithGeneratorInvariantsNoError��&������.�.�/�����.�.�/rc��|j�r%)r�rs r�raiseTestExceptionz/ContextmanagerAssertionMixin.raiseTestException�s���!�!�!rNc��|j|j�|j|j�|�>|j|jd|j
�t
|j
�}|j|jd|�|j|jd|�|j|jdd�y)N�r�)	r�r
rr�rr�r�assertIsInstance�assertIsNot)rr��exc_types   r�)assertAfterWithManagerInvariantsWithErrorzFContextmanagerAssertionMixin.assertAfterWithManagerInvariantsWithError�s�������1�1�2�����0�0�1������\�3�3�A�6��8K�8K�L��D�/�/�0�H�����/�/��2�H�=����l�4�4�Q�7��B�����/�/��2�D�9rc�p�|j|j�|j|j�yr%r�r�s  r�+assertAfterWithGeneratorInvariantsWithErrorzHContextmanagerAssertionMixin.assertAfterWithGeneratorInvariantsWithError�r�rr%)rr r!r�r�r�r�r�r�r�r�r�r)rrr�r��s5��=�7�
<�
 �1�0�"�<@�
:�0rr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�NonexceptionalTestCasec�D�t�5	ddd�y#1swYyxYwr%�r3rs r�testInlineGeneratorSyntaxz0NonexceptionalTestCase.testInlineGeneratorSyntax�s��
*�
,��-�
,�
,�s��c�j�t�}|5	ddd�|j|�y#1swY�xYwr%)r3r�)rr2s  r�testUnboundGeneratorz+NonexceptionalTestCase.testUnboundGenerator�s+��,�.��
����4�4�T�:��T�s�)�2c��t�5}|j|�ddd�|j�y#1swY�xYwr%�r3r�r��rrTs  r�testInlineGeneratorBoundSyntaxz5NonexceptionalTestCase.testInlineGeneratorBoundSyntax�s6��
*�
,���0�0��5�-�	
�6�6�s�;�-�
,��	�7�Ac��t�5}|j|�ddd�|j�y#1swY�xYwr%r�r�s  r�*testInlineGeneratorBoundToExistingVariablezANonexceptionalTestCase.testInlineGeneratorBoundToExistingVariables4��
*�
,���0�0��5�-��6�6�s�;�-�
,�r�c��t�5|_|j|j�ddd�|j|j�y#1swY�%xYwr%)r3rTr�r�rs r�(testInlineGeneratorBoundToDottedVariablez?NonexceptionalTestCase.testInlineGeneratorBoundToDottedVariables>��
*�
,����0�0����:�-��6�6�t�x�x�@�-�
,�s�!A�Ac���t�}|5}|j|�|j|�ddd�|j�|j	|�y#1swY�,xYwr%)r3r�r�r�r�)rr2rTs   r�testBoundGeneratorz)NonexceptionalTestCase.testBoundGeneratorsV��,�.��
�S��0�0��5��.�.�t�4��	
�6�6�s�;��4�4�T�:�	�T�s�#A�A$c���t�}|5}t�}|5}|j|�|j|�|j|�|j|�ddd�|j|�|j	�|j|�|j|�ddd�|j|�|j	�y#1swY�xxYw#1swY�8xYwr%)r3r�r�r�r�)r�mock_arT�mock_b�bars     r�testNestedSingleStatementsz1NonexceptionalTestCase.testNestedSingleStatementss���.�0��
�s�2�4�F��3��2�2�6�:��2�2�6�:��4�4�S�9��4�4�S�9�	�

�8�8��@��:�:�3�?��.�.�v�6��0�0��5��	
�4�4�V�<��6�6�s�;�����V�s$�
C"�AC�AC"�C	�C"�"C+N)
rr r!r�r�r�r�r�r�r�r)rrr�r��s&���;�<�<�
A�
;�<rr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�NestedNonexceptionalTestCasec�V�tt��5	ddd�y#1swYyxYwr%�r5r3rs r�"testSingleArgInlineGeneratorSyntaxz?NestedNonexceptionalTestCase.testSingleArgInlineGeneratorSyntax&s��
�1�3�
4��5�
4�
4�s��(c��t�}t|�5}|j|�ddd�|j|�y#1swY�xYwr%�r3r5r�r��r�mrTs   r�testSingleArgBoundToNonTuplez9NestedNonexceptionalTestCase.testSingleArgBoundToNonTuple*s>��)�+���A�Y�#��.�.�q�1���4�4�Q�7��Y���A�Ac��t�}t|�5}|j|�ddd�|j|�y#1swY�xYwr%r�r�s   r�2testSingleArgBoundToSingleElementParenthesizedListzONestedNonexceptionalTestCase.testSingleArgBoundToSingleElementParenthesizedList2s>��)�+���A�Y�3��.�.�q�1���4�4�Q�7��Y�r�c�6�d�}|jt|�y)Nc�\�tt��5\}}	ddd�y#1swYyxYwr%r�)rTr�s  r�shouldThrowValueErrorziNestedNonexceptionalTestCase.testSingleArgBoundToMultipleElementTupleError.<locals>.shouldThrowValueError;s#���5�7�8�J�S�#��9�8�8�s�"�+)rV�
ValueError)rr�s  r�-testSingleArgBoundToMultipleElementTupleErrorzJNestedNonexceptionalTestCase.testSingleArgBoundToMultipleElementTupleError:s��	�	
���*�&;�<rc���t�}t|�}|5|j|�|j|�ddd�|j|�|j|�y#1swY�,xYwr%�r3rJr�r�)rr*�mock_nesteds   r�testSingleArgUnboundz1NestedNonexceptionalTestCase.testSingleArgUnbound@sb��;�=�� �!4�5��
��.�.�/B�C��.�.�{�;��	
�4�4�5H�I��4�4�[�A�	�[�s�#A&�&A/c��t�}t�}t�}t|||�}|5|j|�|j|�|j|�|j|�ddd�|j|�|j|�|j|�|j|�y#1swY�NxYwr%r�)rr��n�or�s     r�testMultipleArgUnboundz3NestedNonexceptionalTestCase.testMultipleArgUnboundIs���)�+��)�+��)�+�� ��A�q�)��
��.�.�q�1��.�.�q�1��.�.�q�1��.�.�{�;�	�
	
�4�4�Q�7��4�4�Q�7��4�4�Q�7��4�4�[�A��[�s�AC�C	c��tt�t�t��}|5\}}}|j|�|j|�|j|�|j|�ddd�|j	�|j	�|j	�|j|�y#1swY�NxYwr%)rJr3r�r�r�r�)rr�r�r�r�s     r�testMultipleArgBoundz1NestedNonexceptionalTestCase.testMultipleArgBoundXs��� �!>�!@�)�+�-J�-L�N��
�I�Q��1��0�0��3��0�0��3��0�0��3��.�.�{�;�	�
	
�6�6�q�9��6�6�q�9��6�6�q�9��4�4�[�A��[�s�A	B>�>CN)
rr r!r�r�r�r�r�r�r�r)rrr�r�$s(���8�8�=�B�
B�Brr�c�T�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�ExceptionalTestCasec����t����fd�}�jt|��j���j	�j
�y)Nc����5�_�j���j�j��j�ddd�y#1swYyxYwr%)�resourcer�r�r���cmrs��rr�z;ExceptionalTestCase.testSingleResource.<locals>.shouldThrowis@����t�}��2�2�2�6��4�4�T�]�]�C��'�'�)����s�AA�A)r3rVr;r�r�r��rr�r�s` @r�testSingleResourcez&ExceptionalTestCase.testSingleResourcegsB���
*�
,��	*�
	
���,��4��6�6�r�:��8�8����Grc����t����fd�}�jt|��j�t�y)Nc�H���5�_ddzddd�y#1swYyxYw�Nr�r)r�r�s��rr�z@ExceptionalTestCase.testExceptionNormalized.<locals>.shouldThrowts����t�}��Q�����s��!)r3rV�ZeroDivisionErrorr�r�s` @r�testExceptionNormalizedz+ExceptionalTestCase.testExceptionNormalizedrs4���
*�
,��	�
	
���+�[�9��6�6�r�;L�Mrc�����t��t�����fd�}�jt|��j���j���j	�j
��j	�j�y)Nc�F���5�_�5�_�j���j���j�j��j�j��j	�ddd�ddd�y#1swY�xYw#1swYyxYwr%�rTr�r�r�r��r�r�rs���rr�zCExceptionalTestCase.testNestedSingleStatements.<locals>.shouldThrowsw����4�8��t�x��6�6�v�>��6�6�v�>��8�8����B��8�8����B��+�+�-�����V����s#�B�A.B�:B�B	�B�B )r3rVr;r�r�rTr��rr�r�r�s` @@rr�z.ExceptionalTestCase.testNestedSingleStatements|sj���.�0��.�0��	.�	
���,��4��6�6�v�>��6�6�v�>��8�8����B��8�8����Brc�Z�����t��t��t��������fd�}�jt|��j	���j	���j	���j�j��j�j�y)Nc�@���5\�_�_�j���j���j���j�j��j�j��j	�ddd�y#1swYyxYwr%)�
resource_a�
resource_br�r�r�)�cm_a�cm_br�rs����rr�zOExceptionalTestCase.testMultipleResourcesInSingleStatement.<locals>.shouldThrow�su���� B���$�/��2�2�4�8��2�2�4�8��2�2�;�?��4�4�T�_�_�E��4�4�T�_�_�E��'�'�)�
���s�BB�B)r3rJrVr;r�r�rr)rr�r
rr�s` @@@r�&testMultipleResourcesInSingleStatementz:ExceptionalTestCase.testMultipleResourcesInSingleStatement�s����,�.��,�.�� ��t�,��	*�	
���,��4��6�6�t�<��6�6�t�<��6�6�{�C��8�8����I��8�8����Irc�����t��t��d�_���fd�}�jt|��j	���j�j��j�jd��j�j��j�j��j�jd�y)Nc�����5�_�j���j�j��j��5�_	ddd�ddd�y#1swY�xYw#1swYyxYwr%)rTr�r�r�r�rs���rr�zPExceptionalTestCase.testNestedExceptionBeforeInnerStatement.<locals>.shouldThrow�s\����4�8��2�2�6�:��4�4�T�X�X�>��'�'�)��t�x���	���V��	��s$�AA,�A �A,� A)	�%A,�,A5)r3r�rVr;r�r�rTr�r�r
rrrs` @@r�'testNestedExceptionBeforeInnerStatementz;ExceptionalTestCase.testNestedExceptionBeforeInnerStatement�s����.�0��.�0�����	�	
���,��4��6�6�v�>��8�8����B�	
������4�(�����,�,�-�����+�+�,�����)�)�4�0rc�����t��t�����fd�}�jt|��j���j	���j�j��j�j�y)Nc�F���5�_�5�_�j���j���j�j��j�j�ddd��j	�ddd�y#1swY�"xYw#1swYyxYwr%rrs���rr�zOExceptionalTestCase.testNestedExceptionAfterInnerStatement.<locals>.shouldThrow�sy����4�8��t�x��6�6�v�>��6�6�v�>��8�8����B��8�8����B�	�
�'�'�)�
���V����s#�B�AB�*B�B	�B�B )	r3rVr;r�r�r�rTr�r�rs` @@r�&testNestedExceptionAfterInnerStatementz:ExceptionalTestCase.testNestedExceptionAfterInnerStatement�sj���.�0��.�0��	*�	
���,��4��6�6�v�>��4�4�V�<��8�8����B��6�6�t�x�x�@rc���td����fd�}|jtd�5|�ddd�y#1swYyxYw)Nc3�K�d��y�wr%r)r)rrr�z8ExceptionalTestCase.testRaisedStopIteration1.<locals>.cm��	�������c�B����5td��#1swYyxYw�N�	from with��
StopIteration�r�s�rr�zAExceptionalTestCase.testRaisedStopIteration1.<locals>.shouldThrow�������#�K�0�0������r)rrfrr�s  @r�testRaisedStopIteration1z,ExceptionalTestCase.testRaisedStopIteration1�s>���	�	�
�	�	1��
#�
#�M�;�
?��M�@�
?�
?�s	�:�Ac���Gd�dt���fd�}|jtd�5|�ddd�y#1swYyxYw)Nc��eZdZd�Zd�Zy)�8ExceptionalTestCase.testRaisedStopIteration2.<locals>.cmc��yr%r)rs rrzBExceptionalTestCase.testRaisedStopIteration2.<locals>.cm.__enter__�r]rc��yr%r)rs    rrzAExceptionalTestCase.testRaisedStopIteration2.<locals>.cm.__exit__�r]rNr�r)rrr�r%����
�
rr�c�B����5td��#1swYyxYwrrrs�rr�zAExceptionalTestCase.testRaisedStopIteration2.<locals>.shouldThrow�r r!r)rerfrr�s  @r�testRaisedStopIteration2z,ExceptionalTestCase.testRaisedStopIteration2�s8���	��	�	1��
#�
#�M�;�
?��M�@�
?�
?�s	�=�Ac���td����fd�}|jt�5|�ddd�y#1swYyxYw)Nc3�K�d��y�wr%r)r)rrr�z8ExceptionalTestCase.testRaisedStopIteration3.<locals>.cm�rrc�T����5ttg���#1swYyxYwr%)�next�iterrs�rr�zAExceptionalTestCase.testRaisedStopIteration3.<locals>.shouldThrow�s������4��8�n�$���s��')rrVrr�s  @r�testRaisedStopIteration3z,ExceptionalTestCase.testRaisedStopIteration3�s=���
�	�
�	�	%��
�
�}�
-��M�.�
-�
-�s	�9�Ac�T��td����fd�}|jt|�y)Nc3�K�d��y�wr%r)r)rrr�z8ExceptionalTestCase.testRaisedGeneratorExit1.<locals>.cm�rrc�B����5td��#1swYyxYwr��
GeneratorExitrs�rr�zAExceptionalTestCase.testRaisedGeneratorExit1.<locals>.shouldThrow�r r!)rrVr5r�s  @r�testRaisedGeneratorExit1z,ExceptionalTestCase.testRaisedGeneratorExit1�s,���	�	�
�	�	1�	
���-��5rc�Z��Gd�dt���fd�}|jt|�y)Nc��eZdZd�Zd�Zy)�8ExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cmc��yr%r)rs rrzBExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cm.__enter__�r]rc��yr%r)rs    rrzAExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cm.__exit__r]rNr�r)rrr�r9�r(rr�c�B����5td��#1swYyxYwrr4rs�rr�zAExceptionalTestCase.testRaisedGeneratorExit2.<locals>.shouldThrowr r!)rerVr5r�s  @r�testRaisedGeneratorExit2z,ExceptionalTestCase.testRaisedGeneratorExit2�s&���	�&�	�	1�	
���-��5rc����Gd�dt����fd�}|���fd�}�jt|���fd�}�jt|�y)Nc��eZdZd�Zd�Zd�Zy)�0ExceptionalTestCase.testErrorsInBool.<locals>.cmc�6��G�fd�d�}|�|_y)Nc���eZdZ�fd�Zy)�GExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__.<locals>.Boolc�����Sr%r))r�bool_conversions �r�__bool__zPExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__.<locals>.Bool.__bool__s���.�0�0rN)rr r!rF)rEs�r�BoolrCs���1rrG��exit_result)rrErGs ` rrz9ExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__s���1�1�$(�6�� rc��y)N�r)rs rrz:ExceptionalTestCase.testErrorsInBool.<locals>.cm.__enter__s��rc��|jSr%rH�r�a�b�cs    rrz9ExceptionalTestCase.testErrorsInBool.<locals>.cm.__exit__s���'�'�'rNrHr)rrr�r@s��
*�

�
(rr�c�d���d��5�jd�ddd�y#1swYyxYw)Nc��yrr)r)rr�<lambda>zJExceptionalTestCase.testErrorsInBool.<locals>.trueAsBool.<locals>.<lambda>s��Dr�Should NOT see this��failr�s��r�
trueAsBoolz8ExceptionalTestCase.testErrorsInBool.<locals>.trueAsBool�$����L�!��	�	�/�0�"�!�!���&�/c�d���d��5�jd�ddd�y#1swYyxYw)Nc��yr
r)r)rrrSzKExceptionalTestCase.testErrorsInBool.<locals>.falseAsBool.<locals>.<lambda>s��ErzShould raiserUr�s��r�falseAsBoolz9ExceptionalTestCase.testErrorsInBool.<locals>.falseAsBools#����M�"��	�	�.�)�#�"�"�rYc�d���d��5�jd�ddd�y#1swYyxYw)Nc��ddzSrr)r)rrrSzJExceptionalTestCase.testErrorsInBool.<locals>.failAsBool.<locals>.<lambda>$s��A�q�DrrTrUr�s��r�
failAsBoolz8ExceptionalTestCase.testErrorsInBool.<locals>.failAsBool#rXrY)rerV�AssertionErrorr)rrWr\r_r�s`   @r�testErrorsInBoolz$ExceptionalTestCase.testErrorsInBool
sJ���		(��		(�	1�	��	*�	
���.�+�6�	1�	
���+�Z�8rN)rr r!r�rr�rrrr"r*r0r6r=rar)rrr�r�fsC��	H�N�C�"J�&1�*A�"�
��
6�6�9rr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�NonLocalFlowControlTestCasec��d}	|dz
}t�5|dz
}	ddd�|j|d�y#1swYnxYw|dz
}�C)Nrr��
�d��r3r��r�counters  r�
testWithBreakz)NonLocalFlowControlTestCase.testWithBreak+sU������q�L�G�.�0��2�
���1�	
����"�%�	1�0��
�s�N�G�s�5�>c��d}	|dz
}|dkDrnt�5|dz
}	ddd��&|j|d�y#1swYnxYw|dz
}�J)Nrr�r�rerf�rhris  r�testWithContinuez,NonLocalFlowControlTestCase.testWithContinue5sb������q�L�G���{��.�0��2�
���1�0�	
����"�%�	1�0��
�s�N�G�s	�<�Ac�8�d�}|j|�d�y)Nc�l�d}	|dz
}t�5|dz
}|cddd�S#1swYnxYw|dz
}�2)Nrr�rerfr�)rjs rrTz7NonLocalFlowControlTestCase.testWithReturn.<locals>.fooBsA���G���1���2�4��r�M�G�"�5�4�4���3���s�$�-rg)r�r�s  r�testWithReturnz*NonLocalFlowControlTestCase.testWithReturnAs��	�	
������#rc�R�d�}t|��}|j|ddg�y)Nc3�ZK�t�5d��d��ddd�y#1swYyxYw�w)Nrm�
r�r)rr�genz6NonLocalFlowControlTestCase.testWithYield.<locals>.genMs!����.�0�����1�0�0�s�+�	�	+�(�+rmrt)�listr�)rru�xs   r�
testWithYieldz)NonLocalFlowControlTestCase.testWithYieldLs(��	�
���K������R��H�%rc���d}	|dz
}t�5|dz
}t�#1swYnxYw|dz
}|jd�y#t$r|j|d�YywxYw)Nrr�rerfzDidn't raise RuntimeErrorrg)r3r;rVr�ris  r�
testWithRaisez)NonLocalFlowControlTestCase.testWithRaiseTsn����		3��q�L�G�.�0��2�
��"�"�1�0��
�s�N�G�
�I�I�1�2���	*����W�b�)�	*�s�A��(�A�A �A N)rr r!rkrnrqrxrzr)rrrcrc)s��&�
&�	$�&�3rrcc��eZdZd�Zd�Zd�Zy)�AssignmentTargetTestCasec�t�dgd�i}t�5|dd<|jt|j��dg�|j|ddjt
�ddd�t�5t|j
��dd<|jt|j��dg�|j|ddjt
�ddd�t�5|d<t|j��}|j�|j|ddg�ddd�Gd�d�}|�}t�5|_|jt|d�d�ddd�y#1swY��#xYw#1swY��xYw#1swY�hxYw#1swYyxYw)	Nr��rr�r�rr�c��eZdZy)�;AssignmentTargetTestCase.testSingleComplexTarget.<locals>.CNrlr)rr�Cr�p��rr�rTT)
r3r�rv�keysrr,�values�sortrT�hasattr)r�targetsr�r��blahs     r�testSingleComplexTargetz0AssignmentTargetTestCase.testSingleComplexTargetdsV���i�.��
*�
,���
�1�
����T�'�,�,�.�1�A�3�7����W�Q�Z��]�4�4�l�C�-�+�
,��W�^�^�5E�0F�q�0I�!�0L����T�'�,�,�.�1�A�3�7����W�Q�Z��]�4�4�l�C�-�+�
,���
������'�D��I�I�K����T�A�q�6�*�-�	�
��s��
*�
,������W�T�5�1�4�8�-�
,�-�
,��-�
,��-�
,��-�
,�s2�AF	�:A.F�:AF"�"F.�	F�F�"F+�.F7c�v�Gd�d�}dgd�i}|�5\|dd<|dd<|dd<|j|dgd�i�ddd�|�5\t|j��dd<t|j��dd<t|j��dd<|j|dgd�i�ddd�|�5\|d<|d<|d	<|j|ddd	d��ddd�Gd
�d�}|�}|�5\|_|_|_|j|jd�|j|jd�|j|j
d	�ddd�y#1swY��GxYw#1swY��xYw#1swY��xYw#1swYyxYw)Nc��eZdZd�Zd�Zy)�>AssignmentTargetTestCase.testMultipleComplexTargets.<locals>.Cc��y)N�r�r�rKr)rs rrzHAssignmentTargetTestCase.testMultipleComplexTargets.<locals>.C.__enter__ws��rc��yr%r)�r�t�v�tbs    rrzGAssignmentTargetTestCase.testMultipleComplexTargets.<locals>.C.__exit__xs��$rNr�r)rrr�r�vs��/�.rr�r�r~rr�r�)rKr�r�rKc��eZdZy)�>AssignmentTargetTestCase.testMultipleComplexTargets.<locals>.BNrlr)rr�Br��r�rr�)r�rvr��one�two�three)rr�r�r�r�s     r�testMultipleComplexTargetsz3AssignmentTargetTestCase.testMultipleComplexTargetsusz��	/�	/��i�.��
�S�A�W�Q�Z��]�G�A�J�q�M�7�1�:�a�=����W�q�)�n�5��
�S�n�T�'�.�.�*�+�A�.�q�1�4����8H�3I�!�3L�Q�3O�QU�V]�Vd�Vd�Vf�Qg�hi�Qj�kl�Qm����W�q�)�n�5��
�S�8�W�Q�Z����W�Q�Z����W�!��a�&8�9���
��s��
�S�4�T�X�t�x������T�X�X�q�)����T�X�X�q�)����T�Z�Z��+��S��S��
�S��
�S���S�s1�-F
�A2F�$F#�A(F/�
F�F �#F,�/F8c���ttdd��5�^}}}|j|d�|j|ddg�|j|d�ddd�y#1swYyxYw)Nr��r�rK�)r�ranger�rMs    r�testWithExtendedTargetsz0AssignmentTargetTestCase.testWithExtendedTargets�sX��
��q�!��
%��!�a�����Q��"����Q��A��'����Q��"�&�
%�
%�s�=A�A%N)rr r!r�r�r�r)rrr|r|bs��9�",�$#rr|c��eZdZd�Zd�Zy)�ExitSwallowsExceptionTestCasec��Gd�d�}	|�5ddzddd�y#1swYyxYw#t$r|jd�YywxYw)Nc��eZdZd�Zd�Zy)�SExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallowc��yr%r)rs rrz]ExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallow.__enter__����rc��yrr)r�s    rrz\ExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallow.__exit__�s��rNr�r)rr�AfricanSwallowr��s��%�5rr�r�rz,ZeroDivisionError should have been swallowed)rrV)rr�s  r�testExitTrueSwallowsExceptionz;ExitSwallowsExceptionTestCase.testExitTrueSwallowsException�sH��	6�	6�	F��!��!��"�!�!�� �	F��I�I�D�E�	F�s#�.�"�.�+�.�.�A�
Ac��Gd�d�}	|�5ddzddd�|jd�y#1swY�xYw#t$rYywxYw)Nc��eZdZd�Zd�Zy)�ZExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallowc��yr%r)rs rrzdExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallow.__enter__�r�rc��yr
r)r�s    rrzcExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallow.__exit__�s��rNr�r)rr�EuropeanSwallowr��s��%�6rr�r�rz)ZeroDivisionError should have been raised)rVr)rr�s  r�#testExitFalseDoesntSwallowExceptionzAExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException�sM��	7�	7�	C� �"��!��#�

�I�I�A�B�#�"�� �	��	�s�?�3�?�<�?�	A�
AN)rr r!r�r�r)rrr�r��s��F�
Crr�c��eZdZGd�de�ZGd�de�ZGd�de�ZGd�de�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
y)�
NestedWithc� �eZdZdd�Zd�Zd�Zy)�NestedWith.DummyNc�D�|�|}||_||_d|_d|_yr
)r�gobbler
r)rrr�s   rrzNestedWith.Dummy.__init__�s*���}����D�J� �D�K� %�D��$�D�rc�(�d|_|jSr)r
rrs rrzNestedWith.Dummy.__enter__�s�� $�D���:�:�rc�:�d|_||_|jryyr)rr?r�rNs  rrzNestedWith.Dummy.__exit__�s ��#�D��$�D�M��{�{��rr
rHr)rr�Dummyr��s��	%�	�	rr�c��eZdZd�Zy)�NestedWith.InitRaisesc��t��r%r�rs rrzNestedWith.InitRaises.__init__�s	��,�.�0rNr0r)rr�
InitRaisesr��s��0rr�c��eZdZd�Zd�Zy)�NestedWith.EnterRaisesc��t��r%r�rs rrz NestedWith.EnterRaises.__enter__�s	��<�>�1rc��yr%r)rNs  rrzNestedWith.EnterRaises.__exit__�s��trNr�r)rr�EnterRaisesr��s��1�+rr�c��eZdZd�Zd�Zy)�NestedWith.ExitRaisesc��yr%r)rs rrzNestedWith.ExitRaises.__enter__�s��Trc��t��r%r�rNs  rrzNestedWith.ExitRaises.__exit__�s	��\�^�';rNr�r)rr�
ExitRaisesr��s��!�;rr�c�p�|j�5}|j�5}|j|j�|j|j�ddd�ddd�|jj�|jj�y#1swY�HxYw#1swY�LxYwr%)r�r�r
r)rrNrOs   r�testNoExceptionszNestedWith.testNoExceptions�sm��
�Z�Z�\�Q��
�
����O�O�A�N�N�+��O�O�A�N�N�+�!-�\�	
����
�
�&�����
�
�&�	!-���\�\�s"�B,�7B �B,� B)	�%B,�,B5c��	|j�5}|j�5	ddd�ddd�|jj�|j|j�y#1swY�HxYw#1swY�LxYw#Y�SxYwr%)r�r�r�r
r�rrNs  r�testExceptionInExprListz"NestedWith.testExceptionInExprList�s^��	������D�O�O�$5��%6��	
������'�����
�
�&�%6�$5�����	��s7�B�A8�A,�A8�B�,A5	�1A8�8B�=B�Bc�h�	|j�5}|j�5|jd�ddd�ddd�|jd�|j	j
�|j	|j�y#1swY�YxYw#1swY�]xYw#t$rY�ZwxYw)Nzbody of bad with executedzRuntimeError not reraised)r�r�rVr;r�r
rr�s  r�testExceptionInEnterzNestedWith.testExceptionInEnter�s��	3������D�$4�$4�$6��	�	�5�6�%7��

�I�I�1�2�������'�����
�
�&�%7�$6������	��	�s=�B%�B�B
�B�B%�
B	�B�B"�B%�%	B1�0B1c�p�d}|jd��5}|j�5d}ddd�ddd�|jj�|j|j�|j|�|j|jdd�y#1swY�xxYw#1swY�|xYw)NFT)r�r)r�r�r�r
r�assertNotEqualr?)r�
body_executedrNs   r�testExceptionInExitzNestedWith.testExceptionInExit�s����
�
�Z�Z�t�Z�
$��4�?�?�+<� �M�,=�
$�������'�����
�
�&����
�&����A�J�J�q�M�4�0�,=�+<��
$�
$�s!�B,�B �B,� B)	�%B,�,B5c�<�|jd��5\}}|jd��5\}}|jd|�|jd|�|jd|�|jd|�ddd�ddd�y#1swY�xYw#1swYyxYw)N)r�r�)r)re�r�r�rer�)r�r�)r�a1�a2�b1�b2s     r�testEnterReturnsTuplez NestedWith.testEnterReturnsTuple�s���
�Z�Z�e�Z�
$���R�
�Z�Z�h�Z�
'�8�B�����Q��#����Q��#����R��$����R��$�	(�%�
$�
'�
'��%�
$�s#�B�AB�5B�B	�B�Bc����fd�}�fd�}�fd�}|df|df|dffD]�\}}�j|�5|�}tj|j�d}d}|j}	�j|j|	jd	z��j|j|	jd	z��j|j|j|z
|j|z
|�ddd���y#1swY��xYw)
Nc���	�j�5�j�5}�j�5}	ddd�ddd�ddd�y#1swY�xYw#1swY�xYw#1swYyxYw#t$r}|cYd}~Sd}~wwxYwr%)r�r��	Exception)r��drGrs   �r�init_raisesz5NestedWith.testExceptionLocation.<locals>.init_raises�s[���
��Z�Z�\�4�?�?�#4��D�J�J�L�A��=I�#4�\�\�L�L��#4�#4��\�\���
����
�sf�A4�A(�A�A�A�A(�A4�A�A�A%	�!A(�(A1�-A4�1A4�4	B	�=B�>B	�B	c����	�j�5�j�5}	ddd�ddd�y#1swY�xYw#1swYyxYw#t$r}|cYd}~Sd}~wwxYwr%)r�r�r��r�rGrs  �r�enter_raisesz6NestedWith.testExceptionLocation.<locals>.enter_raisessL���
��%�%�'�������*6�'�'����'�'���
����
��L�A�A�7�A�A�A	�A�A�A�A�	A$�A�A$�A$c����	�j�5�j�5}	ddd�ddd�y#1swY�xYw#1swYyxYw#t$r}|cYd}~Sd}~wwxYwr%)r�r�r�r�s  �r�exit_raisesz5NestedWith.testExceptionLocation.<locals>.exit_raisessJ���
��_�_�&��
�
����)5�&�&����&�&���
����
�r�zself.InitRaises()zself.EnterRaises()zself.ExitRaises()r�r�)�subTestr�
extract_tbrE�__code__r��lineno�co_firstlineno�
end_lineno�line�colno�	end_colno)
rr�r�r�r'�expected�exc�f�indent�cos
`         r�testExceptionLocationz NestedWith.testExceptionLocation�s����	�	�	�!,�-@�A� ,�.B�C� +�-@�A� �N�D�(����d�#��f���(�(��):�):�;�A�>�����]�]��� � ����2�+<�+<�q�+@�A�� � ����r�/@�/@�1�/D�E�� � �������&�(8�1�;�;��;O�!P�!)�+�$�#�	 �$�#�s�CD�D
	N)rr r!rer�r�r�r�r�r�r�r�r�r�r)rrr�r��sP�����&1�V�1�,�f�,�<�V�<�'�'�	'�1�%�(+rr��__main__)�__doc__�
__author__�	__email__r>r�unittest�collectionsr�
contextlibrrrrr*rer,r3r5rJ�TestCaserPr�r�r�r�rcr|r�r�r�mainr)rr�<module>r�sD��=��
�#�	�
����L�L�C�1�C�$��6������!�V�!�H0��0�"T5�h�'�'�T5�l,0�6�,0�^1<�X�.�.�0L�1<�h?B�8�#4�#4� �?B�D@9�6��8I�8I�@9�F63�(�"3�"3�63�r)#�x�0�0�)#�XC�H�$5�$5�C�2t+��"�"�t+�n�z���H�M�M�O�r

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