Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_with.cpython-39.opt-1.pyc

a

��g�g�@sLdZdZdZddlZddlZddlmZddlmZm	Z	m
Z
Gdd�de�Zd	d
�ZGdd�de
�Zed
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�rHe��dS)&z7Unit tests for the with statement specified in PEP 343.z
Mike Blandzmbland at acm dot org�N)�deque)�_GeneratorContextManager�contextmanager�nullcontextcs,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__��*/usr/local/lib/python3.9/test/test_with.pyr	szMockContextManager.__init__cCsd|_t�|�S�NT)r
r�	__enter__�rrrrrszMockContextManager.__enter__cCs"d|_|||f|_t�||||�Sr)rrr�__exit__�r�type�value�	tracebackrrrrs
�zMockContextManager.__exit__)�__name__�
__module__�__qualname__r	rr�
__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�rrrr	rrrrr&%sr&ccs*t�}zd|_|VWd|_nd|_0dSr)r&r'r()�mockrrr�mock_contextmanager_generator+s
r+c@s$eZdZdd�Zdd�Zdd�ZdS)�NestedcGs||_d|_dSr )�managers�entered�rr-rrrr	7szNested.__init__cCsj|jdurtd��t�|_g}z*|jD]}|�|���|j�|�q&Wn|jt�	��s`�Yn0|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
0q
d|_||ur`|d|d��|d��dS)N�NNNr��)r.rr3r4�with_traceback)rr4�exr6rrrrIs

zNested.__exit__N�rrrr	rrrrrrr,5sr,c@s$eZdZdd�Zdd�Zdd�ZdS)�
MockNestedcGs(tj|g|�R�d|_d|_d|_dSr)r,r	r
rrr/rrrr	ZszMockNested.__init__cCsd|_t�|�Sr)r
r,rrrrrr`szMockNested.__enter__cGsd|_||_tj|g|�R�Sr)rrr,r�rr4rrrrdszMockNested.__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)NcSs(t�Wd�n1s0YdSr ��foorrrr�fooNotDeclaredlsz5FailureTestCase.testNameError.<locals>.fooNotDeclared)�assertRaises�	NameError)rrBrrr�
testNameErrorkszFailureTestCase.testNameErrorcs.Gdd�dt���fdd�}|�td|�dS)Nc@seZdZdd�ZdS)z<FailureTestCase.testEnterAttributeError1.<locals>.LacksEntercSsdSr rrrrrrrszEFailureTestCase.testEnterAttributeError1.<locals>.LacksEnter.__exit__N)rrrrrrrr�
LacksEnterqsrFcs.��}|�Wd�n1s 0YdSr rr@�rFrr�
fooLacksEnterusz?FailureTestCase.testEnterAttributeError1.<locals>.fooLacksEnterr��object�assertRaisesRegex�AttributeError)rrHrrGr�testEnterAttributeError1psz(FailureTestCase.testEnterAttributeError1cs.Gdd�dt���fdd�}|�td|�dS)Nc@seZdZdS)zCFailureTestCase.testEnterAttributeError2.<locals>.LacksEnterAndExitN�rrrrrrr�LacksEnterAndExit{srOcs.��}|�Wd�n1s 0YdSr rr@�rOrr�fooLacksEnterAndExit~szFFailureTestCase.testEnterAttributeError2.<locals>.fooLacksEnterAndExitrrI)rrQrrPr�testEnterAttributeError2zsz(FailureTestCase.testEnterAttributeError2cs.Gdd�dt���fdd�}|�td|�dS)Nc@seZdZdd�ZdS)z9FailureTestCase.testExitAttributeError.<locals>.LacksExitcSsdSr rrrrrr�szCFailureTestCase.testExitAttributeError.<locals>.LacksExit.__enter__N)rrrrrrrr�	LacksExit�srScs.��}|�Wd�n1s 0YdSr rr@�rSrr�fooLacksExit�sz<FailureTestCase.testExitAttributeError.<locals>.fooLacksExitrrI)rrUrrTr�testExitAttributeError�sz&FailureTestCase.testExitAttributeErrorcCsdd�}|�t||�dS)NcSst|dd�dS)N�Zsingle)�compile)�srrr�shouldRaiseSyntaxError�szGFailureTestCase.assertRaisesSyntaxError.<locals>.shouldRaiseSyntaxError)rC�SyntaxError)rZcodestrrZrrr�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�r0rrrrr�sz>FailureTestCase.testEnterThrows.<locals>.EnterThrows.__enter__cWsdSr rr
rrrr�sz=FailureTestCase.testEnterThrows.<locals>.EnterThrows.__exit__N�rrrrrrrrr�EnterThrows�srccs6��}d�_|��_Wd�n1s(0YdSr r@)�ct�rcrrr�shouldThrow�sz4FailureTestCase.testEnterThrows.<locals>.shouldThrow)rJrCr0�assertEqualrA�rrfrrer�testEnterThrows�szFailureTestCase.testEnterThrowscs,Gdd�dt���fdd�}|�t|�dS)Nc@seZdZdd�Zdd�ZdS)z2FailureTestCase.testExitThrows.<locals>.ExitThrowscSsdSr rrrrrr�sz<FailureTestCase.testExitThrows.<locals>.ExitThrows.__enter__cWstd��dS)N�*rar
rrrr�sz;FailureTestCase.testExitThrows.<locals>.ExitThrows.__exit__Nrbrrrr�
ExitThrows�srkcs*���Wd�n1s0YdSr rr�rkrrrf�sz3FailureTestCase.testExitThrows.<locals>.shouldThrow)rJrCr0rhrrlr�testExitThrows�szFailureTestCase.testExitThrowsN)
rrrrErMrRrVr\r^r_r`rirmrrrrr?js
	
r?c@sVeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dd�ZdS)�ContextmanagerAssertionMixincCstd�|_dS)Nztest exception)r0�TEST_EXCEPTIONrrrr�setUp�sz"ContextmanagerAssertionMixin.setUpcCs*|�|j�|�|j�|�|jd�dSr )�
assertTruer
�assertFalserrgr�r�mock_managerrrr�assertInWithManagerInvariants�sz:ContextmanagerAssertionMixin.assertInWithManagerInvariantscCs*|�|j�|�|j�|�|j|�dSr )rqr
rrgr)rrtrrrr� assertAfterWithManagerInvariants�sz=ContextmanagerAssertionMixin.assertAfterWithManagerInvariantscCs|�|d�dS)Nr7)rvrsrrr�'assertAfterWithManagerInvariantsNoError�s�zDContextmanagerAssertionMixin.assertAfterWithManagerInvariantsNoErrorcCs|�|j�|�|j�dSr )rqr'rrr(�rZmock_generatorrrr�assertInWithGeneratorInvariants�sz<ContextmanagerAssertionMixin.assertInWithGeneratorInvariantscCs|�|j�|�|j�dSr �rqr'r(rxrrr�)assertAfterWithGeneratorInvariantsNoError�szFContextmanagerAssertionMixin.assertAfterWithGeneratorInvariantsNoErrorcCs
|j�dSr )rorrrr�raiseTestException�sz/ContextmanagerAssertionMixin.raiseTestExceptionNcCsx|�|j�|�|j�|dur>|�|jd|j�t|j�}|�|jd|�|�|jd|�|�|jdd�dS)Nr8rr9)	rqr
rrgrrorZassertIsInstanceZassertIsNot)rrt�exc_typerrr�)assertAfterWithManagerInvariantsWithError�s
zFContextmanagerAssertionMixin.assertAfterWithManagerInvariantsWithErrorcCs|�|j�|�|j�dSr rzrxrrr�+assertAfterWithGeneratorInvariantsWithError�szHContextmanagerAssertionMixin.assertAfterWithGeneratorInvariantsWithError)N)rrrrprurvrwryr{r|r~rrrrrrn�s�
rnc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�NonexceptionalTestCasecCs*t��Wd�n1s0YdSr �r+rrrr�testInlineGeneratorSyntax�sz0NonexceptionalTestCase.testInlineGeneratorSyntaxcCs8t�}|�Wd�n1s 0Y|�|�dSr )r+rw)rr*rrr�testUnboundGenerator�sz+NonexceptionalTestCase.testUnboundGeneratorcCs>t��}|�|�Wd�n1s&0Y|�|�dSr �r+ryr{�rrArrr�testInlineGeneratorBoundSyntax�s(z5NonexceptionalTestCase.testInlineGeneratorBoundSyntaxcCsBd}t��}|�|�Wd�n1s*0Y|�|�dSr r�r�rrr�*testInlineGeneratorBoundToExistingVariable�s(zANonexceptionalTestCase.testInlineGeneratorBoundToExistingVariablecCsDt��|_|�|j�Wd�n1s*0Y|�|j�dSr )r+rAryr{rrrr�(testInlineGeneratorBoundToDottedVariables
*z?NonexceptionalTestCase.testInlineGeneratorBoundToDottedVariablecCsVt�}|�$}|�|�|�|�Wd�n1s40Y|�|�|�|�dSr )r+ryrur{rw)rr*rArrr�testBoundGenerators
(
z)NonexceptionalTestCase.testBoundGeneratorc	Cs�t�}|��}t�}|�8}|�|�|�|�|�|�|�|�Wd�n1sT0Y|�|�|�|�|�|�|�|�Wd�n1s�0Y|�|�|�|�dSr )r+ruryrwr{)r�mock_arA�mock_b�barrrr�testNestedSingleStatementss


(


(
z1NonexceptionalTestCase.testNestedSingleStatementsN)
rrrr�r�r�r�r�r�r�rrrrr��sr�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�NestedNonexceptionalTestCasecCs.tt���Wd�n1s 0YdSr �r,r+rrrr�"testSingleArgInlineGeneratorSyntax#sz?NestedNonexceptionalTestCase.testSingleArgInlineGeneratorSyntaxcCsFt�}t|��}|�|�Wd�n1s.0Y|�|�dSr �r+r,rurw�r�mrArrr�testSingleArgBoundToNonTuple's
(z9NestedNonexceptionalTestCase.testSingleArgBoundToNonTuplecCsFt�}t|��}|�|�Wd�n1s.0Y|�|�dSr r�r�rrr�2testSingleArgBoundToSingleElementParenthesizedList/s
(zONestedNonexceptionalTestCase.testSingleArgBoundToSingleElementParenthesizedListcCsdd�}|�t|�dS)NcSs2tt���\}}Wd�n1s$0YdSr r�)rAr�rrr�shouldThrowValueError8sziNestedNonexceptionalTestCase.testSingleArgBoundToMultipleElementTupleError.<locals>.shouldThrowValueError)rC�
ValueError)rr�rrr�-testSingleArgBoundToMultipleElementTupleError7szJNestedNonexceptionalTestCase.testSingleArgBoundToMultipleElementTupleErrorcCs^t�}t|�}|�$|�|�|�|�Wd�n1s<0Y|�|�|�|�dSr �r+r=rurw)rr%�mock_nestedrrr�testSingleArgUnbound=s
(
z1NestedNonexceptionalTestCase.testSingleArgUnboundcCs�t�}t�}t�}t|||�}|�8|�|�|�|�|�|�|�|�Wd�n1s`0Y|�|�|�|�|�|�|�|�dSr r�)rr��n�or�rrr�testMultipleArgUnboundFs


(


z3NestedNonexceptionalTestCase.testMultipleArgUnboundcCs�tt�t�t��}|�>\}}}|�|�|�|�|�|�|�|�Wd�n1sZ0Y|�|�|�|�|�|�|�|�dSr )r=r+ryrur{rw)rr�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)NcsH��0�_�������j����Wd�n1s:0YdSr )�resourceruryr|r��cmrrrrffs
z;ExceptionalTestCase.testSingleResource.<locals>.shouldThrow)r+rCr0r~rr�rhrr�r�testSingleResourceds

z&ExceptionalTestCase.testSingleResourcecs0t����fdd�}��t|����t�dS)Ncs2���_ddWd�n1s$0YdS�Nr8r)r�rr�rrrfqsz@ExceptionalTestCase.testExceptionNormalized.<locals>.shouldThrow)r+rC�ZeroDivisionErrorr~rhrr�r�testExceptionNormalizedosz+ExceptionalTestCase.testExceptionNormalizedcsXt��t�����fdd�}��t|������������j����j�dS)Nc	s���l�_��F�_�����������j����j����Wd�n1sX0YWd�n1sv0YdSr �rAr�ruryr|r�r�r�rrrrf|s

zCExceptionalTestCase.testNestedSingleStatements.<locals>.shouldThrow)r+rCr0r~rrAr�rhrr�rr�ys

z.ExceptionalTestCase.testNestedSingleStatementscsnt��t��t��������fdd�}��t|����������������j����j�dS)Ncsn��V\�_�_���������������j����j����Wd�n1s`0YdSr )�
resource_a�
resource_bruryr|r�Zcm_aZcm_br�rrrrf�s


zOExceptionalTestCase.testMultipleResourcesInSingleStatement.<locals>.shouldThrow)r+r=rCr0r~rr�r�rhrr�r�&testMultipleResourcesInSingleStatement�s



z:ExceptionalTestCase.testMultipleResourcesInSingleStatementcs|t��t��d�_���fdd�}��t|��������j����jd����j	����j
����jd�dS)Nc	sn��V�_�������j�������_Wd�n1sB0YWd�n1s`0YdSr )rAruryr|r�rr�rrrf�s
zPExceptionalTestCase.testNestedExceptionBeforeInnerStatement.<locals>.shouldThrow)r+r�rCr0r~rrArgrrr
rrrhrr�r�'testNestedExceptionBeforeInnerStatement�s
z;ExceptionalTestCase.testNestedExceptionBeforeInnerStatementcsXt��t�����fdd�}��t|������������j����j�dS)Nc	s���l�_��>�_�����������j����j�Wd�n1sP0Y���Wd�n1sv0YdSr r�rr�rrrf�s

*zOExceptionalTestCase.testNestedExceptionAfterInnerStatement.<locals>.shouldThrow)	r+rCr0r~rwrrAr{r�rhrr�r�&testNestedExceptionAfterInnerStatement�s

z:ExceptionalTestCase.testNestedExceptionAfterInnerStatementcsNtdd����fdd�}|�td��|�Wd�n1s@0YdS)Ncss
dVdSr rrrrrr��sz8ExceptionalTestCase.testRaisedStopIteration1.<locals>.cmcs2���td��Wd�n1s$0YdS�N�	from with��
StopIterationr�r�rrrf�szAExceptionalTestCase.testRaisedStopIteration1.<locals>.shouldThrowr�)rrKr�rhrr�r�testRaisedStopIteration1�s

z,ExceptionalTestCase.testRaisedStopIteration1csRGdd�dt���fdd�}|�td��|�Wd�n1sD0YdS)Nc@seZdZdd�Zdd�ZdS)z8ExceptionalTestCase.testRaisedStopIteration2.<locals>.cmcSsdSr rrrrrr�szBExceptionalTestCase.testRaisedStopIteration2.<locals>.cm.__enter__cSsdSr rrrrrr�szAExceptionalTestCase.testRaisedStopIteration2.<locals>.cm.__exit__Nrbrrrrr��sr�cs2���td��Wd�n1s$0YdSr�r�rr�rrrf�szAExceptionalTestCase.testRaisedStopIteration2.<locals>.shouldThrowr�)rJrKr�rhrr�r�testRaisedStopIteration2�sz,ExceptionalTestCase.testRaisedStopIteration2csLtdd����fdd�}|�t��|�Wd�n1s>0YdS)Ncss
dVdSr rrrrrr��sz8ExceptionalTestCase.testRaisedStopIteration3.<locals>.cmcs6���ttg���Wd�n1s(0YdSr )�next�iterrr�rrrf�szAExceptionalTestCase.testRaisedStopIteration3.<locals>.shouldThrow)rrCr�rhrr�r�testRaisedStopIteration3�s

z,ExceptionalTestCase.testRaisedStopIteration3cs(tdd����fdd�}|�t|�dS)Ncss
dVdSr rrrrrr��sz8ExceptionalTestCase.testRaisedGeneratorExit1.<locals>.cmcs2���td��Wd�n1s$0YdSr���
GeneratorExitrr�rrrf�szAExceptionalTestCase.testRaisedGeneratorExit1.<locals>.shouldThrow)rrCr�rhrr�r�testRaisedGeneratorExit1�s
z,ExceptionalTestCase.testRaisedGeneratorExit1cs,Gdd�dt���fdd�}|�t|�dS)Nc@seZdZdd�Zdd�ZdS)z8ExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cmcSsdSr rrrrrr�szBExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cm.__enter__cSsdSr rrrrrr�szAExceptionalTestCase.testRaisedGeneratorExit2.<locals>.cm.__exit__Nrbrrrrr��sr�cs2���td��Wd�n1s$0YdSr�r�rr�rrrfszAExceptionalTestCase.testRaisedGeneratorExit2.<locals>.shouldThrow)rJrCr�rhrr�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��Sr rr��bool_conversionrr�__bool__szPExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__.<locals>.Bool.__bool__N)rrrr�rr�rr�Bool
sr��Zexit_result)rr�r�rr�rr	sz9ExceptionalTestCase.testErrorsInBool.<locals>.cm.__init__cSsdS)N�rrrrrrsz:ExceptionalTestCase.testErrorsInBool.<locals>.cm.__enter__cSs|jSr r��r�a�b�crrrrsz9ExceptionalTestCase.testErrorsInBool.<locals>.cm.__exit__Nr<rrrrr�sr�cs:�dd�����d�Wd�n1s,0YdS)NcSsdSrrrrrr�<lambda>�zJExceptionalTestCase.testErrorsInBool.<locals>.trueAsBool.<locals>.<lambda>�Should NOT see this��failrr�rr�
trueAsBoolsz8ExceptionalTestCase.testErrorsInBool.<locals>.trueAsBoolcs:�dd�����d�Wd�n1s,0YdS)NcSsdSrrrrrrr�r�zKExceptionalTestCase.testErrorsInBool.<locals>.falseAsBool.<locals>.<lambda>zShould raiser�rr�rr�falseAsBoolsz9ExceptionalTestCase.testErrorsInBool.<locals>.falseAsBoolcs:�dd�����d�Wd�n1s,0YdS)NcSsddSr�rrrrrr�!r�zJExceptionalTestCase.testErrorsInBool.<locals>.failAsBool.<locals>.<lambda>r�r�rr�rr�
failAsBool sz8ExceptionalTestCase.testErrorsInBool.<locals>.failAsBool)rJrC�AssertionErrorr�)rr�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)�NonLocalFlowControlTestCasecCsbd}|d7}t��&|d7}Wd�qRWd�n1s>0Y|d7}q|�|d�dS)Nrr8�
�d��r+rg�r�counterrrr�
testWithBreak(s,
z)NonLocalFlowControlTestCase.testWithBreakcCsld}|d7}|dkrq\t��&|d7}Wd�qWd�n1sH0Y|d7}q|�|d�dS)Nrr8r9r�r��r�r�rrr�testWithContinue2s,
z,NonLocalFlowControlTestCase.testWithContinuecCsdd�}|�|�d�dS)NcSsLd}|d7}t��|d7}|Wd�S1s40Y|d7}qdS)Nrr8r�r�r�)r�rrrrA?s"z7NonLocalFlowControlTestCase.testWithReturn.<locals>.foor�)rgr�rrr�testWithReturn>sz*NonLocalFlowControlTestCase.testWithReturncCs&dd�}t|��}|�|ddg�dS)Ncss6t��dVdVWd�n1s(0YdS)Nr��
r�rrrr�genJsz6NonLocalFlowControlTestCase.testWithYield.<locals>.genr�r�)�listrg)rr��xrrr�
testWithYieldIs
z)NonLocalFlowControlTestCase.testWithYieldcCsxd}zF|d7}t��|d7}t�Wd�n1s60Y|d7}Wntyh|�|d�Yn0|�d�dS)Nrr8r�r�r�zDidn't raise RuntimeError)r+r0rgr�r�rrr�
testWithRaiseQs"z)NonLocalFlowControlTestCase.testWithRaiseN)rrrr�r�r�r�r�rrrrr�&s

r�c@s$eZdZdd�Zdd�Zdd�ZdS)�AssignmentTargetTestCasecCsldgd�i}t��D|dd<|�t|���dg�|�|ddjt�Wd�n1s\0Yt��Lt|���dd<|�t|���dg�|�|ddjt�Wd�n1s�0Yt��8|d<t|���}|��|�|ddg�Wd�n1�s0YGdd�d�}|�}t��$|_|�t	|d�d�Wd�n1�s^0YdS)	Nr8�rr8r9rr9c@seZdZdS)z;AssignmentTargetTestCase.testSingleComplexTarget.<locals>.CNrNrrrr�Cmr�r�rAT)
r+rgr��keysrr&�values�sortrA�hasattr)r�targetsr�r��blahrrr�testSingleComplexTargetas440
z0AssignmentTargetTestCase.testSingleComplexTargetcCs�Gdd�d�}dgd�i}|��B\|dd<|dd<|dd<|�|dgd�i�Wd�n1sh0Y|��Z\t|���dd<t|���dd<t|���dd<|�|dgd�i�Wd�n1s�0Y|��6\|d<|d<|d	<|�|ddd	d��Wd�n1�s&0YGd
d�d�}|�}|��F\|_|_|_|�|jd�|�|jd�|�|jd	�Wd�n1�s�0YdS)Nc@seZdZdd�Zdd�ZdS)z>AssignmentTargetTestCase.testMultipleComplexTargets.<locals>.CcSsdS)N�r8r9r�rrrrrrtr�zHAssignmentTargetTestCase.testMultipleComplexTargets.<locals>.C.__enter__cSsdSr r�r�t�v�tbrrrrur�zGAssignmentTargetTestCase.testMultipleComplexTargets.<locals>.C.__exit__Nrbrrrrr�ssr�r8r�rr9r�)r�r9r8r�c@seZdZdS)z>AssignmentTargetTestCase.testMultipleComplexTargets.<locals>.BNrNrrrr�B}r�r�)rgr�r�ZoneZtwoZthree)rr�r�r�r�rrr�testMultipleComplexTargetsrs&2>24z3AssignmentTargetTestCase.testMultipleComplexTargetscCsbttdd���@�^}}}|�|d�|�|ddg�|�|d�Wd�n1sT0YdS)Nr8�r9r��)r�rangergr�rrr�testWithExtendedTargets�sz0AssignmentTargetTestCase.testWithExtendedTargetsN)rrrr�r�r�rrrrr�_sr�c@seZdZdd�Zdd�ZdS)�ExitSwallowsExceptionTestCasecCsbGdd�d�}z2|��ddWd�n1s40YWnty\|�d�Yn0dS)Nc@seZdZdd�Zdd�ZdS)zSExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallowcSsdSr rrrrrr�r�z]ExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallow.__enter__cSsdSrrr�rrrr�r�z\ExitSwallowsExceptionTestCase.testExitTrueSwallowsException.<locals>.AfricanSwallow.__exit__Nrbrrrr�AfricanSwallow�sr�r8rz,ZeroDivisionError should have been swallowed�r�r�)rr�rrr�testExitTrueSwallowsException�s*z;ExitSwallowsExceptionTestCase.testExitTrueSwallowsExceptioncCsbGdd�d�}z2|��ddWd�n1s40YWntyRYn0|�d�dS)Nc@seZdZdd�Zdd�ZdS)zZExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallowcSsdSr rrrrrr�r�zdExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallow.__enter__cSsdSrrr�rrrr�r�zcExitSwallowsExceptionTestCase.testExitFalseDoesntSwallowException.<locals>.EuropeanSwallow.__exit__Nrbrrrr�EuropeanSwallow�sr�r8rz)ZeroDivisionError should have been raisedr�)rr�rrr�#testExitFalseDoesntSwallowException�s*zAExitSwallowsExceptionTestCase.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(|dur|}||_||_d|_d|_dSr)r�gobbler
r)rrr�rrrr	�szNestedWith.Dummy.__init__cCsd|_|jSr)r
rrrrrr�szNestedWith.Dummy.__enter__cGsd|_||_|jrdSdSr)rr4r�r>rrrr�szNestedWith.Dummy.__exit__)NFr<rrrr�Dummy�s
rc@seZdZdd�ZdS)zNestedWith.InitRaisescCs
t��dSr rarrrrr	�r�zNestedWith.InitRaises.__init__Nr)rrrr�
InitRaises�src@seZdZdd�Zdd�ZdS)zNestedWith.EnterRaisescCs
t��dSr rarrrrr�r�z NestedWith.EnterRaises.__enter__cGsdSr rr>rrrr�r�zNestedWith.EnterRaises.__exit__Nrbrrrr�EnterRaises�src@seZdZdd�Zdd�ZdS)zNestedWith.ExitRaisescCsdSr rrrrrr�r�zNestedWith.ExitRaises.__enter__cGs
t��dSr rar>rrrr�r�zNestedWith.ExitRaises.__exit__Nrbrrrr�
ExitRaises�src	Cs�|���P}|���(}|�|j�|�|j�Wd�n1s@0YWd�n1s^0Y|�|j�|�|j�dSr )rrqr
r)rr�r�rrr�testNoExceptions�s
HzNestedWith.testNoExceptionsc	Cs~zT|���8}|���Wd�n1s*0YWd�n1sH0YWnYn0|�|j�|�|j�dSr )rrrqr
r�rr�rrr�testExceptionInExprList�s@z"NestedWith.testExceptionInExprListc	Cs�z^|���B}|���|�d�Wd�n1s40YWd�n1sR0YWntypYn0|�d�|�|j�|�|j�dS)Nzbody of bad with executedzRuntimeError not reraised)rrr�r0rqr
rrrrr�testExceptionInEnter�sJ
zNestedWith.testExceptionInEnterc	Cs�d}|jdd��<}|���d}Wd�n1s40YWd�n1sR0Y|�|j�|�|j�|�|�|�|jdd�dS)NFT)r�r)rrrqr
rZassertNotEqualr4)rZ
body_executedr�rrr�testExceptionInExit�s@
zNestedWith.testExceptionInExitc	Cs�|jdd��t\}}|jdd��D\}}|�d|�|�d|�|�d|�|�d|�Wd�n1sh0YWd�n1s�0YdS)N)r8r9)r)r��r8r9r�r	)rrg)rZa1Za2�b1�b2rrr�testEnterReturnsTuple�s
�z NestedWith.testEnterReturnsTupleN)
rrrrJrrrrrrrrrrrrrr��s		r��__main__)�__doc__�
__author__Z	__email__r3Zunittest�collectionsr�
contextlibrrrrr%rJr&r+r,r=ZTestCaser?rnr�r�r�r�r�r�r�r�mainrrrr�<module>s6
	$S/5�BD9,L


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