Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_with.cpython-38.opt-1.pyc
U

>��gg�@sHdZdZdZddlZddlZddlmZddlmZm	Z	Gdd�de�Z
d	d
�ZGdd�de�Z
ed
d��ZGdd�de�ZGdd�de�ZGdd�dej�ZGdd�de�ZGdd�deje�ZGdd�deje�ZGdd�deej�ZGdd�dej�ZGdd �d ej�ZGd!d"�d"ej�ZGd#d$�d$ej�Zed%k�rDe��dS)&z7Unit tests for the with statement specified in PEP 343.z
Mike Blandzmbland at acm dot org�N)�deque)�_GeneratorContextManager�contextmanagercs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�MockContextManagercs"t�j|�d|_d|_d|_dS�NF)�super�__init__�enter_called�exit_called�	exit_args��self�args��	__class__��-/opt/cppython/lib/python3.8/test/test_with.pyrszMockContextManager.__init__cCsd|_t�|�S�NT)r	r�	__enter__�r
rrrrszMockContextManager.__enter__cCs"d|_|||f|_t�||||�Sr)r
rr�__exit__�r
�type�value�	tracebackrrrrs�zMockContextManager.__exit__)�__name__�
__module__�__qualname__rrr�
__classcell__rrrrr
srcs�fdd�}|S)Ncst�||�S�N)r)r�kwds��funcrr�helper sz#mock_contextmanager.<locals>.helperr)r"r#rr!r�mock_contextmanagersr$c@seZdZdd�ZdS)�MockResourcecCsd|_d|_dSr)�yielded�stoppedrrrrr&szMockResource.__init__N�rrrrrrrrr%%sr%ccs$t�}zd|_|VW5d|_XdSr)r%r'r&)�mockrrr�mock_contextmanager_generator+s

r*c@s$eZdZdd�Zdd�Zdd�ZdS)�NestedcGs||_d|_dSr)�managers�entered�r
r,rrrr7szNested.__init__cCsj|jdk	rtd��t�|_g}z*|jD]}|�|���|j�|�q&Wn|jt�	��s`�YnX|S)NzContext is not reentrant)
r-�RuntimeErrorrr,�appendr�
appendleftr�sys�exc_info)r
�vars�mgrrrrr;s

zNested.__enter__cGsd|}|jD],}z|j|�rd}Wq
t��}Yq
Xq
d|_||k	r`|d|d��|d��dS)N�NNNr��)r-rr2r3�with_traceback)r
r3�exr5rrrrIs

zNested.__exit__N�rrrrrrrrrrr+5sr+c@s$eZdZdd�Zdd�Zdd�ZdS)�
MockNestedcGs&tj|f|��d|_d|_d|_dSr)r+rr	r
rr.rrrrZszMockNested.__init__cCsd|_t�|�Sr)r	r+rrrrrr`szMockNested.__enter__cGsd|_||_tj|f|��Sr)r
rr+r�r
r3rrrrdszMockNested.__exit__Nr;rrrrr<Ysr<c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�FailureTestCasecCsdd�}|�t|�dS)Nc	Sst�W5QRXdSr��foorrrr�fooNotDeclaredlsz5FailureTestCase.testNameError.<locals>.fooNotDeclared)�assertRaises�	NameError)r
rArrr�
testNameErrorkszFailureTestCase.testNameErrorcs.Gdd�dt���fdd�}|�td|�dS)Nc@seZdZdd�ZdS)z<FailureTestCase.testEnterAttributeError1.<locals>.LacksEntercSsdSrrrrrrrrszEFailureTestCase.testEnterAttributeError1.<locals>.LacksEnter.__exit__N)rrrrrrrr�
LacksEnterqsrEc	s��}|�W5QRXdSrrr?�rErr�
fooLacksEnterusz?FailureTestCase.testEnterAttributeError1.<locals>.fooLacksEnterr��object�assertRaisesRegex�AttributeError)r
rGrrFr�testEnterAttributeError1psz(FailureTestCase.testEnterAttributeError1cs.Gdd�dt���fdd�}|�td|�dS)Nc@seZdZdS)zCFailureTestCase.testEnterAttributeError2.<locals>.LacksEnterAndExitN�rrrrrrr�LacksEnterAndExit{srNc	s��}|�W5QRXdSrrr?�rNrr�fooLacksEnterAndExit~szFFailureTestCase.testEnterAttributeError2.<locals>.fooLacksEnterAndExitrrH)r
rPrrOr�testEnterAttributeError2zsz(FailureTestCase.testEnterAttributeError2cs.Gdd�dt���fdd�}|�td|�dS)Nc@seZdZdd�ZdS)z9FailureTestCase.testExitAttributeError.<locals>.LacksExitcSsdSrrrrrrr�szCFailureTestCase.testExitAttributeError.<locals>.LacksExit.__enter__N)rrrrrrrr�	LacksExit�srRc	s��}|�W5QRXdSrrr?�rRrr�fooLacksExit�sz<FailureTestCase.testExitAttributeError.<locals>.fooLacksExitrrH)r
rTrrSr�testExitAttributeError�sz&FailureTestCase.testExitAttributeErrorcCsdd�}|�t||�dS)NcSst|dd�dS)N�Zsingle)�compile)�srrr�shouldRaiseSyntaxError�szGFailureTestCase.assertRaisesSyntaxError.<locals>.shouldRaiseSyntaxError)rB�SyntaxError)r
ZcodestrrYrrr�assertRaisesSyntaxError�sz'FailureTestCase.assertRaisesSyntaxErrorcCs|�d�|�d�dS)Nzwith mock as None:
  passzwith mock as (None):
  pass�r[rrrr�testAssignmentToNoneError�s
�z)FailureTestCase.testAssignmentToNoneErrorcCs|�d�|�d�dS)Nzwith mock as None,:
  passzwith mock as (None,):
  passr\rrrr�,testAssignmentToTupleOnlyContainingNoneError�s
�z<FailureTestCase.testAssignmentToTupleOnlyContainingNoneErrorcCs|�d�dS)Nz%with mock as (foo, None, bar):
  passr\rrrr�(testAssignmentToTupleContainingNoneError�s�z8FailureTestCase.testAssignmentToTupleContainingNoneErrorcs<Gdd�dt����fdd�}��t|����jd�dS)Nc@seZdZdd�Zdd�ZdS)z4FailureTestCase.testEnterThrows.<locals>.EnterThrowscSstd��dS)NzEnter threw�r/rrrrr�sz>FailureTestCase.testEnterThrows.<locals>.EnterThrows.__enter__cWsdSrrrrrrr�sz=FailureTestCase.testEnterThrows.<locals>.EnterThrows.__exit__N�rrrrrrrrr�EnterThrows�srbc	s"��}d�_|��_W5QRXdSrr?)�ct�rbr
rr�shouldThrow�sz4FailureTestCase.testEnterThrows.<locals>.shouldThrow)rIrBr/�assertEqualr@�r
rerrdr�testEnterThrows�szFailureTestCase.testEnterThrowscs,Gdd�dt���fdd�}|�t|�dS)Nc@seZdZdd�Zdd�ZdS)z2FailureTestCase.testExitThrows.<locals>.ExitThrowscSsdSrrrrrrr�sz<FailureTestCase.testExitThrows.<locals>.ExitThrows.__enter__cWstd��dS)N�*r`rrrrr�sz;FailureTestCase.testExitThrows.<locals>.ExitThrows.__exit__Nrarrrr�
ExitThrows�srjc	s���W5QRXdSrrr�rjrrre�sz3FailureTestCase.testExitThrows.<locals>.shouldThrow)rIrBr/rgrrkr�testExitThrows�szFailureTestCase.testExitThrowsN)
rrrrDrLrQrUr[r]r^r_rhrlrrrrr>js
	
r>c@sVeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dd�ZdS)�ContextmanagerAssertionMixincCstd�|_dS)Nztest exception)r/�TEST_EXCEPTIONrrrr�setUp�sz"ContextmanagerAssertionMixin.setUpcCs*|�|j�|�|j�|�|jd�dSr)�
assertTruer	�assertFalser
rfr�r
�mock_managerrrr�assertInWithManagerInvariants�sz:ContextmanagerAssertionMixin.assertInWithManagerInvariantscCs*|�|j�|�|j�|�|j|�dSr)rpr	r
rfr)r
rsrrrr� assertAfterWithManagerInvariants�sz=ContextmanagerAssertionMixin.assertAfterWithManagerInvariantscCs|�|d�dS)Nr6)rurrrrr�'assertAfterWithManagerInvariantsNoError�s�zDContextmanagerAssertionMixin.assertAfterWithManagerInvariantsNoErrorcCs|�|j�|�|j�dSr)rpr&rqr'�r
Zmock_generatorrrr�assertInWithGeneratorInvariants�sz<ContextmanagerAssertionMixin.assertInWithGeneratorInvariantscCs|�|j�|�|j�dSr�rpr&r'rwrrr�)assertAfterWithGeneratorInvariantsNoError�szFContextmanagerAssertionMixin.assertAfterWithGeneratorInvariantsNoErrorcCs
|j�dSr)rnrrrr�raiseTestException�sz/ContextmanagerAssertionMixin.raiseTestExceptionNcCsx|�|j�|�|j�|dkr>|�|jd|j�t|j�}|�|jd|�|�|jd|�|�|jdd�dS)Nr7rr8)	rpr	r
rfrrnrZassertIsInstanceZassertIsNot)r
rs�exc_typerrr�)assertAfterWithManagerInvariantsWithError�s
zFContextmanagerAssertionMixin.assertAfterWithManagerInvariantsWithErrorcCs|�|j�|�|j�dSrryrwrrr�+assertAfterWithGeneratorInvariantsWithError�szHContextmanagerAssertionMixin.assertAfterWithGeneratorInvariantsWithError)N)rrrrortrurvrxrzr{r}r~rrrrrm�s�
rmc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�NonexceptionalTestCasec	Cst��W5QRXdSr�r*rrrr�testInlineGeneratorSyntax�sz0NonexceptionalTestCase.testInlineGeneratorSyntaxc	Cs$t�}|�W5QRX|�|�dSr)r*rv)r
r)rrr�testUnboundGenerator�s
z+NonexceptionalTestCase.testUnboundGeneratorc	Cs*t��}|�|�W5QRX|�|�dSr�r*rxrz�r
r@rrr�testInlineGeneratorBoundSyntax�sz5NonexceptionalTestCase.testInlineGeneratorBoundSyntaxc	Cs.d}t��}|�|�W5QRX|�|�dSrr�r�rrr�*testInlineGeneratorBoundToExistingVariable�szANonexceptionalTestCase.testInlineGeneratorBoundToExistingVariablec	Cs0t��|_|�|j�W5QRX|�|j�dSr)r*r@rxrzrrrr�(testInlineGeneratorBoundToDottedVariables
z?NonexceptionalTestCase.testInlineGeneratorBoundToDottedVariablec	CsBt�}|�}|�|�|�|�W5QRX|�|�|�|�dSr)r*rxrtrzrv)r
r)r@rrr�testBoundGenerators

z)NonexceptionalTestCase.testBoundGeneratorc
Cs�t�}|�l}t�}|�.}|�|�|�|�|�|�|�|�W5QRX|�|�|�|�|�|�|�|�W5QRX|�|�|�|�dSr)r*rtrxrvrz)r
�mock_ar@�mock_b�barrrr�testNestedSingleStatementss






z1NonexceptionalTestCase.testNestedSingleStatementsN)
rrrr�r�r�r�r�r�r�rrrrr�src@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�NestedNonexceptionalTestCasec	Cstt���W5QRXdSr�r+r*rrrr�"testSingleArgInlineGeneratorSyntax#sz?NestedNonexceptionalTestCase.testSingleArgInlineGeneratorSyntaxc	Cs2t�}t|��}|�|�W5QRX|�|�dSr�r*r+rtrv�r
�mr@rrr�testSingleArgBoundToNonTuple's
z9NestedNonexceptionalTestCase.testSingleArgBoundToNonTuplec	Cs2t�}t|��}|�|�W5QRX|�|�dSrr�r�rrr�2testSingleArgBoundToSingleElementParenthesizedList/s
zONestedNonexceptionalTestCase.testSingleArgBoundToSingleElementParenthesizedListcCsdd�}|�t|�dS)Nc	Sstt���
\}}W5QRXdSrr�)r@r�rrr�shouldThrowValueError8sziNestedNonexceptionalTestCase.testSingleArgBoundToMultipleElementTupleError.<locals>.shouldThrowValueError)rB�
ValueError)r
r�rrr�-testSingleArgBoundToMultipleElementTupleError7szJNestedNonexceptionalTestCase.testSingleArgBoundToMultipleElementTupleErrorc	CsJt�}t|�}|�|�|�|�|�W5QRX|�|�|�|�dSr�r*r<rtrv)r
r$�mock_nestedrrr�testSingleArgUnbound=s

z1NestedNonexceptionalTestCase.testSingleArgUnboundc	Cs�t�}t�}t�}t|||�}|�.|�|�|�|�|�|�|�|�W5QRX|�|�|�|�|�|�|�|�dSrr�)r
r��n�or�rrr�testMultipleArgUnboundFs





z3NestedNonexceptionalTestCase.testMultipleArgUnboundc	Cs|tt�t�t��}|�4\}}}|�|�|�|�|�|�|�|�W5QRX|�|�|�|�|�|�|�|�dSr)r<r*rxrtrzrv)r
r�r�r�r�rrr�testMultipleArgBoundUs�





z1NestedNonexceptionalTestCase.testMultipleArgBoundN)
rrrr�r�r�r�r�r�r�rrrrr�!s	r�c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�ExceptionalTestCasecs:t����fdd�}��t|��������j�dS)Nc	s4��&�_�������j����W5QRXdSr)�resourcertrxr{r��cmr
rrrefs
z;ExceptionalTestCase.testSingleResource.<locals>.shouldThrow)r*rBr/r}r~r�rgrr�r�testSingleResourceds

z&ExceptionalTestCase.testSingleResourcecs0t����fdd�}��t|����t�dS)Nc	s���_ddW5QRXdS�Nr7r)r�rr�rrreqsz@ExceptionalTestCase.testExceptionNormalized.<locals>.shouldThrow)r*rB�ZeroDivisionErrorr}rgrr�r�testExceptionNormalizedosz+ExceptionalTestCase.testExceptionNormalizedcsXt��t�����fdd�}��t|������������j����j�dS)Nc
s\��N�_��<�_�����������j����j����W5QRXW5QRXdSr�r@r�rtrxr{r�r�r�r
rrre|s

zCExceptionalTestCase.testNestedSingleStatements.<locals>.shouldThrow)r*rBr/r}r~r@r�rgrr�rr�ys

z.ExceptionalTestCase.testNestedSingleStatementscsnt��t��t��������fdd�}��t|����������������j����j�dS)Nc	sZ��L\�_�_���������������j����j����W5QRXdSr)�
resource_a�
resource_brtrxr{r�Zcm_aZcm_br�r
rrre�s


zOExceptionalTestCase.testMultipleResourcesInSingleStatement.<locals>.shouldThrow)r*r<rBr/r}r~r�r�rgrr�r�&testMultipleResourcesInSingleStatement�s



z:ExceptionalTestCase.testMultipleResourcesInSingleStatementcs|t��t��d�_���fdd�}��t|��������j����jd����j	����j
����jd�dS)Nc
sF��8�_�������j�������_W5QRXW5QRXdSr)r@rtrxr{r�rr�rrre�s
zPExceptionalTestCase.testNestedExceptionBeforeInnerStatement.<locals>.shouldThrow)r*r�rBr/r}r~r@rfrqr	r
rrgrr�r�'testNestedExceptionBeforeInnerStatement�s
z;ExceptionalTestCase.testNestedExceptionBeforeInnerStatementcsXt��t�����fdd�}��t|������������j����j�dS)Nc
s\��N�_��4�_�����������j����j�W5QRX���W5QRXdSrr�rr�rrre�s

zOExceptionalTestCase.testNestedExceptionAfterInnerStatement.<locals>.shouldThrow)	r*rBr/r}rvr~r@rzr�rgrr�r�&testNestedExceptionAfterInnerStatement�s

z:ExceptionalTestCase.testNestedExceptionAfterInnerStatementc	s:tdd����fdd�}|�td��|�W5QRXdS)Ncss
dVdSrrrrrrr��sz8ExceptionalTestCase.testRaisedStopIteration1.<locals>.cmc	s���td��W5QRXdS�N�	from with��
StopIterationr�r�rrre�szAExceptionalTestCase.testRaisedStopIteration1.<locals>.shouldThrowr�)rrJr�rgrr�r�testRaisedStopIteration1�s

z,ExceptionalTestCase.testRaisedStopIteration1c	s>Gdd�dt���fdd�}|�td��|�W5QRXdS)Nc@seZdZdd�Zdd�ZdS)z8ExceptionalTestCase.testRaisedStopIteration2.<locals>.cmcSsdSrrrrrrr�szBExceptionalTestCase.testRaisedStopIteration2.<locals>.cm.__enter__cSsdSrrrrrrr�szAExceptionalTestCase.testRaisedStopIteration2.<locals>.cm.__exit__Nrarrrrr��sr�c	s���td��W5QRXdSr�r�rr�rrre�szAExceptionalTestCase.testRaisedStopIteration2.<locals>.shouldThrowr�)rIrJr�rgrr�r�testRaisedStopIteration2�sz,ExceptionalTestCase.testRaisedStopIteration2c	s8tdd����fdd�}|�t��|�W5QRXdS)Ncss
dVdSrrrrrrr��sz8ExceptionalTestCase.testRaisedStopIteration3.<locals>.cmc	s"���ttg���W5QRXdSr)�next�iterrr�rrre�szAExceptionalTestCase.testRaisedStopIteration3.<locals>.shouldThrow)rrBr�rgrr�r�testRaisedStopIteration3�s

z,ExceptionalTestCase.testRaisedStopIteration3cs(tdd����fdd�}|�t|�dS)Ncss
dVdSrrrrrrr��sz8ExceptionalTestCase.testRaisedGeneratorExit1.<locals>.cmc	s���td��W5QRXdSr���
GeneratorExitrr�rrre�szAExceptionalTestCase.testRaisedGeneratorExit1.<locals>.shouldThrow)rrBr�rgrr�r�testRaisedGeneratorExit1�s
z,ExceptionalTestCase.testRaisedGeneratorExit1cs,Gdd�dt���fdd�}|�t|�dS)Nc@seZdZdd�Zdd�ZdS)z8ExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cmcSsdSrrrrrrr�szBExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cm.__enter__cSsdSrrrrrrr�szAExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cm.__exit__Nrarrrrr��sr�c	s���td��W5QRXdSr�r�rr�rrreszAExceptionalTestCase.testRaisedGeneratorExit2.<locals>.shouldThrow)rIrBr�rgrr�r�testRaisedGeneratorExit2�sz,ExceptionalTestCase.testRaisedGeneratorExit2cs\Gdd�dt����fdd�}|���fdd�}��t|���fdd�}��t|�dS)	Nc@s$eZdZdd�Zdd�Zdd�ZdS)z0ExceptionalTestCase.testErrorsInBool.<locals>.cmcsG�fdd�d�}|�|_dS)NcseZdZ�fdd�ZdS)zGExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__.<locals>.Boolcs��Srrr��bool_conversionrr�__bool__szPExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__.<locals>.Bool.__bool__N)rrrr�rr�rr�Bool
sr��Zexit_result)r
r�r�rr�rrsz9ExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__cSsdS)N�rrrrrrsz:ExceptionalTestCase.testErrorsInBool.<locals>.cm.__enter__cSs|jSrr�)r
�a�b�crrrrsz9ExceptionalTestCase.testErrorsInBool.<locals>.cm.__exit__Nr;rrrrr�sr�c	s&�dd�����d�W5QRXdS)NcSsdSrrrrrr�<lambda>�zJExceptionalTestCase.testErrorsInBool.<locals>.trueAsBool.<locals>.<lambda>�Should NOT see this��failrr�rr�
trueAsBoolsz8ExceptionalTestCase.testErrorsInBool.<locals>.trueAsBoolc	s&�dd�����d�W5QRXdS)NcSsdSrrrrrrr�r�zKExceptionalTestCase.testErrorsInBool.<locals>.falseAsBool.<locals>.<lambda>zShould raiser�rr�rr�falseAsBoolsz9ExceptionalTestCase.testErrorsInBool.<locals>.falseAsBoolc	s&�dd�����d�W5QRXdS)NcSsddSr�rrrrrr�!r�zJExceptionalTestCase.testErrorsInBool.<locals>.failAsBool.<locals>.<lambda>r�r�rr�rr�
failAsBool sz8ExceptionalTestCase.testErrorsInBool.<locals>.failAsBool)rIrB�AssertionErrorr�)r
r�r�r�rr�r�testErrorsInBoolsz$ExceptionalTestCase.testErrorsInBoolN)rrrr�r�r�r�r�r�r�r�r�r�r�r�rrrrr�cs

r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�NonLocalFlowControlTestCasec	CsLd}|d7}t��|d7}W5QR�q<W5QRX|d7}q|�|d�dS)Nrr7�
�d��r*rf�r
�counterrrr�
testWithBreak(s
z)NonLocalFlowControlTestCase.testWithBreakc	CsVd}|d7}|dkrqFt��|d7}W5QR�qW5QRX|d7}q|�|d�dS)Nrr7r8r�r��r�r�rrr�testWithContinue2s
z,NonLocalFlowControlTestCase.testWithContinuecCsdd�}|�|�d�dS)Nc
Ss@d}|d7}t��|d7}|W5QR�SQRX|d7}qdS)Nrr7r�r�r�)r�rrrr@?sz7NonLocalFlowControlTestCase.testWithReturn.<locals>.foor�)rfr�rrr�testWithReturn>sz*NonLocalFlowControlTestCase.testWithReturncCs&dd�}t|��}|�|ddg�dS)Nc	ss"t��dVdVW5QRXdS)Nr��
r�rrrr�genJsz6NonLocalFlowControlTestCase.testWithYield.<locals>.genr�r�)�listrf)r
r��xrrr�
testWithYieldIs
z)NonLocalFlowControlTestCase.testWithYieldc	Csfd}z2|d7}t��|d7}t�W5QRX|d7}Wn tk
rV|�|d�YnX|�d�dS)Nrr7r�r�r�zDidn't raise RuntimeError)r*r/rfr�r�rrr�
testWithRaiseQsz)NonLocalFlowControlTestCase.testWithRaiseN)rrrr�r�r�r�r�rrrrr�&s

r�c@seZdZdd�Zdd�ZdS)�AssignmentTargetTestCasec	Csddddgi}t��:|dd<|�t|���dg�|�|ddjt�W5QRXt��Bt|���dd<|�t|���dg�|�|ddjt�W5QRXt��.|d<t|���}|��|�|ddg�W5QRXGdd�d�}|�}t��|_|�t	|d�d�W5QRXdS)Nr7rr8c@seZdZdS)z;AssignmentTargetTestCase.testSingleComplexTarget.<locals>.CNrMrrrr�Cmsr�r@T)
r*rfr��keysrr%�values�sortr@�hasattr)r
�targetsr�r��blahrrr�testSingleComplexTargetas  
z0AssignmentTargetTestCase.testSingleComplexTargetc	CsXGdd�d�}ddddgi}|��:\|dd<|dd<|dd<|�|ddddgi�W5QRX|��R\t|���dd<t|���dd<t|���dd<|�|ddddgi�W5QRX|��,\|d<|d<|d<|�|dddd��W5QRXGdd	�d	�}|�}|��<\|_|_|_|�|jd�|�|jd�|�|jd�W5QRXdS)
Nc@seZdZdd�Zdd�ZdS)z>AssignmentTargetTestCase.testMultipleComplexTargets.<locals>.CcSsdS)N�r7r8r�rrrrrrtr�zHAssignmentTargetTestCase.testMultipleComplexTargets.<locals>.C.__enter__cSsdSrr�r
�t�v�tbrrrrur�zGAssignmentTargetTestCase.testMultipleComplexTargets.<locals>.C.__exit__Nrarrrrr�ssr�r7rr8r�r�c@seZdZdS)z>AssignmentTargetTestCase.testMultipleComplexTargets.<locals>.BNrMrrrr�B}sr�)rfr�r�ZoneZtwoZthree)r
r�r�r�r�rrr�testMultipleComplexTargetsrs& > z3AssignmentTargetTestCase.testMultipleComplexTargetsN)rrrr�r�rrrrr�_sr�c@seZdZdd�Zdd�ZdS)�ExitSwallowsExceptionTestCasec	CsPGdd�d�}z|��ddW5QRXWntk
rJ|�d�YnXdS)Nc@seZdZdd�Zdd�ZdS)zSExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallowcSsdSrrrrrrr�r�z]ExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallow.__enter__cSsdSrrr�rrrr�r�z\ExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallow.__exit__Nrarrrr�AfricanSwallow�sr�r7rz,ZeroDivisionError should have been swallowed�r�r�)r
r�rrr�testExitTrueSwallowsException�sz;ExitSwallowsExceptionTestCase.testExitTrueSwallowsExceptionc	CsPGdd�d�}z|��ddW5QRXWntk
r@YnX|�d�dS)Nc@seZdZdd�Zdd�ZdS)zZExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallowcSsdSrrrrrrr�r�zdExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallow.__enter__cSsdSrrr�rrrr�r�zcExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallow.__exit__Nrarrrr�EuropeanSwallow�sr�r7rz)ZeroDivisionError should have been raisedr�)r
r�rrr�#testExitFalseDoesntSwallowException�szAExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowExceptionN)rrrr�r�rrrrr��s
r�c@steZdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�
NestedWithc@s&eZdZd	dd�Zdd�Zdd�ZdS)
zNestedWith.DummyNFcCs(|dkr|}||_||_d|_d|_dSr)r�gobbler	r
)r
rr�rrrr�szNestedWith.Dummy.__init__cCsd|_|jSr)r	rrrrrr�szNestedWith.Dummy.__enter__cGsd|_||_|jrdSdSr)r
r3r�r=rrrr�szNestedWith.Dummy.__exit__)NFr;rrrr�Dummy�s
r�c@seZdZdd�ZdS)zNestedWith.InitRaisescCs
t��dSrr`rrrrr�r�zNestedWith.InitRaises.__init__Nr(rrrr�
InitRaises�sr�c@seZdZdd�Zdd�ZdS)zNestedWith.EnterRaisescCs
t��dSrr`rrrrr�r�z NestedWith.EnterRaises.__enter__cGsdSrrr=rrrr�r�zNestedWith.EnterRaises.__exit__Nrarrrr�EnterRaises�sr�c@seZdZdd�Zdd�ZdS)zNestedWith.ExitRaisescCsdSrrrrrrr�r�zNestedWith.ExitRaises.__enter__cGs
t��dSrr`r=rrrr�r�zNestedWith.ExitRaises.__exit__Nrarrrr�
ExitRaises�sr�c
Cs\|���2}|���}|�|j�|�|j�W5QRXW5QRX|�|j�|�|j�dSr)r�rpr	r
)r
r�r�rrr�testNoExceptions�s
 zNestedWith.testNoExceptionsc
CsVz,|���}|���W5QRXW5QRXWnYnX|�|j�|�|j�dSr)r�r�rpr	r
�r
r�rrr�testExceptionInExprList�sz"NestedWith.testExceptionInExprListc
Csrz6|���$}|���|�d�W5QRXW5QRXWntk
rJYnX|�d�|�|j�|�|j�dS)Nzbody of bad with executedzRuntimeError not reraised)r�r�r�r/rpr	r
r�rrr�testExceptionInEnter�s"
zNestedWith.testExceptionInEnterc
Csld}|jdd��}|���
d}W5QRXW5QRX|�|j�|�|j�|�|�|�|jdd�dS)NFT)r�r)r�r�rpr	r
ZassertNotEqualr3)r
Z
body_executedr�rrr�testExceptionInExit�s
zNestedWith.testExceptionInExitc
Csl|jdd��V\}}|jdd��:\}}|�d|�|�d|�|�d|�|�d|�W5QRXW5QRXdS)N)r7r8)r)r��r7r8r�r)r�rf)r
Za1Za2Zb1Zb2rrr�testEnterReturnsTuple�s
�z NestedWith.testEnterReturnsTupleN)
rrrrIr�r�r�r�r�r�rrrrrrrr��s		r��__main__)�__doc__�
__author__Z	__email__r2Zunittest�collectionsr�
contextlibrrrr$rIr%r*r+r<ZTestCaser>rmrr�r�r�r�r�r�r�mainrrrr�<module>s6
	$S/5�BD9&L


F1le Man4ger