%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/test_util.cpython-312.pyc

�

Ϫ�f�V���dZddlmZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZmZmZmZm Z Gd�de�Z!Gd�de�Z"Gd�d�Z#Gd�d�Z$Gd�de�Z%Gd�de�Z&Gd�de�Z'Gd�de�Z(Gd�d e�Z)Gd!�d"e�Z*y)#z!
Tests for L{twisted.trial.util}
�)�annotationsN)�StringIO)�	Generator)�implementer)�assert_that�equal_to)�DelayedCall)�IProcessTransport)�filepath)�Failure)�util)�SynchronousTestCase)�DirtyReactorAggregateError�_Janitor�acquireAttribute�excInfoOrFailureToExcInfo�openTestLogc�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)�MktempTestszm
    Tests for L{TestCase.mktemp}, a helper function for creating temporary file
    or directory names.
    c���|j�}tjj|�j	tj
�dd}|j
|gd��y)z�
        The path name returned by C{mktemp} is directly beneath a directory
        which identifies the test method which created the name.
        N���)ztwisted.trial.test.test_utilr�	test_name)�mktemp�os�path�dirname�split�sep�assertEqual)�self�name�dirss   �>/usr/lib/python3/dist-packages/twisted/trial/test/test_util.pyrzMktempTests.test_name)sK��
�{�{�}���w�w���t�$�*�*�2�6�6�2�3�B�7������N�	
�c�d�|j�}|j||j��y)zF
        Repeated calls to C{mktemp} return different values.
        N)r�assertNotEqual)r r!s  r#�test_uniquezMktempTests.test_unique4s%���{�{�}�����D�$�+�+�-�0r$c��|j�}tjj|�}|j	tjj|��|j
tjj|��y)zS
        The directory part of the path name returned by C{mktemp} exists.
        N)rrrr�
assertTrue�exists�assertFalse)r r!rs   r#�test_createdzMktempTests.test_created;sU���{�{�}���'�'�/�/�$�'����������w�/�0����������-�.r$c���tjj|j��}|j	|jtj���y)zZ
        The path returned by C{mktemp} is beneath the current working directory.
        N)rr�abspathrr)�
startswith�getcwd)r rs  r#�
test_locationzMktempTests.test_locationDs7���w�w���t�{�{�}�-���������	�	��4�5r$N��return�None)�__name__�
__module__�__qualname__�__doc__rr'r,r1�r$r#rr#s���
	
�1�/�6r$rc�(�eZdZdZdd�Zdd�Zdd�Zy)�DirtyReactorAggregateErrorTestsz6
    Tests for the L{DirtyReactorAggregateError}.
    c�T�tddg�}|jt|�d�y)z5
        Delayed calls are formatted nicely.
        �Foo�barzhReactor was unclean.
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
Foo
barN�rr�str�r �errors  r#�test_formatDelayedCallz6DirtyReactorAggregateErrorTests.test_formatDelayedCallQs,��+�E�5�>�:�������J�
�	
r$c�V�tgddg�}|jt|�d�y)z3
        Selectables are formatted nicely.
        zselectable 1zselectable 2z;Reactor was unclean.
Selectables:
selectable 1
selectable 2Nr?rAs  r#�test_formatSelectablesz6DirtyReactorAggregateErrorTests.test_formatSelectables_s/��+�2���/O�P�������J�
�	
r$c�Z�tddgddg�}|jt|�d�y)zR
        Both delayed calls and selectables can appear in the same error.
        �bleck�Boozo�Sel1�Sel2z�Reactor was unclean.
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
bleck
Boozo
Selectables:
Sel1
Sel2Nr?rAs  r#�%test_formatDelayedCallsAndSelectableszEDirtyReactorAggregateErrorTests.test_formatDelayedCallsAndSelectablesms4��+�G�W�+=���?O�P�������J�
�
	
r$Nr2)r5r6r7r8rCrErKr9r$r#r;r;Ls���
�
�
r$r;c�@�eZdZdZ	d					dd�Zdd	d�Zd
d�Zdd�Zy)�StubReactora~
    A reactor stub which contains enough functionality to be used with the
    L{_Janitor}.

    @ivar iterations: A list of the arguments passed to L{iterate}.
    @ivar removeAllCalled: Number of times that L{removeAll} was called.
    @ivar selectables: The value that will be returned from L{removeAll}.
    @ivar delayedCalls: The value to return from L{getDelayedCalls}.
    Nc�D�||_g|_d|_|sg}||_y)z�
        @param delayedCalls: See L{StubReactor.delayedCalls}.
        @param selectables: See L{StubReactor.selectables}.
        rN)�delayedCalls�
iterations�removeAllCalled�selectables)r rOrRs   r#�__init__zStubReactor.__init__�s+��)���.0��� �����K�&��r$c�:�|jj|�y)z/
        Increment C{self.iterations}.
        N)rP�append)r �timeouts  r#�iteratezStubReactor.iterate�s��	
�����w�'r$c��|jS)z.
        Return C{self.delayedCalls}.
        )rO�r s r#�getDelayedCallszStubReactor.getDelayedCalls�s��� � � r$c�D�|xjdz
c_|jS)zS
        Increment C{self.removeAllCalled} and return C{self.selectables}.
        �)rQrRrYs r#�	removeAllzStubReactor.removeAll�s!��	
����!�����r$�N)rO�list[DelayedCall]rRzlist[object] | Noner3r4)rVzfloat | Noner3r4)r3r_)r3zlist[object])r5r6r7r8rSrWrZr]r9r$r#rMrMs:���SW�'�-�'�<O�'�	
�'�(�!� r$rMc� �eZdZdZdd�Zdd�Zy)�StubErrorReporterz�
    A subset of L{twisted.trial.itrial.IReporter} which records L{addError}
    calls.

    @ivar errors: List of two-tuples of (test, error) which were passed to
        L{addError}.
    c��g|_yr^)�errorsrYs r#rSzStubErrorReporter.__init__�s	��46��r$c�>�|jj||f�y)z6
        Record parameters in C{self.errors}.
        N)rcrU)r �testrBs   r#�addErrorzStubErrorReporter.addError�s��	
�����D�%�=�)r$Nr2)re�objectrBrr3r4)r5r6r7r8rSrfr9r$r#rara�s���7�*r$rac�h�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
dd�Zy
)�JanitorTestsz 
    Tests for L{_Janitor}!
    c��tg�}tdd|��}|j�|j|jddg�y)a
        During pending-call cleanup, the reactor will be spun twice with an
        instant timeout. This is not a requirement, it is only a test for
        current behavior. Hopefully Trial will eventually not do this kind of
        reactor stuff.
        N��reactorr)rMr�
_cleanPendingrrP�r rl�jans   r#�test_cleanPendingSpinsReactorz*JanitorTests.test_cleanPendingSpinsReactor�sA���b�/���t�T�7�3����������+�+�a��V�4r$c��dd�}g}td|di|jd��}t|g�}tdd|��}|j	�|j||g�y)zW
        During pending-call cleanup, the janitor cancels pending timed calls.
        c��y)N�Lulzr9r9r$r#�funcz8JanitorTests.test_cleanPendingCancelsCalls.<locals>.func�s��r$�,r9c��yr^r9��xs r#�<lambda>z<JanitorTests.test_cleanPendingCancelsCalls.<locals>.<lambda>���r$Nrk�r3r@)r	rUrMrrmr)r rt�	cancelled�delayedCallrlros      r#�test_cleanPendingCancelsCallsz*JanitorTests.test_cleanPendingCancelsCalls�s`��
	�(*�	�!�#�t�R��Y�5E�5E�~�V���{�m�,���t�T�7�3����������[�M�2r$c	��tdd�did�d�d���}t|�}t|g�}tdd|��}|j	�}|j||g�y)	aK
        The Janitor produces string representations of delayed calls from the
        delayed call cleanup method. It gets the string representations
        *before* cancelling the calls; this is important because cancelling the
        call removes critical debugging information from the string
        representation.
        ruc��yr^r9r9r$r#ryzIJanitorTests.test_cleanPendingReturnsDelayedCallStrings.<locals>.<lambda>�rzr$r9c��yr^r9rws r#ryzIJanitorTests.test_cleanPendingReturnsDelayedCallStrings.<locals>.<lambda>�rzr$c��y�Nrr9r9r$r#ryzIJanitorTests.test_cleanPendingReturnsDelayedCallStrings.<locals>.<lambda>�rzr$��secondsNrk)r	r@rMrrmr)r r}�delayedCallStringrlro�stringss      r#�*test_cleanPendingReturnsDelayedCallStringsz7JanitorTests.test_cleanPendingReturnsDelayedCallStrings�sf��"���r�2�~�~�y�
�� ��,���{�m�,���t�T�7�3���#�#�%������#4�"5�6r$c��tg�}tdd|��}|j�|j|jd�y)zM
        The Janitor will remove selectables during reactor cleanup.
        Nrkr\)rMr�
_cleanReactorrrQrns   r#�#test_cleanReactorRemovesSelectablesz0JanitorTests.test_cleanReactorRemovesSelectables�s=���b�/���t�T�7�3����������0�0�!�4r$c���tt�Gd�d��}|�}tg|g�}tdd|��}|j	�|j|jdg�y)zI
        The Janitor will kill processes during reactor cleanup.
        c� �eZdZdZdd�Zdd�Zy)�JJanitorTests.test_cleanReactorKillsProcesses.<locals>.StubProcessTransportz�
            A stub L{IProcessTransport} provider which records signals.
            @ivar signals: The signals passed to L{signalProcess}.
            c��g|_yr^)�signalsrYs r#rSzSJanitorTests.test_cleanReactorKillsProcesses.<locals>.StubProcessTransport.__init__s	��02��r$c�:�|jj|�y)zF
                Append C{signal} to C{self.signals}.
                N)r�rU)r �signals  r#�
signalProcesszXJanitorTests.test_cleanReactorKillsProcesses.<locals>.StubProcessTransport.signalProcesss�����#�#�F�+r$Nr2)r�z	str | intr3r4)r5r6r7r8rSr�r9r$r#�StubProcessTransportr��s��
�

3�
,r$r�Nrk�KILL)rr
rMrr�rr�)r r��ptrlros     r#�test_cleanReactorKillsProcessesz,JanitorTests.test_cleanReactorKillsProcesses�si��

�&�	'�
	,�
	,�
(�
	,�"�
#���b�2�$�'���t�T�7�3������������f�X�.r$c��Gd�d�}tg|�g�}tdd|��}|j|j�dg�y)z�
        The Janitor returns string representations of the selectables that it
        cleaned up from the reactor cleanup method.
        c��eZdZdZdd�Zy)�JJanitorTests.test_cleanReactorReturnsSelectableStrings.<locals>.Selectablezl
            A stub Selectable which only has an interesting string
            representation.
            c��y)N�
(SELECTABLE!)r9rYs r#�__repr__zSJanitorTests.test_cleanReactorReturnsSelectableStrings.<locals>.Selectable.__repr__ s��&r$Nr{)r5r6r7r8r�r9r$r#�
Selectabler�s��
�

'r$r�Nrkr�)rMrrr�)r r�rlros    r#�)test_cleanReactorReturnsSelectableStringsz6JanitorTests.test_cleanReactorReturnsSelectableStringssH��	'�	'��b�:�<�.�1���t�T�7�3������*�*�,��.?�@r$c���tg�}t�}t�}t|||��}|j	|j��|j
|jg�y)z�
        The post-case cleanup method will return True and not call C{addError}
        on the result if there are no pending calls.
        rkN)rMrgrarr)�postCaseCleanuprrc�r rlre�reporterros     r#�test_postCaseCleanupNoErrorsz)JanitorTests.test_postCaseCleanupNoErrors'sS��
�b�/���x��$�&���t�X�w�7������+�+�-�.�������"�-r$c	��tdd�did�d�d���}t|�}t|gg�}t�}t	�}t|||��}|j
|j��|jt|j�d�|j|jd	djj|g�y
)z�
        The post-case cleanup method will return False and call C{addError} on
        the result with a L{DirtyReactorAggregateError} Failure if there are
        pending calls.
        ruc��yr^r9r9r$r#ryz=JanitorTests.test_postCaseCleanupWithErrors.<locals>.<lambda>:rzr$r9c��yr^r9rws r#ryz=JanitorTests.test_postCaseCleanupWithErrors.<locals>.<lambda>:rzr$c��yr�r9r9r$r#ryz=JanitorTests.test_postCaseCleanupWithErrors.<locals>.<lambda>:rzr$r�rkr\rN)
r	r@rMrgrarr+r�r�lenrc�valuerO�r r}r�rlrer�ros       r#�test_postCaseCleanupWithErrorsz+JanitorTests.test_postCaseCleanupWithErrors3s���"���r�2�~�~�y�
�� ��,���{�m�R�0���x��$�&���t�X�w�7������,�,�.�/�����X�_�_�-�q�1��������+�A�.�4�4�A�A�DU�CV�Wr$c��tg�}t�}t�}t|||��}|j	�|j|jg�y)z�
        The post-class cleanup method will not call C{addError} on the result
        if there are no pending calls or selectables.
        rkN)rMrgrar�postClassCleanuprrcr�s     r#�test_postClassCleanupNoErrorsz*JanitorTests.test_postClassCleanupNoErrorsEsJ��
�b�/���x��$�&���t�X�w�7������������"�-r$c	�|�tdd�did�d�d���}t|�}t|gg�}t�}t	�}t|||��}|j
�|jt|j�d�|j|jd	djj|g�y
)z�
        The post-class cleanup method call C{addError} on the result with a
        L{DirtyReactorAggregateError} Failure if there are pending calls.
        ruc��yr^r9r9r$r#ryzIJanitorTests.test_postClassCleanupWithPendingCallErrors.<locals>.<lambda>Wrzr$r9c��yr^r9rws r#ryzIJanitorTests.test_postClassCleanupWithPendingCallErrors.<locals>.<lambda>Wrzr$c��yr�r9r9r$r#ryzIJanitorTests.test_postClassCleanupWithPendingCallErrors.<locals>.<lambda>Wrzr$r�rkr\rN)r	r@rMrgrarr�rr�rcr�rOr�s       r#�*test_postClassCleanupWithPendingCallErrorsz7JanitorTests.test_postClassCleanupWithPendingCallErrorsQs���
"���r�2�~�~�y�
�� ��,���{�m�R�0���x��$�&���t�X�w�7����������X�_�_�-�q�1��������+�A�.�4�4�A�A�DU�CV�Wr$c�P�d}tg|g�}t�}t�}t|||��}|j	�|jt
|j�d�|j|jddjjt|�g�y)z�
        The post-class cleanup method call C{addError} on the result with a
        L{DirtyReactorAggregateError} Failure if there are selectables.
        zSELECTABLE HERErkr\rN)rMrgrarr�rr�rcr�rR�repr)r �
selectablerlrer�ros      r#�)test_postClassCleanupWithSelectableErrorsz6JanitorTests.test_postClassCleanupWithSelectableErrorsbs���
'�
��b�:�,�/���x��$�&���t�X�w�7����������X�_�_�-�q�1��������+�A�.�4�4�@�@�4�
�CS�BT�Ur$Nr2)r5r6r7r8rpr~r�r�r�r�r�r�r�r�r�r9r$r#riri�sB���
5�
3�7�"5�/�6A�&
.�X�$
.�X�"Vr$ric�(�eZdZdZdd�Zdd�Zdd�Zy)�RemoveSafelyTestsz*
    Tests for L{util._removeSafely}.
    c���|j�jd�}tj|�t	j
|�}|j
tjtj|�y)z�
        If a path doesn't contain a node named C{"_trial_marker"}, that path is
        not removed by L{util._removeSafely} and a L{util._NoTrialMarker}
        exception is raised instead.
        �utf-8N)
r�encoder�mkdirr�FilePath�assertRaisesr
�_NoTrialMarker�
_removeSafely)r �	directory�dirPaths   r#�test_removeSafelyNoTrialMarkerz0RemoveSafelyTests.test_removeSafelyNoTrialMarkervsT���K�K�M�(�(��1�	�
������#�#�I�.�����$�-�-�t�/A�/A�7�Kr$c��dd�}t�}|jtd|�|j�j	d�}tj|�tj|�}|jd�j�||_tj|�|jd|j��y)z�
        If an L{OSError} is raised while removing a path in
        L{util._removeSafely}, an attempt is made to move the path to a new
        name.
        c��t��)��
            Raise an C{OSError} to emulate the branch of L{util._removeSafely}
            in which path removal fails.
            ��OSErrorr9r$r#�dummyRemovezORemoveSafelyTests.test_removeSafelyRemoveFailsMoveSucceeds.<locals>.dummyRemove�s��
�)�Or$�stdoutr��
_trial_marker�could not remove FilePathNr2)r�patch�sysrr�rr�rr��child�touch�remover
r��assertIn�getvalue)r r��outr�r�s     r#�(test_removeSafelyRemoveFailsMoveSucceedsz:RemoveSafelyTests.test_removeSafelyRemoveFailsMoveSucceeds�s���	��j���
�
�3��#�&��K�K�M�(�(��1�	�
������#�#�I�.���
�
�&�'�-�-�/�$������7�#��
�
�1�3�<�<�>�Br$c��d	d�}d
dd�}t�}|jtd|�|j�j	d�}tj|�tj|�}|jd�j�||_||_|jttj |�}|j#t%|�d�|j'd|j)��y)z�
        If an L{OSError} is raised while removing a path in
        L{util._removeSafely}, an attempt is made to move the path to a new
        name. If that attempt fails, the L{OSError} is re-raised.
        c��td��)r�zpath removal failedr�r9r$r#r�zLRemoveSafelyTests.test_removeSafelyRemoveFailsMoveFails.<locals>.dummyRemove�s��
�/�0�0r$c��td��)z�
            Raise an C{OSError} to emulate the branch of L{util._removeSafely}
            in which path movement fails.
            �path movement failedr�)�destination�followLinkss  r#�dummyMoveTozLRemoveSafelyTests.test_removeSafelyRemoveFailsMoveFails.<locals>.dummyMoveTo�s��
�0�1�1r$r�r�r�r�r�Nr2)T)r�rgr��boolr3r4)rr�r�rr�rr�rr�r�r�r��moveTor�r�r
r�rr@r�r�)r r�r�r�r�r�rBs       r#�%test_removeSafelyRemoveFailsMoveFailsz7RemoveSafelyTests.test_removeSafelyRemoveFailsMoveFails�s���	1�	2��j���
�
�3��#�&��K�K�M�(�(��1�	�
������#�#�I�.���
�
�&�'�-�-�/�%���$����!�!�'�4�+=�+=�w�G������U��%;�<��
�
�1�3�<�<�>�Br$Nr2)r5r6r7r8r�r�r�r9r$r#r�r�qs���	L�C�:%Cr$r�c� �eZdZdZdd�Zdd�Zy)�ExcInfoTestsz1
    Tests for L{excInfoOrFailureToExcInfo}.
    c�`�ttd�df}|j|t|�u�y)z�
        L{excInfoOrFailureToExcInfo} returns exactly what it is passed, if it is
        passed a tuple like the one returned by L{sys.exc_info}.
        �fooN)�
ValueErrorr)r)r �infos  r#�test_excInfozExcInfoTests.test_excInfo�s,��
�J�u�-�t�4������ 9�$� ?�?�@r$c��	ddz|jj|j|j
ft
|��y#t$r
t�}Y�RwxYw)z�
        When called with a L{Failure} instance, L{excInfoOrFailureToExcInfo}
        returns a tuple like the one returned by L{sys.exc_info}, with the
        elements taken from the type, value, and traceback of the failure.
        r\rN)�
BaseExceptionrr�typer��tbr)r �fs  r#�test_failurezExcInfoTests.test_failure�sQ��	�
��E�	
���!�&�&�!�'�'�1�4�4�0�2K�A�2N�O���	��	�A�	�s�A�A�ANr2)r5r6r7r8r�r�r9r$r#r�r��s���A�
Pr$r�c�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)�AcquireAttributeTestsz(
    Tests for L{acquireAttribute}.
    c�t�t�x|_}|j|t|t�gd�u�y)z�
        The value returned by L{acquireAttribute} is the value of the requested
        attribute on the first object in the list passed in which has that
        attribute.
        r�N�rgr�r)r�r r�s  r#�test_foundOnEarlierObjectz/AcquireAttributeTests.test_foundOnEarlierObject�s2��$�X�%��
�U�����!1�4���2B�G�!L�L�Mr$c�t�t�x|_}|j|tt�|gd�u�y)z�
        The same as L{test_foundOnEarlierObject}, but for the case where the 2nd
        element in the object list has the attribute and the first does not.
        r�Nr�r�s  r#�test_foundOnLaterObjectz-AcquireAttributeTests.test_foundOnLaterObject�s2��
$�X�%��
�U�����!1�6�8�T�2B�G�!L�L�Mr$c�N�|jttt�gd�y)z�
        If none of the objects passed in the list to L{acquireAttribute} have
        the requested attribute, L{AttributeError} is raised.
        r�N)r��AttributeErrorrrgrYs r#�test_notFoundExceptionz,AcquireAttributeTests.test_notFoundException�s��
	
���.�*:�V�X�J��Nr$c�f�t�}|j|tt�gd|�u�y)z�
        If none of the objects passed in the list to L{acquireAttribute} have
        the requested attribute and a default value is given, the default value
        is returned.
        r�N)rgr)r)r �defaults  r#�test_notFoundDefaultz*AcquireAttributeTests.test_notFoundDefault�s*���(������#3�V�X�J��w�#O�O�Pr$Nr2)r5r6r7r8r�r�r�r�r9r$r#r�r��s���N�N�O�Qr$r�c�X�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zy)
�ListToPhraseTestsz�
    Input is transformed into a string representation of the list,
    with each item separated by delimiter (defaulting to a comma) and the final
    two being separated by a final delimiter.
    c�\�g}d}tj|d�}|j||�y)zB
        If things is empty, an empty string is returned.
        ��andN�r
�
_listToPhraser�r �sample�expected�results    r#�
test_emptyzListToPhraseTests.test_emptys0�� �����#�#�F�E�2������6�*r$c�^�dg}d}tj|d�}|j||�y)z;
        With a single item, the item is returned.
        �OnerNrrs    r#�test_oneWordzListToPhraseTests.test_oneWords2��������#�#�F�E�2������6�*r$c�`�ddg}d}tj|d�}|j||�y)zA
        Two words are separated by the final delimiter.
        r
�TwozOne and TworNrrs    r#�
test_twoWordszListToPhraseTests.test_twoWords s4������ ���#�#�F�E�2������6�*r$c�`�gd�}d}tj|d�}|j||�y)zY
        With more than two words, the first two are separated by the delimiter.
        )r
r
�ThreezOne, Two, and ThreerNrrs    r#�test_threeWordsz!ListToPhraseTests.test_threeWords)s0��)��(���#�#�F�E�2������6�*r$c�d�gd�}d}tj|dd��}|j||�y)zW
        If a delimiter is specified, it is used instead of the default comma.
        )r
r
r�FourzOne; Two; Three; or Four�orz; )�	delimiterNrrs    r#�test_fourWordsz ListToPhraseTests.test_fourWords2s2��1��-���#�#�F�D�D�A������6�*r$c�`�gd�}d}tj|d�}|j||�y)zS
        If something in things is not a string, it is converted into one.
        )r\��threez1, 2, and threerNrrs    r#�test_notStringz ListToPhraseTests.test_notString;s0��!��$���#�#�F�E�2������6�*r$c��d}|jttj|d�}|j	t|�d�y)z?
        If things is a string, a TypeError is raised.
        zOne, two, threer� Things must be a list or a tupleN�r��	TypeErrorr
rrr@�r rrBs   r#�test_stringTypeErrorz&ListToPhraseTests.test_stringTypeErrorDs:��#���!�!�)�T�-?�-?���O������U��%G�Hr$c��tgd��}|jttj|d�}|jt
|�d�y)zB
        If things is an iterator, a TypeError is raised.
        )r\r�rrN)�iterr�rr
rrr@rs   r#�test_iteratorTypeErrorz(ListToPhraseTests.test_iteratorTypeErrorLs>���i����!�!�)�T�-?�-?���O������U��%G�Hr$c��dd�}|jttj|d�}|j	t|�d�y)zB
        If things is a generator, a TypeError is raised.
        c3�6K�td�Ed{���y7��w)Nr)�ranger9r$r#rz9ListToPhraseTests.test_generatorTypeError.<locals>.sampleYs�����Q�x���s���rrN)r3zGenerator[int, None, None]rrs   r#�test_generatorTypeErrorz)ListToPhraseTests.test_generatorTypeErrorTs:��
	 ��!�!�)�T�-?�-?���O������U��%G�Hr$Nr2)
r5r6r7r8rrrrrrr r$r(r9r$r#r�r�s7���+�+�+�+�+�+�I�I�	Ir$r�c� �eZdZdZdd�Zdd�Zy)�OpenTestLogTestsz#
    Tests for C{openTestLog}.
    c�<�tj�}|jtjtj|�tjtjd�d}tj|j��}t|�5}|j|�ddd�t|jd�5}|j�}ddd�t|jd�t��y#1swY�]xYw#1swY�:xYw)zR
        The log file is opened in text mode and uses UTF-8 for encoding.
        )�C�asciiuHere comes the ☉N�rbr�)�locale�	getlocale�
addCleanup�	setlocale�LC_ALLrr�rr�write�openr�readrr�r)r �
currentLocale�text�pr��writtens      r#�	test_utf8zOpenTestLogTests.test_utf8es����(�(�*�
�����(�(�&�-�-��G��������7�'�����d�k�k�m�,��
��^�	�q�
�G�G�D�M�	��!�&�&�$�
�	�1��f�f�h�G�	�	�D�K�K��(�(�7�*;�<�
	�	��	�	�s�D�D�D�Dc���d}d}dtj�dtj��}tj|j	��}t|�5}|j
|�ddd�t|�5}|j
|�ddd�t|j�jd�t|��y#1swY�axYw#1swY�HxYw)z�
        The log file is opened in append mode so if runner configuration specifies
        an existing log file its contents are not wiped out.
        zHello, world.
 zGoodbye, world.
z
Hello, world.z Goodbye, world.Nr�)r�lineseprr�rrr4r�
getContent�decoder)r �existingText�newTextrr9r�s      r#�test_appendzOpenTestLogTests.test_append{s���
*��%��"�2�:�:�,�.>�r�z�z�l�K�����d�k�k�m�,��
��^�	"�q�
�G�G�L�!�	"�
��^�	�q�
�G�G�G��	�	�
�L�L�N�!�!�'�*��X��	
�	"�	"��	�	�s�C	�<C�	C�CNr2)r5r6r7r8r;rBr9r$r#r*r*`s���=�,
r$r*)+r8�
__future__rr/rr��ior�typingr�zope.interfacer�hamcrestrr�twisted.internet.baser	�twisted.internet.interfacesr
�twisted.pythonr�twisted.python.failurer�
twisted.trialr
�twisted.trial.unittestr�twisted.trial.utilrrrrrrr;rMrarir�r�r�r�r*r9r$r#�<module>rOs���
�#�
�	�
���&�*�-�9�#�*��6���&6�%�&6�R0
�&9�0
�f* �* �Z*�*�&oV�&�oV�dRC�+�RC�jP�&�P�4$Q�/�$Q�NVI�+�VI�r,
�*�,
r$

Zerion Mini Shell 1.0