Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_contextlib.cpython-311.opt-2.pyc
�

�Ke%����	ddlZddlZddlZddlZddlZddlZddlZddlTddlm	Z	ddl
mZddlZGd�dej
��ZGd�dej
��ZGd	�d
ej
��ZGd�dej
��ZGd
�dej
��ZGd�dej
��ZGd�de��ZGd�dej
��ZGd�d��ZGd�deej
��ZGd�d��ZGd�deej
��ZGd�deej
��ZGd�d ej
��ZGd!�d"ej
��Zed#krej��dSdS)$�N)�*)�support)�	os_helperc� �eZdZd�Zd�Zd�ZdS)�TestAbstractContextManagerc��Gd�dt��}|��}|�|���|��dS)Nc���eZdZ�fd�Z�xZS)�;TestAbstractContextManager.test_enter.<locals>.DefaultEnterc�4��t��j|�dS�N��super�__exit__��self�args�	__class__s  ��>/usr/local/apps/python3/lib/python3.11/test/test_contextlib.pyrzDTestAbstractContextManager.test_enter.<locals>.DefaultEnter.__exit__���� ���� �$�'�'�'�'���__name__�
__module__�__qualname__r�
__classcell__�rs@r�DefaultEnterr
�8�������
(�
(�
(�
(�
(�
(�
(�
(�
(rr)�AbstractContextManager�assertIs�	__enter__)rr�managers   r�
test_enterz%TestAbstractContextManager.test_enters`��	(�	(�	(�	(�	(�1�	(�	(�	(��,�.�.���
�
�g�'�'�)�)�7�3�3�3�3�3rc��Gd�dt��}|�t��5|��ddd��dS#1swxYwYdS)Nc��eZdZdS)�ETestAbstractContextManager.test_exit_is_abstract.<locals>.MissingExitN�rrr�rr�MissingExitr&��������Drr))r�assertRaises�	TypeError)rr)s  r�test_exit_is_abstractz0TestAbstractContextManager.test_exit_is_abstracts���	�	�	�	�	�0�	�	�	��
�
�y�
)�
)�	�	��K�M�M�M�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A
�
A
c��Gd�d��}|�t|t����Gd�dt��}|�t|t����Gd�d|��}|�t|t����Gd�d|��}|�t|t����dS)	Nc��eZdZd�Zd�ZdS)�RTestAbstractContextManager.test_structural_subclassing.<locals>.ManagerFromScratchc��|Srr(�rs rr!z\TestAbstractContextManager.test_structural_subclassing.<locals>.ManagerFromScratch.__enter__#����rc��dSrr()r�exc_type�	exc_value�	tracebacks    rrz[TestAbstractContextManager.test_structural_subclassing.<locals>.ManagerFromScratch.__exit__%s���trN�rrrr!rr(rr�ManagerFromScratchr0"s2������
�
�
�
�
�
�
�
rr9c���eZdZ�fd�Z�xZS)�LTestAbstractContextManager.test_structural_subclassing.<locals>.DefaultEnterc�4��t��j|�dSrr
rs  �rrzUTestAbstractContextManager.test_structural_subclassing.<locals>.DefaultEnter.__exit__+rrrrs@rrr;*rrrc��eZdZdZdS)�GTestAbstractContextManager.test_structural_subclassing.<locals>.NoEnterN�rrrr!r(rr�NoEnterr>0s�������I�I�Irr@c��eZdZdZdS)�FTestAbstractContextManager.test_structural_subclassing.<locals>.NoExitN�rrrrr(rr�NoExitrB5s�������H�H�HrrD)�
assertTrue�
issubclassr�assertFalse)rr9rr@rDs     r�test_structural_subclassingz6TestAbstractContextManager.test_structural_subclassing!s2��	�	�	�	�	�	�	�	�	
���
�#5�7M�N�N�O�O�O�	(�	(�	(�	(�	(�1�	(�	(�	(�	
���
�<�1G�H�H�I�I�I�	�	�	�	�	�(�	�	�	�	
����G�-C�D�D�E�E�E�	�	�	�	�	�'�	�	�	�	
����F�,B�C�C�D�D�D�D�DrN)rrrr#r-rHr(rrrrsF������4�4�4����E�E�E�E�Errc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
ejd���Zejd
���Zd�Zd�Zd�Zd�ZdS)�ContextManagerTestCasec�(��g�t�fd���}|��5}|��dg��|�|d����|��ddd��n#1swxYwY|��gd���dS)Nc3�h�K���d��dV���d��dS�N��*����append��states�r�woohooz@ContextManagerTestCase.test_contextmanager_plain.<locals>.woohoo?s7������L�L��O�O�O��H�H�H��L�L������rrNrO�rNrOrP)�contextmanager�assertEqualrR�rrU�xrTs   @r�test_contextmanager_plainz0ContextManagerTestCase.test_contextmanager_plain=s������	�	�	�	�	�
��	��V�X�X�	�����U�Q�C�(�(�(����Q��#�#�#��L�L��O�O�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
�������-�-�-�-�-s�AA/�/A3�6A3c���g�t�fd���}|�t��5|��5}|��dg��|�|d����|��t���#1swxYwY	ddd��n#1swxYwY|��gd���dS)Nc3��K���d��	dV���d��dS#��d��wxYwrMrQrSs�rrUzBContextManagerTestCase.test_contextmanager_finally.<locals>.woohooLsT������L�L��O�O�O�
"��������S�!�!�!�!�!�����S�!�!�!�!���s	�5�ArNrOrV)rWr+�ZeroDivisionErrorrXrRrYs   @r�test_contextmanager_finallyz2ContextManagerTestCase.test_contextmanager_finallyJsB�����	�	"�	"�	"�	"�
��	"��
�
�0�
1�
1�	*�	*�����
*�Q�� � ����,�,�,�� � ��B�'�'�'����Q����'�)�)�)�	
*�
*�
*�
*����
*�
*�
*�
*�
*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*�	
�������-�-�-�-�-s/�B$�AB�B	�B$�B	�B$�$B(�+B(c���td���}	|��5ddzddd��n#1swxYwYn0#t$r#}tj|j��}Yd}~nd}~wwxYw|�t
|��d��|�|djd��|�|djd��Gd�dt��}	|��5|d���#1swxYwYn+#|$r#}tj|j��}Yd}~nd}~wwxYw|�t
|��d��|�|djd��|�|djd	��Gd
�dt��}td��|d��fD�]$}|�t|���
��5	|��5|�#1swxYwY	|�
|�d���nN#t|��$r9}|�||��tj|j��}Yd}~nd}~wwxYw|�t
|��d��|�|djd��|�|djd��ddd��n#1swxYwY��&dS)Nc3�K�dV�dSrr(r(rr�fz?ContextManagerTestCase.test_contextmanager_traceback.<locals>.f\������E�E�E�E�ErrNr�test_contextmanager_traceback�1/0c��eZdZdS)�RContextManagerTestCase.test_contextmanager_traceback.<locals>.RuntimeErrorSubclassNr'r(rr�RuntimeErrorSubclassrgkr*rrhrOzraise RuntimeErrorSubclass(42)c��eZdZdS)�SContextManagerTestCase.test_contextmanager_traceback.<locals>.StopIterationSubclassNr'r(rr�StopIterationSubclassrjxr*rrk�spam��type� was suppressedzraise stop_exc)rWr^r7�
extract_tb�
__traceback__rX�len�name�line�RuntimeError�
StopIteration�subTestrn�failr )rrb�e�framesrhrk�stop_excs       rrdz4ContextManagerTestCase.test_contextmanager_traceback[s:��	�	�	�
��	�	;�����
�
��!���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��� �	;�	;�	;��)�!�/�:�:�F�F�F�F�F�F�����	;����	
����V���a�(�(�(��������)H�I�I�I���������/�/�/�	�	�	�	�	�<�	�	�	�	;�����
/�
/�*�*�2�.�.�.�
/�
/�
/�
/����
/�
/�
/�
/�
/��#�	;�	;�	;��)�!�/�:�:�F�F�F�F�F�F�����	;����	
����V���a�(�(�(��������)H�I�I�I��������)I�J�J�J�	�	�	�	�	�M�	�	�	�
�&�!�!�!�!�&�)�)�
�	C�	C�H����4��>�>��2�2�
C�
C�<�����'�'�&��'�'�'�'����'�'�'�'�'��I�I��:�:�:�;�;�;�;��	�H�~�~�C�C�C��M�M�!�X�.�.�.�&�1�!�/�B�B�F�F�F�F�F�F�����C����� � ��V���a�0�0�0�� � �����1P�Q�Q�Q�� � �����1A�B�B�B�
C�
C�
C�
C�
C�
C�
C�
C�
C�
C�
C����
C�
C�
C�
C��		C�	Cs��
:�.�:�2�:�2�:�
A'�A"�"A'�#
D�-C9�9C=�=D�C=�D�D-�
D(�(D-�(K�*
H�4G7�7G;�;H�>G;�?H�K�I'�./I"�K�"I'�'A(K�K	�"K	c���td���}|��}|���|�|�tt	d��d����dS)Nc3�K�dV�dSrr(r(rr�wheezCContextManagerTestCase.test_contextmanager_no_reraise.<locals>.whee�rcr�foo)rWr!rGrr,)rr~�ctxs   r�test_contextmanager_no_reraisez5ContextManagerTestCase.test_contextmanager_no_reraise�se��	�	�	�
��	��d�f�f���
�
����������i��5�1A�1A�4�H�H�I�I�I�I�Irc���td���}|��}|���|�t|jt
td��d��dS)Nc3�,K�	dV�dS#dV�YdSxYwrr(r(rr�whoozOContextManagerTestCase.test_contextmanager_trap_yield_after_throw.<locals>.whoo�s0����
��������
����������s�
�r)rWr!r+rurr,)rr�r�s   r�*test_contextmanager_trap_yield_after_throwzAContextManagerTestCase.test_contextmanager_trap_yield_after_throw�sl��	�	�	�
��	�
�d�f�f���
�
��������#�,�	�9�U�3C�3C�T�	
�	
�	
�	
�	
rc�2���g�t��fd���}|��5}���dg����|d����|��td���#1swxYwY���gd���dS)Nc3���K���d��	dV�dS#t$rC}��|jd�����gd���Yd}~dSd}~wwxYw)NrNrOrrV)rRr^rrX)ryrrTs ��rrUzAContextManagerTestCase.test_contextmanager_except.<locals>.woohoo�s�������L�L��O�O�O�
6��������$�
6�
6�
6����Q�V�A�Y�'�'�'�� � �����5�5�5�5�5�5�5�5�5�����
6���s� �
A-�8A(�(A-rNrOrPrV)rWrXrRr^rYs`  @r�test_contextmanager_exceptz1ContextManagerTestCase.test_contextmanager_except�s�������	�	6�	6�	6�	6�	6�
��	6��V�X�X�	)�����U�Q�C�(�(�(����Q��#�#�#��L�L��O�O�O�#�C�(�(�(�		)�	)�	)�	)����	)�	)�	)�	)�
	
�������-�-�-�-�-s�AA4�4A8�;A8c��td���}Gd�dt��}td��|d��fD]�}|�t|�����5	|��5|�#1swxYwY	|�|�d���n-#t
$r }|�||��Yd}~nd}~wwxYwddd��n#1swxYwY��dS)Nc3�K�dV�dSrr(r(rrrUzJContextManagerTestCase.test_contextmanager_except_stopiter.<locals>.woohoo�rcrc��eZdZdS)�YContextManagerTestCase.test_contextmanager_except_stopiter.<locals>.StopIterationSubclassNr'r(rrrkr��r*rrkrlrmro)rWrvrwrnrx�	Exceptionr )rrUrkr{�exs     r�#test_contextmanager_except_stopiterz:ContextManagerTestCase.test_contextmanager_except_stopiter�s���	�	�	�
��	�	�	�	�	�	�M�	�	�	�'�v�.�.�0E�0E�f�0M�0M�N�	<�	<�H����4��>�>��2�2�
<�
<�<�����'�'�&��'�'�'�'����'�'�'�'�'�
�I�I��:�:�:�;�;�;�;��!�0�0�0��M�M�"�h�/�/�/�/�/�/�/�/�����0����	
<�
<�
<�
<�
<�
<�
<�
<�
<�
<�
<����
<�
<�
<�
<��	<�	<sZ�#C�%
B�/A2�2A6�6B�9A6�:B�>C�
C�!B<�7C�<C�C�C	�C	c��d}i}t|||��|d}td��}	|��5|�#1swxYwY	|�d��dS#t$r!}|�||��Yd}~dSd}~wwxYw)Nztfrom __future__ import generator_stop
from contextlib import contextmanager
@contextmanager
def woohoo():
    yield
rUrlzStopIteration was suppressed)�execrvrxr�r )r�code�localsrUr{r�s      r�!test_contextmanager_except_pep479z8ContextManagerTestCase.test_contextmanager_except_pep479�s��������T�6�6�"�"�"���!�� ��(�(��	6�����
�
���
�
�
�
����
�
�
�
�
�

�I�I�4�5�5�5�5�5���	(�	(�	(��M�M�"�h�'�'�'�'�'�'�'�'�'�����	(���s/�
A�;�?�A�?�A�
B	�(B�B	c��td���}	|��5t�#1swxYwYn�#t$rs}|�t	|��t
��|�|jdd��|�|j	t��Yd}~nd}~wwxYw	|��5td���#1swxYwYdS#t$rn}|�t	|��t��|�|jdd��|�|j	��Yd}~dSd}~wwxYw)Nc3�XK�	dV�dS#t$r}td��|�d}~wwxYw)N�issue29692:Chained)r�ru��excs r�test_issue29692zoContextManagerTestCase.test_contextmanager_do_not_unchain_non_stopiteration_exceptions.<locals>.test_issue29692�sM����
B���������
B�
B�
B�"�#7�8�8�c�A�����
B���s�
�
)�$�)rr�zissue29692:Unchained)rWr^r�r rnrurXr�assertIsInstance�	__cause__rv�assertIsNone)rr�r�s   r�?test_contextmanager_do_not_unchain_non_stopiteration_exceptionszVContextManagerTestCase.test_contextmanager_do_not_unchain_non_stopiteration_exceptions�s���	�	B�	B�
��	B�
	C� ��"�"�
(�
(�'�'�
(�
(�
(�
(����
(�
(�
(�
(�
(���	C�	C�	C��M�M�$�r�(�(�L�1�1�1����R�W�Q�Z�)=�>�>�>��!�!�"�,�0A�B�B�B�B�B�B�B�B�����	C����
	,� ��"�"�
<�
<�#�$:�;�;�;�
<�
<�
<�
<����
<�
<�
<�
<�
<�
<���	,�	,�	,��M�M�$�r�(�(�M�2�2�2����R�W�Q�Z�)?�@�@�@����b�l�+�+�+�+�+�+�+�+�+�����	,���s`�
0�$�(�0�(�0�
B-�A)B(�(B-�1
C�;C�C�C�C�C�
E�"A#E�Ec�P�d�}t|d���d�����}|S)Nc����fd�}|S)Nc�^������D]\}}t|||���|Sr)�items�setattr)�func�k�v�kws   �r�decoratezXContextManagerTestCase._create_contextmanager_attribs.<locals>.attribs.<locals>.decorate�s8����8�8�:�:�&�&�C�A�a��D��1�%�%�%�%��rr()r�r�s` r�attribszFContextManagerTestCase._create_contextmanager_attribs.<locals>.attribs�s#���
�
�
�
�
��Or�bar)rc��dSrr()rls r�bazzBContextManagerTestCase._create_contextmanager_attribs.<locals>.baz�s	��
�Kr�rW)rr�r�s   r�_create_contextmanager_attribsz5ContextManagerTestCase._create_contextmanager_attribs�sI��	�	�	�
�	��U�	�	�	�	�	�
�	�
��	��
rc��|���}|�|jd��|�|jd��dS)Nr�r�)r�rXrr�rr�s  r�test_contextmanager_attribsz2ContextManagerTestCase.test_contextmanager_attribs�sI���1�1�3�3�������e�,�,�,������%�(�(�(�(�(rc�d�|���}|�|jd��dS�NzWhee!�r�rX�__doc__r�s  r�test_contextmanager_doc_attribz5ContextManagerTestCase.test_contextmanager_doc_attribs1���1�1�3�3�������g�.�.�.�.�.rc�v�|���d��}|�|jd��dSr�r�r�s  r�*test_instance_docstring_given_cm_docstringzAContextManagerTestCase.test_instance_docstring_given_cm_docstring	s;��3�d�1�1�3�3�D�9�9�������g�.�.�.�.�.rc��td���}|dddd���5}|�|d��ddd��dS#1swxYwYdS)Nc3�K�||||fV�dSrr(�rr�r�kwdss    rrUz4ContextManagerTestCase.test_keywords.<locals>.woohoos!������t�T�*�*�*�*�*�*r���!�,r�)r�r�r�r��rWrX)rrU�targets   r�
test_keywordsz$ContextManagerTestCase.test_keywordss���	�	+�	+�
��	+�
�V��"�2�B�
7�
7�
7�	7�6����V�%5�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	7�	7s�A�A�Ac���Gd�d��}t�fd���}||��|�����5	ddd��dS#1swxYwYdS)Nc��eZdZdS)�0ContextManagerTestCase.test_nokeepref.<locals>.ANr'r(rr�Ar�r*rr�c3��K�tj|��}tj|��}tj����|������|����dV�dSr)�weakref�refr�
gc_collectr�)�a�brs  �rrUz5ContextManagerTestCase.test_nokeepref.<locals>.woohoosq�������A���A���A���A��� � � ����a�a�c�c�"�"�"����a�a�c�c�"�"�"��E�E�E�E�Er�r�r�)rr�rUs`  r�test_nokeeprefz%ContextManagerTestCase.test_nokeeprefs����	�	�	�	�	�	�	�	�
�	�	�	�	�
��	��V�A�A�C�C�1�1�3�3�
�
�
�	�	��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A
�
A�Ac��td���}|�t��5|��ddd��n#1swxYwY|�t��5|dd��ddd��n#1swxYwY|�t��5|d���ddd��dS#1swxYwYdS)Nc3�K�dV�dSrr(�r�r�s  rrUz8ContextManagerTestCase.test_param_errors.<locals>.woohoo(rcr��r�)rWr+r,)rrUs  r�test_param_errorsz(ContextManagerTestCase.test_param_errors's���	�	�	�
��	��
�
�y�
)�
)�	�	��F�H�H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	��F�1�a�L�L�L�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	��F�Q�K�K�K�K�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s5�A�A�	A�'
B�B�B�%
B?�?C�Cc�����d�t��fd���}|����fd����������d��dS)Nrc3�X�K��}�dz
�dV��dz����|��dS�NrN)rX)�before�depthrs ��rrUz5ContextManagerTestCase.test_recursive.<locals>.woohoo5sE������F��Q�J�E��E�E�E��Q�J�E����U�F�+�+�+�+�+rc�,���dkr���dSdS)N�
r()r��	recursives��rr�z8ContextManagerTestCase.test_recursive.<locals>.recursive>s"����r�z�z��	�������zrr�)rrUr�r�s` @@r�test_recursivez%ContextManagerTestCase.test_recursive3s��������	�	,�	,�	,�	,�	,�
��	,�
����	�	�	�	�	�
��	�	�	���������"�"�"�"�"rN)rrrr[r_rdr�r�r�r�r�r�r�r�r�requires_docstringsr�r�r�r�r�r�r(rrrJrJ;s:������.�.�.�.�.�.�"0C�0C�0C�dJ�J�J�
�
�
�.�.�.�"<�<�<�$6�6�6�*,�,�,�.���)�)�)�

� �/�/�!� �/�
� �/�/�!� �/�7�7�7����"
�
�
�#�#�#�#�#rrJc�:�eZdZejd���Zd�Zd�ZdS)�ClosingTestCasec�r�tj}td��}|�|j|��dSr)�closingr�rX�r�cm_docstring�objs   r�test_instance_docsz"ClosingTestCase.test_instance_docsIs4������d�m�m�������l�3�3�3�3�3rc���g�G�fd�d��}|��}|��g��t|��5}|�||��ddd��n#1swxYwY|��dg��dS)Nc���eZdZ�fd�ZdS)�'ClosingTestCase.test_closing.<locals>.Cc�2����d��dSr�rQ�rrTs �r�closez-ClosingTestCase.test_closing.<locals>.C.closeS�������Q�����rN�rrrr�rSs�r�Cr�R�.�������
 �
 �
 �
 �
 �
 �
 rr�rN)rXr��rr�rZ�yrTs    @r�test_closingzClosingTestCase.test_closingPs������	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �
�A�C�C�������#�#�#�
�Q�Z�Z�	#�1����Q��"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�������$�$�$�$�$s�A%�%A)�,A)c���g�G�fd�d��}|��}|��g��|�t��5t|��5}|�||��ddzddd��n#1swxYwYddd��n#1swxYwY|��dg��dS)Nc���eZdZ�fd�ZdS)�-ClosingTestCase.test_closing_error.<locals>.Cc�2����d��dSr�rQr�s �rr�z3ClosingTestCase.test_closing_error.<locals>.C.close^r�rNr�rSs�rr�r�]r�rr�rNr)rXr+r^r�r�s    @r�test_closing_errorz"ClosingTestCase.test_closing_error[sd�����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �
�A�C�C�������#�#�#�
�
�
�0�
1�
1�	�	�����
�q�� � ��A�&�&�&��A���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
������$�$�$�$�$s6�
B�B�9B�B		�	B�B		�
B�B �#B N)rrrrr�r�r�r�r(rrr�r�GsO������� �4�4�!� �4�	%�	%�	%�%�%�%�%�%rr�c��eZdZd�ZdS)�NullcontextTestCasec��Gd�d��}|��}t|��5}|�||��ddd��dS#1swxYwYdS)Nc��eZdZdS)�/NullcontextTestCase.test_nullcontext.<locals>.CNr'r(rrr�r�kr*rr�)�nullcontextr )rr��c�c_ins    r�test_nullcontextz$NullcontextTestCase.test_nullcontextjs���	�	�	�	�	�	�	�	�
�A�C�C��
��^�^�	#�t��M�M�$��"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#s�A�A�AN)rrrrr(rrr�r�is#������#�#�#�#�#rr�c��eZdZd�ZdS)�FileContextTestCasec���tj��}	d}t|dd���5}|�|j��|�d��ddd��n#1swxYwY|�|j��d}|�t��5t|dd���5}|�|j��|�	|�
��d��ddzddd��n#1swxYwYddd��n#1swxYwY|�|j��tj|��dS#tj|��wxYw)N�wzutf-8)�encodingzBooh
�rrNr)
�tempfile�mktemp�openrG�closed�writerEr+r^rX�readr�unlink)r�tfnrbs   r�testWithOpenz FileContextTestCase.testWithOpents���o����	"��A��c�3��1�1�1�
"�Q�� � ���*�*�*�����!�!�!�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"����
"�
"�
"�
"�
�O�O�A�H�%�%�%��A��"�"�#4�5�5�
�
��#�s�W�5�5�5����$�$�Q�X�.�.�.��$�$�Q�V�V�X�X�x�8�8�8���E�E�������������������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�

�O�O�A�H�%�%�%���S�!�!�!�!�!��I��S�!�!�!�!���sw�E�0A%�E�%A)�)E�,A)�-9E�&D$�9AD
�D$�
D	�D$�D	�D$�E�$D(�(E�+D(�,E�E5N)rrrrr(rrrrrs#������"�"�"�"�"rrc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�LockContextTestCasec��|�|����|5|�|����ddd��n#1swxYwY|�|����|�t��5|5|�|����ddzddd��n#1swxYwYddd��n#1swxYwY|�|����dS�NrNr)rGrEr+r^)r�lock�lockeds   r�boilerPlatezLockContextTestCase.boilerPlate�s����������"�"�"�
�	&�	&��O�O�F�F�H�H�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&��������"�"�"�
�
�
�0�
1�
1�	�	��
�
��������)�)�)��A���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
�������"�"�"�"�"sG�A
�
A�A�C�#B>�2C�>C	�C�C	�C�C�Cc�b�tj��}|�||j��dSr)�	threading�Lockrr�rrs  r�testWithLockz LockContextTestCase.testWithLock�s-���~��������t�{�+�+�+�+�+rc�b�tj��}|�||j��dSr)r�RLockr�	_is_ownedrs  r�
testWithRLockz!LockContextTestCase.testWithRLock�s-���� � ������t�~�.�.�.�.�.rc�d��tj����fd�}|��|��dS)Nc�,������Sr)r �rs�rrz5LockContextTestCase.testWithCondition.<locals>.locked�s����>�>�#�#�#r)r�	Conditionr�rrrs  @r�testWithConditionz%LockContextTestCase.testWithCondition�sF����"�$�$��	$�	$�	$�	$�	$�����v�&�&�&�&�&rc�d��tj����fd�}|��|��dS)Nc�^����d��r����dSdS�NFT��acquire�releaser$s�rrz5LockContextTestCase.testWithSemaphore.<locals>.locked��.����|�|�E�"�"�
��������u��tr)r�	Semaphorerr&s  @r�testWithSemaphorez%LockContextTestCase.testWithSemaphore�sH����"�$�$��	�	�	�	�	�	
����v�&�&�&�&�&rc�d��tj����fd�}|��|��dS)Nc�^����d��r����dSdSr*r+r$s�rrz<LockContextTestCase.testWithBoundedSemaphore.<locals>.locked�r.r)r�BoundedSemaphorerr&s  @r�testWithBoundedSemaphorez,LockContextTestCase.testWithBoundedSemaphore�sH����)�+�+��	�	�	�	�	�	
����v�&�&�&�&�&rN)	rrrrrr!r'r0r4r(rrrr�sn������	#�	#�	#�,�,�,�/�/�/�'�'�'�'�'�'�'�'�'�'�'rrc�(�eZdZ	dZdZdZd�Zd�ZdS)�	mycontextFNc��d|_|S�NT��startedr2s rr!zmycontext.__enter__�s������rc��||_|jSr)r��catch�rr�s  rrzmycontext.__exit__�s������z�r)rrrr:r�r<r!rr(rrr6r6�sD������C��G�
�C��E��������rr6c�d�eZdZejd���Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�ZdS)�TestContextDecoratorc�p�tj}t��}|�|j|��dSr)r6r�rXr�s   rr�z'TestContextDecorator.test_instance_docs�s3��!�(���k�k�������l�3�3�3�3�3rc���t��}|5}|�||��|�|j��ddd��n#1swxYwY|�|jd��dS)N�NNN)r6r rEr:rXr�)r�context�results   r�test_contextdecoratorz*TestContextDecorator.test_contextdecorator�s����+�+��
�	-���M�M�&�'�*�*�*��O�O�G�O�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	
�����&8�9�9�9�9�9s�1A�A�Ac�(�t��}|�td��5|5td���#1swxYwY	ddd��n#1swxYwY|�|j��|�|jdt��t��}d|_|5td���#1swxYwY|�|j��|�|jdt��dS)NrrT)r6�assertRaisesRegex�	NameError�assertIsNotNoner�r r<)rrCs  r�$test_contextdecorator_with_exceptionz9TestContextDecorator.test_contextdecorator_with_exception�s���+�+��
�
#�
#�I�u�
5�
5�	'�	'��
'�
'���&�&�&�
'�
'�
'�
'����
'�
'�
'�
'�
'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	
���W�[�)�)�)��
�
�g�k�!�n�i�0�0�0��+�+����
�
�	#�	#��E�"�"�"�	#�	#�	#�	#����	#�	#�	#�	#����W�[�)�)�)��
�
�g�k�!�n�i�0�0�0�0�0s>�A�=�A	�A�A	�A�A�A�7C�C�Cc����t������fd���}|�����jd��dS)Nc�p�����j�����j��dSr�r�r�rEr:�rCrs��r�testz1TestContextDecorator.test_decorator.<locals>.test��3������g�k�*�*�*��O�O�G�O�,�,�,�,�,rrB)r6rXr��rrOrCs` @r�test_decoratorz#TestContextDecorator.test_decorator�sa�����+�+��	�	-�	-�	-�	-�	-�
��	-�	
����������&8�9�9�9�9�9rc�<���t������fd���}��td��5|��ddd��n#1swxYwY���j�����jdt��dS)Nc������j�����j��t	d���)Nr)r�r�rEr:rHrNs��rrOz@TestContextDecorator.test_decorator_with_exception.<locals>.test�s;������g�k�*�*�*��O�O�G�O�,�,�,��E�"�"�"rrr)r6rGrHrIr�r rQs` @r�test_decorator_with_exceptionz2TestContextDecorator.test_decorator_with_exception�s������+�+��	�	#�	#�	#�	#�	#�
��	#�
�
#�
#�I�u�
5�
5�	�	��D�F�F�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����W�[�)�)�)��
�
�g�k�!�n�i�0�0�0�0�0s�A�A�Ac����t���G�fd�dt��}|��}|�dd��|�|jd��|�|jd��|�|jd��|��}|�ddd��|�|jd��|�|jd��|�|jd��|��}|�dd���|�|jd��|�|jd��dS)	Nc�(��eZdZ�dd���ZdS)�9TestContextDecorator.test_decorating_method.<locals>.TestNc�0�||_||_||_dSr)r�r�r)rr�r�rs    r�methodz@TestContextDecorator.test_decorating_method.<locals>.Test.methods������������rr)rrrrZ)rCs�r�TestrXs3�������
�
�
�
��W�
�
�
rr[rN�r�r�rr�)r6�objectrZrXr�r�r)rr[rOrCs   @r�test_decorating_methodz+TestContextDecorator.test_decorating_methodsi����+�+��	�	�	�	�	�	�	�6�	�	�	��t�v�v�����A�q����������#�#�#�������#�#�#�������&�&�&��t�v�v�����C��c�"�"�"�������%�%�%�������%�%�%�������%�%�%��t�v�v�����a�1�����������#�#�#�������#�#�#�#�#rc���Gd�dt��}|�td��5|��5	ddd��n#1swxYwYddd��dS#1swxYwYdS)Nc��eZdZd�Zd�ZdS)�7TestContextDecorator.test_typo_enter.<locals>.mycontextc��dSrr(r2s r�	__unter__zATestContextDecorator.test_typo_enter.<locals>.mycontext.__unter__"����rc��dSrr(r=s  rrz@TestContextDecorator.test_typo_enter.<locals>.mycontext.__exit__$rdrN)rrrrcrr(rrr6ra!�2������
�
�
�
�
�
�
�
rr6�the context manager��ContextDecoratorrGr,�rr6s  r�test_typo_enterz$TestContextDecorator.test_typo_enter s��	�	�	�	�	�(�	�	�	��
#�
#�I�/D�
E�
E�	�	�����
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�3�A �A�A �A	�A �A	�A � A$�'A$c���Gd�dt��}|�td��5|��5	ddd��n#1swxYwYddd��dS#1swxYwYdS)Nc��eZdZd�Zd�ZdS)�6TestContextDecorator.test_typo_exit.<locals>.mycontextc��dSrr(r2s rr!z@TestContextDecorator.test_typo_exit.<locals>.mycontext.__enter__.rdrc��dSrr(r=s  r�__uxit__z?TestContextDecorator.test_typo_exit.<locals>.mycontext.__uxit__0rdrN)rrrr!rrr(rrr6ro-rfrr6zthe context manager.*__exit__rhrjs  r�test_typo_exitz#TestContextDecorator.test_typo_exit,s��	�	�	�	�	�(�	�	�	��
#�
#�I�/N�
O�
O�	�	�����
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	rlc�����Gd�dt��}Gd�d|t��}|������fd���}|�����jd��dS)Nc�"�eZdZdZdZd�Zd�ZdS)�HTestContextDecorator.test_contextdecorator_as_mixin.<locals>.somecontextFNc��d|_|Sr8r9r2s rr!zRTestContextDecorator.test_contextdecorator_as_mixin.<locals>.somecontext.__enter__=s��#����rc��||_dSrr�r=s  rrzQTestContextDecorator.test_contextdecorator_as_mixin.<locals>.somecontext.__exit__A�
������r)rrrr:r�r!rr(rr�somecontextrv9s<�������G��C�
�
�
�
�
�
�
�
rrzc��eZdZdS)�FTestContextDecorator.test_contextdecorator_as_mixin.<locals>.mycontextNr'r(rrr6r|Dr*rr6c�p�����j�����j��dSrrMrNs��rrOzATestContextDecorator.test_contextdecorator_as_mixin.<locals>.testHrPrrB)r]rirXr�)rrzr6rOrCs`   @r�test_contextdecorator_as_mixinz3TestContextDecorator.test_contextdecorator_as_mixin8s�����		�		�		�		�		�&�		�		�		�	�	�	�	�	��%5�	�	�	��)�+�+��	�	-�	-�	-�	-�	-�
��	-�	
����������&8�9�9�9�9�9rc�����t�fd���}g�|d����fd���}|d�����gd���g�|d�����gd���dS)Nc3�h�K���|��dV���d��dS)NrPrQ)r�rTs �rrUzETestContextDecorator.test_contextmanager_as_decorator.<locals>.woohooQs7������L�L��O�O�O��E�E�E��L�L������rrNc�`�����dg����|��dSr�)rXrR)rZrrTs ��rrOzCTestContextDecorator.test_contextmanager_as_decorator.<locals>.testXs.������U�Q�C�(�(�(��L�L��O�O�O�O�Or�	something)rNr�rP�something else)rNr�rPr�)rrUrOrTs`  @r� test_contextmanager_as_decoratorz5TestContextDecorator.test_contextmanager_as_decoratorPs�����	�	�	�	�	�
��	�
��	�����	�	�	�	�	�
��	�	
��[�������� 5� 5� 5�6�6�6�����
�������� :� :� :�;�;�;�;�;rN)rrrrr�r�rErJrRrUr^rkrsr~r�r(rrr?r?�s�������� �4�4�!� �4�:�:�:�1�1�1�":�:�:�1�1�1�$�$�$�<	�	�	�	�	�	�:�:�:�0<�<�<�<�<rr?c��eZdZdZejd���Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�TestBaseExitStackNc�|�|jj}|���}|�|j|��dSr)�
exit_stackr�rXr�s   rr�z$TestBaseExitStack.test_instance_docshs;����.���o�o���������l�3�3�3�3�3rc�b�|���5	ddd��dS#1swxYwYdSr)r�r2s r�test_no_resourcesz#TestBaseExitStack.test_no_resourcesosy��
�_�_�
�
�	�	��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�$�(�(c�^��difdifdifdtd���fdtd���fdtd���fdtdd���fg}g��fd	�}|���5}t|��D]h\}}|r|r|j|g|�Ri|��}n7|r|j|g|�R�}n&|r|j|fi|��}n|�|��}|�||���i|jD]o}|�|dj|��|�|dj|j��|�	|dj
|j
���p	ddd��n#1swxYwY|��|��g�|���5}|�t��5|�d�
��ddd��n#1swxYwY|�t��5|j�d�
��ddd��n#1swxYwY|�t��5|�|d���ddd��n#1swxYwYddd��n#1swxYwY|��g��dS)
Nr()rN)rNr\rN)�exampler��)r�callbackc�8��	��||f��dSrrQ)rr�rDs  �r�_exitz.TestBaseExitStack.test_callback.<locals>._exit~s"���+��M�M�4��,�'�'�'�'�'r)�argr\)r�r�)�dictr��reversedr�r �_exit_callbacks�__wrapped__�assertNotEqualrr�r�rXr+r,)	r�expectedr��stackrr�rb�wrapperrDs	        @r�
test_callbackzTestBaseExitStack.test_callbackssD���
��H�
�2�J�
�B�K�
��a����!�
�4��?�?�?�#�
�D��O�O�O�$�
�D�a�!�,�,�,�-�
����	(�	(�	(�	(�	(��_�_�
�
�	E�%�&�x�0�0�	
(�	
(�
��d��.�D�.�&���u�<�t�<�<�<�t�<�<�A�A��.�&���u�4�t�4�4�4�A�A��.�&���u�5�5��5�5�A�A����u�-�-�A��
�
�a��'�'�'�'� �0�
E�
E���
�
�g�a�j�4�e�<�<�<��#�#�G�A�J�$7���H�H�H��!�!�'�!�*�"4�e�m�D�D�D�D�
E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E�	
�����*�*�*���
�_�_�
�
�	6�%��"�"�9�-�-�
&�
&����1��%�%�%�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&����
&�
&�
&�
&��"�"�9�-�-�
0�
0���(�(�Q�(�/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0��"�"�9�-�-�
6�
6�����1��5�5�5�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�	
�����$�$�$�$�$s��-C0E*�*E.�1E.�!J�<G�J�G#	�#J�&G#	�'J�H,� J�,H0	�0J�3H0	�4J�I5�)J�5I9	�9J�<I9	�=J�J�Jc�����t���fd�}d�}�fd�}Gd�dt��}����5}|�|����|jdd|��||��}|�|����|jddj|��|�|����|jdd|��||��}|�|����|jddj|��|�|����|jdd|��|�|����|jdd|��ddzddd��dS#1swxYwYdS)	Nc�4����|���dSr)r )r5r��exc_tb�
exc_raisedrs   ��r�_expect_excz0TestBaseExitStack.test_push.<locals>._expect_exc�s����M�M�(�J�/�/�/�/�/rc��dSr8r(��exc_detailss r�
_suppress_excz2TestBaseExitStack.test_push.<locals>._suppress_exc�����4rc�����|����|����|��dSr)r�)r5r�r�rs   �r�
_expect_okz/TestBaseExitStack.test_push.<locals>._expect_ok�sE������h�'�'�'����c�"�"�"����f�%�%�%�%�%rc� �eZdZd�Zd�Zd�ZdS)�+TestBaseExitStack.test_push.<locals>.ExitCMc��||_dSr��	check_exc)rr�s  r�__init__z4TestBaseExitStack.test_push.<locals>.ExitCM.__init__�s
��!*����rc�0�|�d��dS)NzShould not be called!)rxr2s rr!z5TestBaseExitStack.test_push.<locals>.ExitCM.__enter__�s���	�	�1�2�2�2�2�2rc��|j|�dSrr��rr�s  rrz4TestBaseExitStack.test_push.<locals>.ExitCM.__exit__�s������,�,�,�,rN�rrrr�r!rr(rr�ExitCMr��sA������
+�
+�
+�
3�
3�
3�
-�
-�
-�
-�
-rr����rNr)r^r]r��pushr r��__self__)rr�r�r�r�r��cmr�s`      @r�	test_pushzTestBaseExitStack.test_push�sE����&�
�	0�	0�	0�	0�	0�	0�	�	�	�	&�	&�	&�	&�	&�	-�	-�	-�	-�	-�V�	-�	-�	-��_�_�
�
�	�%��J�J�z�"�"�"��M�M�%�/��3�A�6�
�C�C�C���
�#�#�B��J�J�r�N�N�N��M�M�%�/��3�A�6�?��D�D�D��J�J�}�%�%�%��M�M�%�/��3�A�6�
�F�F�F����$�$�B��J�J�r�N�N�N��M�M�%�/��3�A�6�?��D�D�D��J�J�{�#�#�#��M�M�%�/��3�A�6��D�D�D��J�J�{�#�#�#��M�M�%�/��3�A�6��D�D�D�
�a�C�C�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�FG�G�!Gc����G�fd�dt��}g�|��}|���5}|j�fd���}|�|��|�|��|�|jddj|����d��ddd��n#1swxYwY|�	�gd���dS)Nc�$��eZdZ�fd�Z�fd�ZdS)�4TestBaseExitStack.test_enter_context.<locals>.TestCMc�2����d��dSr�rQ)rrDs �rr!z>TestBaseExitStack.test_enter_context.<locals>.TestCM.__enter__������
�
�a� � � � � rc�2����d��dS�Nr�rQ)rr�rDs  �rrz=TestBaseExitStack.test_enter_context.<locals>.TestCM.__exit__�r�rNr8�rDs�r�TestCMr��sG�������
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!rr�c�2����d��dS)Nr�rQr�s�rr�z3TestBaseExitStack.test_enter_context.<locals>._exit������
�
�a� � � � � rr�rNr\)rNr\r�r�)
r]r�r�rI�
enter_contextr r�r�rRrX)rr�r�r�r�rDs     @r�test_enter_contextz$TestBaseExitStack.test_enter_context�sP���	!�	!�	!�	!�	!�	!�	!�V�	!�	!�	!���
�V�X�X��
�_�_�
�
�	�%�
�^�
!�
!�
!�
!��^�
!�� � ��'�'�'�����#�#�#��M�M�%�/��3�A�6�?��D�D�D��M�M�!����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
�������.�.�.�.�.s�A>C�C�Cc���Gd�d��}Gd�d��}Gd�d��}|���5}|�td��5|�|����ddd��n#1swxYwY|�td��5|�|����ddd��n#1swxYwY|�td��5|�|����ddd��n#1swxYwY|�|j��ddd��dS#1swxYwYdS)Nc��eZdZdS)�FTestBaseExitStack.test_enter_context_errors.<locals>.LacksEnterAndExitNr'r(rr�LacksEnterAndExitr��r*rr�c��eZdZd�ZdS)�?TestBaseExitStack.test_enter_context_errors.<locals>.LacksEnterc��dSrr()r�exc_infos  rrzHTestBaseExitStack.test_enter_context_errors.<locals>.LacksEnter.__exit__�rdrNrCr(rr�
LacksEnterr���#������
�
�
�
�
rr�c��eZdZd�ZdS)�>TestBaseExitStack.test_enter_context_errors.<locals>.LacksExitc��dSrr(r2s rr!zHTestBaseExitStack.test_enter_context_errors.<locals>.LacksExit.__enter__�rdrNr?r(rr�	LacksExitr��r�rr�rg)r�rGr,r�rGr�)rr�r�r�r�s     r�test_enter_context_errorsz+TestBaseExitStack.test_enter_context_errors�s���	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	��_�_�
�
�	4�%��'�'�	�3H�I�I�
9�
9��#�#�$5�$5�$7�$7�8�8�8�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9����
9�
9�
9�
9��'�'�	�3H�I�I�
2�
2��#�#�J�J�L�L�1�1�1�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2��'�'�	�3H�I�I�
1�
1��#�#�I�I�K�K�0�0�0�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1����
1�
1�
1�
1����U�2�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�	4�	4s}�E�B�6E�B	�E�	B	�
E�(C�E�C	�E�C	�E�8D"�E�"D&	�&E�)D&	�*E�E�Ec�4��g�|���5}|j�fd���}|�|��|�����d��ddd��n#1swxYwY|��ddg��dS)Nc�2����d��dSr�rQr�s�rr�z+TestBaseExitStack.test_close.<locals>._exit�r�rr\rN)r�r�rIr�rRrX)rr�r�rDs   @r�
test_closezTestBaseExitStack.test_close�s������
�_�_�
�
�	�%�
�^�
!�
!�
!�
!��^�
!�� � ��'�'�'��K�K�M�M�M��M�M�!����
	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
����!�Q��(�(�(�(�(��AA5�5A9�<A9c���g�|���5}|j�fd���}|�|��|���}��d��ddd��n#1swxYwY��d��|���|��gd���dS)Nc�2����d��dSr�rQr�s�rr�z-TestBaseExitStack.test_pop_all.<locals>._exit�r�rrNr\)rNr\r�)r�r�rI�pop_allrRr�rX)rr�r��	new_stackrDs    @r�test_pop_allzTestBaseExitStack.test_pop_all�s�����
�_�_�
�
�	�%�
�^�
!�
!�
!�
!��^�
!�� � ��'�'�'��
�
���I��M�M�!����
	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�
�
�a�����������������+�+�+�+�+r�c��|�t��5|���5}|�d���ddzddd��n#1swxYwYddd��dS#1swxYwYdS)Nc��dS)NFr(r�s r�<lambda>z3TestBaseExitStack.test_exit_raise.<locals>.<lambda>�s���rrNr)r+r^r�r��rr�s  r�test_exit_raisez!TestBaseExitStack.test_exit_raise�s���
�
�
�0�
1�
1�	�	����"�"�
�e��
�
�-�-�.�.�.��!���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s4�A0�A�A0�A	�A0�A	� A0�0A4�7A4c��|���5}|�d���ddzddd��dS#1swxYwYdS)Nc��dSr8r(r�s rr�z6TestBaseExitStack.test_exit_suppress.<locals>.<lambda>���D�rrNr�r�r�r�s  r�test_exit_suppressz$TestBaseExitStack.test_exit_suppresss���
�_�_�
�
�	�%��J�J�(�(�)�)�)�
�a�C�C�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�>�A�Ac�`�d�}	|���5}|�|t��ddzddd��n#1swxYwYn#t$r}|}Yd}~nd}~wwxYw|�|t��t	j|j��}dg|jzddgz}|�d�|D��|��|�|j	t��t	j|j	j��}|�d�|D��d	g��dS)
Nc��|�rr(r�s r�	raise_exczBTestBaseExitStack.test_exit_exception_traceback.<locals>.raise_exc
����IrrNr)�test_exit_exception_tracebackz with self.exit_stack() as stack:)�
_exit_wrapperzcallback(*args, **kwds))r�z	raise excc�*�g|]}|j|jf��Sr(�rsrt��.0rbs  r�
<listcomp>zCTestBaseExitStack.test_exit_exception_traceback.<locals>.<listcomp> s!��1�1�1�!�a�f�a�f�
�1�1�1rc�*�g|]}|j|jf��Sr(r�r�s  rr�zCTestBaseExitStack.test_exit_exception_traceback.<locals>.<listcomp>$s!��?�?�?�q�1�6�1�6�*�?�?�?r)r�re)r�r��
ValueErrorr�r7rprq�callback_error_internal_framesrX�__context__r^)rr�r�ryr��	ve_framesr��
zde_framess        rr�z/TestBaseExitStack.test_exit_exception_tracebacks���	�	�	�	����"�"�
�e����y�*�5�5�5��!���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
����	�	�	��C�C�C�C�C�C�����	����	
���c�:�.�.�.��(��):�;�;�	�
R�S��/�
0�
9�
'�
)�
)�	�	
���1�1�y�1�1�1�8�	=�	=�	=�	
���c�o�/@�A�A�A��)�#�/�*G�H�H�
����?�?�J�?�?�?�B�C�	E�	E�	E�	E�	Es9�A�!A�A�A
�
A�
A
�A�
A(�A#�#A(c	�\�Gd�d��}Gd�d��}Gd�d��}	|t��5|tt��5|��5|t��5ddzddd��n#1swxYwYddd��n#1swxYwYddd��n#1swxYwYddd��n#1swxYwY|�d	��n�#t$rs}|�|jt��|�|jjt��|�|jjj��Yd}~nd}~wwxYw|jd}|�|t��|�|jt��dS)
Nc� �eZdZd�Zd�Zd�ZdS)�JTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcc��||_dSrr�r=s  rr�zSTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExc.__init__+ryrc��|Srr(r2s rr!zTTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExc.__enter__-r3rc��|j�rr�r�s  rrzSTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExc.__exit__/s	���h�rNr�r(rr�RaiseExcr�*sA������
�
�
�
�
�
�
�
�
�
�
rr�c� �eZdZd�Zd�Zd�ZdS)�UTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContextc�"�||_||_dSr)�outer�inner)rrrs   rr�z^TestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContext.__init__3s��"��
�"��
�
�
rc��|Srr(r2s rr!z_TestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContext.__enter__6r3rc�*�	|j�#|j�xYwr)rrr�s  rrz^TestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContext.__exit__8s ��%��*�$��%��*�$���s�	�	Nr�r(rr�RaiseExcWithContextr�2sA������
#�
#�
#�
�
�
�
%�
%�
%�
%�
%rrc��eZdZd�Zd�ZdS)�MTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.SuppressExcc��|Srr(r2s rr!zWTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.SuppressExc.__enter__?r3rc�.�|t|��_dSr8)rn�
saved_detailsr�s  rrzVTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.SuppressExc.__exit__As��+6��T�
�
�(��trNr8r(rr�SuppressExcr>s2������
�
�
�
�
�
�
�
rrrNr�0Expected IndexError, but no exception was raised)
�
IndexError�KeyError�AttributeErrorr�rxr�r�r�r
r^)rr�rrr��	inner_excs      r�&test_exit_exception_chaining_referencez8TestBaseExitStack.test_exit_exception_chaining_reference's���	�	�	�	�	�	�	�	�
	%�
	%�
	%�
	%�
	%�
	%�
	%�
	%�	�	�	�	�	�	�	�	�	J���*�%�%�
"�
"�(�(��>�B�B�"�"�$����"�"�%�X�j�1�1�"�"���E�E�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"����
"�
"�
"�
"�
�I�I�H�I�I�I�I��
�	G�	G�	G��!�!�#�/�8�<�<�<��!�!�#�/�"=�~�N�N�N����c�o�9�E�F�F�F�F�F�F�F�F�����		G���� �-�a�0�	����i��4�4�4����i�3�5F�G�G�G�G�Gs��C$�C�B,�B�,A>	�2B�>B
�B�B
�B�	B,�B�B,�B�B,� C�,B0	�0C�3B0	�4C�7C$�C�C$�
C�C$�$
E!�.A)E�E!c�4��d�}d��fd�}	|���5}|�|t��|�|t��|�|t��|�|��|�|t��ddzddd��n#1swxYwY|�d��n�#t$rs}|�|j	t��|�|j	j	t��|�
|j	j	j	��Yd}~nd}~wwxYw�d}|�|t��|�|j	t��dS)Nc��|�rr(r�s rr�zATestBaseExitStack.test_exit_exception_chaining.<locals>.raise_excYr�rc���|�dSr8r()r�r
s �r�suppress_exczDTestBaseExitStack.test_exit_exception_chaining.<locals>.suppress_exc]s
���'�M��4rrNrr)r�r�r
rrr�r�rxr�r�r�r^)rr�rr�r�rr
s      @r�test_exit_exception_chainingz.TestBaseExitStack.test_exit_exception_chainingWs����	�	�	��
�	�	�	�	�	�
	J����"�"�
�e����y�*�5�5�5����y�(�3�3�3����y�.�9�9�9��
�
�<�(�(�(����y�*�5�5�5��A���

�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�I�I�H�I�I�I�I��
�	G�	G�	G��!�!�#�/�8�<�<�<��!�!�#�/�"=�~�N�N�N����c�o�9�E�F�F�F�F�F�F�F�F�����		G����"�!�$�	����i��4�4�4����i�3�5F�G�G�G�G�Gs<�C�BB4�(C�4B8�8C�;B8�<C�
E�A)E
�
Ec�����Gd�dt���t�fd����t��fd���}�|fD]�}����5	|��5t���#1swxYwY	��d��n,#�$r$}��|j��Yd}~nd}~wwxYwddd��n#1swxYwY��dS)Nc��eZdZdS)�PTestBaseExitStack.test_exit_exception_explicit_none_context.<locals>.MyExceptionNr'r(rr�MyExceptionrzr*rrc3�d�K�	dV�dS#t$r���}	|�#d|_wxYwwxYwr)�
BaseExceptionr�)r�rs �r�my_cmzJTestBaseExitStack.test_exit_exception_explicit_none_context.<locals>.my_cm}s]�����
+�������� �
+�
+�
+�!�k�m�m��+��I��&*�C�O�*�*�*�*�
+���s��/�"�	+�/c3��K�����5}|������|V�ddd��dS#1swxYwYdSr)r�r�)r�rrs ��r�my_cm_with_exit_stackzZTestBaseExitStack.test_exit_exception_explicit_none_context.<locals>.my_cm_with_exit_stack�s���������"�"�
�e��#�#�E�E�G�G�,�,�,�����
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
s�"A�A�Ar)r�rWrwr
rxr�r�)rrr�r�rrs`   @@r�)test_exit_exception_explicit_none_contextz;TestBaseExitStack.test_exit_exception_explicit_none_contextvs������	�	�	�	�	�)�	�	�	�
�	+�	+�	+�	+�
��	+�
�	�	�	�	�	�
��	�
�/�0�	R�	R�B������
R�
R�R�����+�+�(�l�l�*�+�+�+�+����+�+�+�+�+�
�I�I�P�Q�Q�Q�Q��#�7�7�7��%�%�c�o�6�6�6�6�6�6�6�6�����7����	
R�
R�
R�
R�
R�
R�
R�
R�
R�
R�
R����
R�
R�
R�
R��	R�	RsZ�C�
B�"A1�1A5�5B�8A5�9B�=C�B<�B7�2C�7B<�<C�C	�C	c���d�}d�}	|���5}|�d���|�|t��ddd��n#1swxYwY|�d��n2#t$r%}|�|t��Yd}~nd}~wwxYw	|���5}|�|t��|�|��|�|t��ddd��n#1swxYwY|�d��dS#t$r&}|�|t��Yd}~dSd}~wwxYw)Nc��|�rr(r�s rr�zHTestBaseExitStack.test_exit_exception_non_suppressing.<locals>.raise_exc�r�rc��dSr8r(r�s rrzKTestBaseExitStack.test_exit_exception_non_suppressing.<locals>.suppress_exc�r�rc��dSrr(r(rrr�zGTestBaseExitStack.test_exit_exception_non_suppressing.<locals>.<lambda>�s��t�rrz.Expected KeyError, but no exception was raised)r�r�r
rxr�r�rr�)rr�rr�r�s     r�#test_exit_exception_non_suppressingz5TestBaseExitStack.test_exit_exception_non_suppressing�s��	�	�	�	�	�	�	J����"�"�
6�e����|�|�,�,�,����y�*�5�5�5�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�
�I�I�H�I�I�I�I���	3�	3�	3��!�!�#�z�2�2�2�2�2�2�2�2�����	3����
	H����"�"�
6�e����y�(�3�3�3��
�
�<�(�(�(����y�*�5�5�5�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�
�I�I�F�G�G�G�G�G���	1�	1�	1��!�!�#�x�0�0�0�0�0�0�0�0�0�����	1���sw�A;�2A�A;�A�A;�!A�"A;�;
B*�B%�%B*�.D<�AD�D<�D�D<�!D�"D<�<
E,�E'�'E,c��td���}td��}td��}td��}td��}	|���5}|�||����|�||����|�||����|�#1swxYwYdS#t$r�}|�||��|�|j|��|�|jj|��|�|jjj|��|�|jjjj��Yd}~dSd}~wwxYw)Nc3� K�	dV�|�#|�xYwrr(r�s r�gets_the_context_rightzZTestBaseExitStack.test_exit_exception_with_correct_context.<locals>.gets_the_context_right�s$����
������	��c�	�	�	�	s�
�
rNr\r�r�)rWr�r�r�r r�r�)rr(�exc1�exc2�exc3�exc4r�r�s        r�(test_exit_exception_with_correct_contextz:TestBaseExitStack.test_exit_exception_with_correct_context�s���	�	�	�
��	���|�|����|�|����|�|����|�|��
	L����"�"�
�e��#�#�$:�$:�4�$@�$@�A�A�A��#�#�$:�$:�4�$@�$@�A�A�A��#�#�$:�$:�4�$@�$@�A�A�A��
�	
�
�
�
����
�
�
�
�
�
��
�	L�	L�	L��M�M�#�t�$�$�$��M�M�#�/�4�0�0�0��M�M�#�/�5�t�<�<�<��M�M�#�/�5�A�4�H�H�H������2�>�J�
L�
L�
L�
L�
L�
L�
L�
L�
L�����	L���s8�C�"AB?�?C�C�C�C�
F�BE;�;Fc��d�}td��}td��}td��}td��}td��}	|���5}|�|||��|�|||��|�#1swxYwYdS#t$r�}|�||��|�|j|��|�|jj|��|�|jjj|��|�|jjjj|��|�|jjjjj��Yd}~dSd}~wwxYw)Nc��	|�#|�xYwrr()r�	outer_excs  r�raise_nestedzQTestBaseExitStack.test_exit_exception_with_existing_context.<locals>.raise_nested�s��
 ��������s��rNr\r�r�r�)r�r�r�r r�r�)	rr1r)r*r+r,�exc5r�r�s	         r�)test_exit_exception_with_existing_contextz;TestBaseExitStack.test_exit_exception_with_existing_context�s���	 �	 �	 �
��|�|����|�|����|�|����|�|����|�|��
	Q����"�"�
�e����|�T�4�8�8�8����|�T�4�8�8�8��
�
�
�
�
����
�
�
�
�
�
���	Q�	Q�	Q��M�M�#�t�$�$�$��M�M�#�/�4�0�0�0��M�M�#�/�5�t�<�<�<��M�M�#�/�5�A�4�H�H�H��M�M���,�8�D�d�
L�
L�
L������+�7�C�O�
Q�
Q�
Q�
Q�
Q�
Q�
Q�
Q�
Q�����	Q���s7�B"�$1B�B�B"�B�B"�"
F�,CF�Fc��d�}	|���5}|�|��ddzddd��dS#1swxYwYdS#t$r }|�d��Yd}~dSd}~wwxYw)Nc��dSr8r(r�s rrzDTestBaseExitStack.test_body_exception_suppress.<locals>.suppress_exc�r�rrNrz%Expected no exception, got IndexError)r�r�r
rx)rrr�r�s    r�test_body_exception_suppressz.TestBaseExitStack.test_body_exception_suppress�s���	�	�	�	?����"�"�
�e��
�
�<�(�(�(��!���
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
���	?�	?�	?��I�I�=�>�>�>�>�>�>�>�>�>�����	?���s9�A�A�A�A�A�A�	A�
A8�A3�3A8c���|���5}|�d���|�d���|�d���ddd��dS#1swxYwYdS)Nc��dSr8r(r�s rr�zITestBaseExitStack.test_exit_exception_chaining_suppress.<locals>.<lambda>�r�rc��ddzSrr(r�s rr�zITestBaseExitStack.test_exit_exception_chaining_suppress.<locals>.<lambda>�s
��A�a�C�rc��idSr�r(r�s rr�zITestBaseExitStack.test_exit_exception_chaining_suppress.<locals>.<lambda>�s
��B�q�E�rr�r�s  r�%test_exit_exception_chaining_suppressz7TestBaseExitStack.test_exit_exception_chaining_suppress�s���
�_�_�
�
�	+�%��J�J�(�(�)�)�)��J�J�'�'�(�(�(��J�J�)�)�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�AA%�%A)�,A)c��|���5}td��D]}|�t���	ddd��dS#1swxYwYdS)Ni')r��ranger��int)rr��is   r�test_excessive_nestingz(TestBaseExitStack.test_excessive_nesting�s���
�_�_�
�
�	$�%��5�\�\�
$�
$�����s�#�#�#�#�
$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$s�-A�A�Ac��Gd�dt��}|��}t��|_t��|_|���}|�t
d��5|�|��ddd��n#1swxYwY|�|��|�|j	dd|��dS)Nc��eZdZdS)�7TestBaseExitStack.test_instance_bypass.<locals>.ExampleNr'r(rr�ExamplerC��������rrDrgr�rN)
r]r!rr�rGr,r�r�r r�)rrDr�r�s    r�test_instance_bypassz&TestBaseExitStack.test_instance_bypasss��#�#�#�#�#�f�#�#�#�
�W�Y�Y���x�x����h�h������!�!��
�
#�
#�I�/D�
E�
E�	$�	$�����#�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�
�
�
�2�����
�
�e�+�B�/��2�B�7�7�7�7�7s�3B�B�Bc����Gd�dt���Gd�dt��}t�fd���}td���}|����5}|���5}|�|����|�|����|d���#1swxYwY	ddd��n#1swxYwY|j}|�|���|�|j|��|�	|jj��|�	|jj
��|�|j
|j��dS)Nc��eZdZdS)�ITestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.UniqueExceptionNr'r(rr�UniqueExceptionrIrErrJc��eZdZdS)�LTestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.UniqueRuntimeErrorNr'r(rr�UniqueRuntimeErrorrLrErrMc3�R�K�	dV�dS#t$r}�d��|�d}~wwxYw)NrNz
new exception�r�)r�rJs �r�secondz@TestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.secondsO�����
@���������
@�
@�
@�%�o�o�6�6�C�?�����
@���s��
&�!�&c3�<K�	dV�dS#t$r}|�d}~wwxYwr�rOr�s r�firstz?TestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.firsts<����
���������
�
�
��	�����
���s�
�
��zplease no infinite loop.)r�rurWr+r�r��	exceptionr�r�r�r�r )rrMrPrR�err_ctx�es_ctxr�rJs       @r�test_dont_reraise_RuntimeErrorz0TestBaseExitStack.test_dont_reraise_RuntimeErrors���.�.�.�.�.�i�.�.�.�4�4�4�4�4��4�4�4�	�	@�	@�	@�	@�
��	@�
�	�	�
��	��
�
��
/�
/�	E�7����"�"�
E�f��$�$�V�V�X�X�.�.�.��$�$�U�U�W�W�-�-�-�(�(�)C�D�D�D�
E�
E�
E�
E����
E�
E�
E�
E�
E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E�������c�?�3�3�3����c�o�/A�B�B�B����#�/�5�6�6�6����#�/�3�4�4�4��
�
�c�m�S�_�5�5�5�5�5s1�C�4AB:�:B>	�>C�B>	�C�C�C)rrrr�rr�r�r�r�r�r�r�r�r�r�r�r�rrr r%r-r3r6r;r@rFrVr(rrr�r�es��������J�� �4�4�!� �4����'%�'%�'%�R � � �D/�/�/�&4�4�4�&	)�	)�	)�,�,�,�������
E�E�E�@.H�.H�.H�`H�H�H�> R� R� R�DH�H�H�6L�L�L�>Q�Q�Q�8?�?�?�+�+�+�$�$�$�	8�	8�	8� 6� 6� 6� 6� 6rr�c��eZdZeZddgZdS)�
TestExitStack)rzraise exc_details[1])rzif cb(*exc_details):N)rrr�	ExitStackr�r�r(rrrXrX2s#�������J�,�,�&�"�"�"rrXc�T�eZdZdZdZejd���Zd�Zd�Z	d�Z
d�Zd�ZdS)�TestRedirectStreamNc�~�|jj}|�d��}|�|j|��dSr)�redirect_streamr�rXr�s   rr�z%TestRedirectStream.test_instance_docs?s@���+�3���"�"�4�(�(�������l�3�3�3�3�3rc��tt|j��}|�d��|�tt|j��|��dSr)�getattr�sys�orig_streamr]r )r�orig_stdouts  r�test_no_redirect_in_initz+TestRedirectStream.test_no_redirect_in_initFsO���c�4�#3�4�4�����T�"�"�"��
�
�g�c�4�#3�4�4�k�B�B�B�B�Brc���tj��}d}tt|j��}|�|��5t
|tt|j�����ddd��n#1swxYwY|�tt|j��|��|����	��}|�
||��dS)Nz<Consider an API like help(), which prints directly to stdout��file)�io�StringIOr_r`rar]�printr �getvalue�striprX)rrb�msgrb�ss     r�test_redirect_to_string_ioz-TestRedirectStream.test_redirect_to_string_ioKs���K�M�M��L���c�4�#3�4�4��
�
!�
!�!�
$�
$�	<�	<��#�G�C��)9�:�:�;�;�;�;�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<��
�
�g�c�4�#3�4�4�k�B�B�B�
�J�J�L�L��� � ������C� � � � � s�*A;�;A?�A?c��tj��}|�|��5}|�||��ddd��dS#1swxYwYdSr)rgrhr]r )rrb�enter_results   r�test_enter_result_is_targetz.TestRedirectStream.test_enter_result_is_targetUs����K�M�M��
�
!�
!�!�
$�
$�	+���M�M�,��*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�A
�
A�Ac	�H�tj��}|�|��}tt|j��}|5t
ddtt|j�����ddd��n#1swxYwY|5t
dtt|j�����ddd��n#1swxYwY|�tt|j��|��|���}|�	|d��dS�N�Hello� )�endrfzWorld!rez
Hello World!
�
rgrhr]r_r`rarir rjrX�rrb�
write_to_frbrms     r�test_cm_is_reusablez&TestRedirectStream.test_cm_is_reusableZs����K�M�M���)�)�!�,�,�
��c�4�#3�4�4��
�	I�	I��'�s���d�6F�)G�)G�H�H�H�H�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�
�	A�	A��(���d�.>�!?�!?�@�@�@�@�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A��
�
�g�c�4�#3�4�4�k�B�B�B�
�J�J�L�L������,�-�-�-�-�-s$�+A<�<B�B�	*B?�?C�Cc	�H�tj��}|�|��}tt|j��}|5t
ddtt|j�����|5t
dtt|j�����ddd��n#1swxYwYddd��n#1swxYwY|�tt|j��|��|���}|�	|d��dSrsrwrxs     r�test_cm_is_reentrantz'TestRedirectStream.test_cm_is_reentrantfs����K�M�M���)�)�!�,�,�
��c�4�#3�4�4��
�	E�	E��'�s���d�6F�)G�)G�H�H�H�H��
E�
E��h�W�S�$�2B�%C�%C�D�D�D�D�
E�
E�
E�
E�
E�
E�
E�
E�
E�
E�
E����
E�
E�
E�
E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E�	
�
�
�g�c�4�#3�4�4�k�B�B�B�
�J�J�L�L������,�-�-�-�-�-s6�-B?�2*B(�B?�(B,	�,B?�/B,	�0B?�?C�C)
rrrr]rarr�r�rcrnrqrzr|r(rrr[r[:s��������O��K�� �4�4�!� �4�C�C�C�
!�!�!�+�+�+�

.�
.�
.�
.�
.�
.�
.�
.rr[c��eZdZeZdZdS)�TestRedirectStdout�stdoutN)rrr�redirect_stdoutr]rar(rrr~r~s�������%�O��K�K�Krr~c��eZdZeZdZdS)�TestRedirectStderr�stderrN)rrr�redirect_stderrr]rar(rrr�r�yr�rr�c�^�eZdZejd���Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
S)�TestSuppressc�p�tj}t��}|�|j|��dSr)�suppressr�rXr�s   rr�zTestSuppress.test_instance_docs�s3�� �'���j�j�������l�3�3�3�3�3rc��tt��5}|�|��ddd��dS#1swxYwYdSr)r�r�r�)rrps  r�test_no_result_from_enterz&TestSuppress.test_no_result_from_enter�s���
�j�
!�
!�	,�\����l�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,s�8�<�<c��tt��5|�tdd��d��ddd��dS#1swxYwYdS)Nr\r�� )r�r�rX�powr2s r�test_no_exceptionzTestSuppress.test_no_exception�s���
�j�
!�
!�	,�	,����S��A�Y�Y��+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,s�%A�A�Ac�~�tt��5td��ddd��dS#1swxYwYdS)Nr�)r�r,rrr2s r�test_exact_exceptionz!TestSuppress.test_exact_exception�s��
�i�
 �
 �	�	���F�F�F�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�2�6�6c�p�tt��5ddddd��dS#1swxYwYdS)Nrt�2)r��LookupErrorr2s r�test_exception_hierarchyz%TestSuppress.test_exception_hierarchy�s}��
�k�
"�
"�	�	��B�K�K�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�	+�/�/c���|�t��5tt��5ddzddd��n#1swxYwYddd��dS#1swxYwYdSr)r+r^r�r,r2s r�test_other_exceptionz!TestSuppress.test_other_exception�s���
�
�
�0�
1�
1�	�	��)�$�$�
�
��!���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s3�A�A�A�A	�A�	A	�
A�A�!Ac���|�t��5t��5ddzddd��n#1swxYwYddd��dS#1swxYwYdSr)r+r^r�r2s r�test_no_argszTestSuppress.test_no_args�s���
�
�
�0�
1�
1�	�	����
�
��!���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s1�A�<�A�A	�A�A	�A�A�Ac��ttt��5ddzddd��n#1swxYwYttt��5td��ddd��dS#1swxYwYdS)NrNrr�)r�r^r,rrr2s r�test_multiple_exception_argsz)TestSuppress.test_multiple_exception_args�s���
�'��
3�
3�	�	�
�a�C�C�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�'��
3�
3�	�	���F�F�F�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�-�1�1�A/�/A3�6A3c�t�tt��}|5	ddd��n#1swxYwY|5td��ddd��n#1swxYwY|5|5td��ddd��n#1swxYwYd}ddzddd��n#1swxYwY|�|��dS)Nr�TrNr)r�r�rrrE)r�ignore_exceptions�outer_continueds   rr|z!TestSuppress.test_cm_is_reentrant�s���$�Y�/�/��
�	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�	�	���F�F�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�	�	�"�
�
��A����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�"�O�
�a�C�C�		�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
	
����(�(�(�(�(sS�%�)�)�A�A�A�B�A:�.B�:A>	�>B�A>	�
B�B�BN)rrrrr�r�r�r�r�r�r�r�r�r|r(rrr�r�s�������� �4�4�!� �4�,�,�,�,�,�,����������
���
���)�)�)�)�)rr�c�&�eZdZd�Zd�Zd�Zd�ZdS)�	TestChdirc��tjjtj�tj�t
����g|�R�Sr)�os�path�join�dirname�realpath�__file__)r�partss  r�make_relative_pathzTestChdir.make_relative_path�sF���w�|��G�O�O�B�G�,�,�X�6�6�7�7�
�
�
�
�
�	
rc�l�tj��}|�d��}|�||��t	|��5|�tj��|��ddd��n#1swxYwY|�tj��|��dS)N�data)r��getcwdr�r��chdirrX)r�old_cwdr�s   r�test_simplezTestChdir.test_simple�s����)�+�+���(�(��0�0�����G�V�,�,�,�
�6�]�]�	2�	2����R�Y�[�[�&�1�1�1�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2��������g�.�.�.�.�.s�(B�B�	Bc�\�tj��}|�d��}|�d��}|�|||f��t	|��t	|��}}|5|�tj��|��|5|�tj��|��|5|�tj��|��ddd��n#1swxYwY|�tj��|��ddd��n#1swxYwY|�tj��|��ddd��n#1swxYwY|�tj��|��dS)Nr��ziptestdata)r�r�r��assertNotInr�rX)rr��target1�target2�chdir1�chdir2s      r�test_reentrantzTestChdir.test_reentrant�s&���)�+�+���)�)�&�1�1���)�)�-�8�8������7�G�"4�5�5�5��w����w�����
�	3�	3����R�Y�[�[�'�2�2�2��
7�
7�� � �����g�6�6�6��;�;��$�$�R�Y�[�[�'�:�:�:�;�;�;�;�;�;�;�;�;�;�;����;�;�;�;�� � �����g�6�6�6�	
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7�

���R�Y�[�[�'�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�	
�������g�.�.�.�.�.sZ�6*E:� *D<�
(C>�2D<�>D�D<�D�*D<�0E:�<E	�E:�E	�*E:�:E>�E>c���tj��}|�d��}|�||��	t	|��5|�tj��|��t
d���#1swxYwYn:#t$r-}|�t|��d��Yd}~nd}~wwxYw|�tj��|��dS)Nr��boom)r�r�r�r�r�rXru�str)rr�r��res    r�test_exceptionzTestChdir.test_exception�s���)�+�+���(�(��0�0�����G�V�,�,�,�	.��v���
+�
+�� � �����f�5�5�5�"�6�*�*�*�
+�
+�
+�
+����
+�
+�
+�
+�
+���	.�	.�	.����S��W�W�f�-�-�-�-�-�-�-�-�����	.�����������g�.�.�.�.�.s6�B�7B�B
�
B�
B
�B�
C	�#C�C	N)rrrr�r�r�r�r(rrr�r��sP������
�
�
�/�/�/�/�/�/�"/�/�/�/�/rr��__main__) rgr�r`r	rr7�unittest�
contextlibrOr�test.supportrr��TestCaserrJr�r�rrrir6r?r�rXr[r~r�r�r�r�mainr(rr�<module>r�su��?�	�	�	�	�	�	�	�	�
�
�
�
���������������������������"�"�"�"�"�"�����(E�(E�(E�(E�(E��!2�(E�(E�(E�VI#�I#�I#�I#�I#�X�.�I#�I#�I#�X%�%�%�%�%�h�'�%�%�%�D#�#�#�#�#�(�+�#�#�#�"�"�"�"�"�(�+�"�"�"�(-'�-'�-'�-'�-'�(�+�-'�-'�-'�`����� ����]<�]<�]<�]<�]<�8�,�]<�]<�]<�@J6�J6�J6�J6�J6�J6�J6�J6�Z�����%�x�'8����6.�6.�6.�6.�6.�6.�6.�6.�r�����+�X�->���������+�X�->����4)�4)�4)�4)�4)�8�$�4)�4)�4)�n,/�,/�,/�,/�,/��!�,/�,/�,/�^�z����H�M�O�O�O�O�O��r