o
    ¯bÌL  ã                   @   s  d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZmZmZ G dd„ deƒZG dd„ deƒZG dd„ dƒZG dd„ dƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZ dS )z!
Tests for L{twisted.trial.util}
é    N)ÚStringIO)Úimplementer)ÚDelayedCall)ÚIProcessTransport)Úfilepath)ÚFailure)Úutil)ÚSynchronousTestCase)ÚDirtyReactorAggregateErrorÚ_JanitorÚacquireAttributeÚexcInfoOrFailureToExcInfoc                   @   ó0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚMktempTestszm
    Tests for L{TestCase.mktemp}, a helper function for creating temporary file
    or directory names.
    c                 C   s8   |   ¡ }tj |¡ tj¡dd… }|  |g d¢¡ dS )z–
        The path name returned by C{mktemp} is directly beneath a directory
        which identifies the test method which created the name.
        Néÿÿÿÿ)ztwisted.trial.test.test_utilr   Ú	test_name)ÚmktempÚosÚpathÚdirnameÚsplitÚsepÚassertEqual)ÚselfÚnameÚdirs© r   ú>/usr/lib/python3/dist-packages/twisted/trial/test/test_util.pyr   $   s
   ÿzMktempTests.test_namec                 C   s   |   ¡ }|  ||   ¡ ¡ dS )zF
        Repeated calls to C{mktemp} return different values.
        N)r   ÚassertNotEqual)r   r   r   r   r   Útest_unique/   s   zMktempTests.test_uniquec                 C   s<   |   ¡ }tj |¡}|  tj |¡¡ |  tj |¡¡ dS )zS
        The directory part of the path name returned by C{mktemp} exists.
        N)r   r   r   r   Ú
assertTrueÚexistsÚassertFalse)r   r   r   r   r   r   Útest_created6   s   zMktempTests.test_createdc                 C   s(   t j |  ¡ ¡}|  | t  ¡ ¡¡ dS )zZ
        The path returned by C{mktemp} is beneath the current working directory.
        N)r   r   Úabspathr   r    Ú
startswithÚgetcwd)r   r   r   r   r   Útest_location?   s   zMktempTests.test_locationN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r#   r'   r   r   r   r   r      s    	r   c                   @   ó(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚDirtyReactorAggregateErrorTestsz6
    Tests for the L{DirtyReactorAggregateError}.
    c                 C   s    t ddgƒ}|  t|ƒd¡ dS )z5
        Delayed calls are formatted nicely.
        ÚFooÚbarzhReactor was unclean.
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
Foo
barN©r
   r   Ústr©r   Úerrorr   r   r   Útest_formatDelayedCallL   s
   þz6DirtyReactorAggregateErrorTests.test_formatDelayedCallc                 C   s"   t g ddgƒ}|  t|ƒd¡ dS )z3
        Selectables are formatted nicely.
        zselectable 1zselectable 2z;Reactor was unclean.
Selectables:
selectable 1
selectable 2Nr0   r2   r   r   r   Útest_formatSelectablesZ   s
   þz6DirtyReactorAggregateErrorTests.test_formatSelectablesc                 C   s&   t ddgddgƒ}|  t|ƒd¡ dS )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
Sel2Nr0   r2   r   r   r   Ú%test_formatDelayedCallsAndSelectablesh   s
   þzEDirtyReactorAggregateErrorTests.test_formatDelayedCallsAndSelectablesN)r(   r)   r*   r+   r4   r5   r:   r   r   r   r   r-   G   s
    r-   c                   @   s4   e Zd ZdZddd„Zddd„Zdd„ Zd	d
„ ZdS )Ú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                 C   s$   || _ g | _d| _|sg }|| _dS )zƒ
        @param delayedCalls: See L{StubReactor.delayedCalls}.
        @param selectables: See L{StubReactor.selectables}.
        r   N)ÚdelayedCallsÚ
iterationsÚremoveAllCalledÚselectables)r   r<   r?   r   r   r   Ú__init__…   s   
zStubReactor.__init__c                 C   ó   | j  |¡ dS )z/
        Increment C{self.iterations}.
        N)r=   Úappend)r   Útimeoutr   r   r   Úiterate‘   ó   zStubReactor.iteratec                 C   s   | j S )z.
        Return C{self.delayedCalls}.
        )r<   ©r   r   r   r   ÚgetDelayedCalls—   s   zStubReactor.getDelayedCallsc                 C   s   |  j d7  _ | jS )zS
        Increment C{self.removeAllCalled} and return C{self.selectables}.
        é   )r>   r?   rF   r   r   r   Ú	removeAll�   s   zStubReactor.removeAll©N)r(   r)   r*   r+   r@   rD   rG   rI   r   r   r   r   r;   z   s    


r;   c                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )Ú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                 C   ó
   g | _ d S rJ   )ÚerrorsrF   r   r   r   r@   ®   ó   
zStubErrorReporter.__init__c                 C   s   | j  ||f¡ dS )z6
        Record parameters in C{self.errors}.
        N)rN   rB   )r   Útestr3   r   r   r   ÚaddError±   s   zStubErrorReporter.addErrorN)r(   r)   r*   r+   r@   rQ   r   r   r   r   rL   ¥   s    rL   c                   @   sh   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )ÚJanitorTestsz 
    Tests for L{_Janitor}!
    c                 C   s4   t g ƒ}tdd|d�}| ¡  |  |jddg¡ dS )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   )r;   r   Ú_cleanPendingr   r=   ©r   rT   Újanr   r   r   Útest_cleanPendingSpinsReactor½   s   z*JanitorTests.test_cleanPendingSpinsReactorc                 C   sV   dd„ }g }t d|di |jdd„ ƒ}t|gƒ}tdd|d�}| ¡  |  ||g¡ dS )	zW
        During pending-call cleanup, the janitor cancels pending timed calls.
        c                   S   ó   dS )NÚLulzr   r   r   r   r   ÚfuncÎ   ó   z8JanitorTests.test_cleanPendingCancelsCalls.<locals>.funcé,  r   c                 S   ó   d S rJ   r   ©Úxr   r   r   Ú<lambda>Ò   ó    z<JanitorTests.test_cleanPendingCancelsCalls.<locals>.<lambda>NrS   )r   rB   r;   r   rU   r   )r   r[   Ú	cancelledÚdelayedCallrT   rW   r   r   r   Útest_cleanPendingCancelsCallsÉ   s   
z*JanitorTests.test_cleanPendingCancelsCallsc              	   C   s`   t ddd„ di dd„ dd„ dd„ d�}t|ƒ}t|gƒ}tdd|d	�}| ¡ }|  ||g¡ dS )
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.
        r]   c                   S   r^   rJ   r   r   r   r   r   ra   á   rb   zIJanitorTests.test_cleanPendingReturnsDelayedCallStrings.<locals>.<lambda>r   c                 S   r^   rJ   r   r_   r   r   r   ra   á   rb   c                   S   rY   ©Nr   r   r   r   r   r   ra   á   rb   ©ÚsecondsNrS   )r   r1   r;   r   rU   r   )r   rd   ÚdelayedCallStringrT   rW   Ústringsr   r   r   Ú*test_cleanPendingReturnsDelayedCallStringsØ   s   ÿ
z7JanitorTests.test_cleanPendingReturnsDelayedCallStringsc                 C   s0   t g ƒ}tdd|d�}| ¡  |  |jd¡ dS )zM
        The Janitor will remove selectables during reactor cleanup.
        NrS   rH   )r;   r   Ú_cleanReactorr   r>   rV   r   r   r   Ú#test_cleanReactorRemovesSelectablesé   s   z0JanitorTests.test_cleanReactorRemovesSelectablesc                 C   sR   t tƒG dd„ dƒƒ}|ƒ }tg |gƒ}tdd|d�}| ¡  |  |jdg¡ dS )zI
        The Janitor will kill processes during reactor cleanup.
        c                   @   rK   )zJJanitorTests.test_cleanReactorKillsProcesses.<locals>.StubProcessTransportz˜
            A stub L{IProcessTransport} provider which records signals.
            @ivar signals: The signals passed to L{signalProcess}.
            c                 S   rM   rJ   )ÚsignalsrF   r   r   r   r@   þ   rO   zSJanitorTests.test_cleanReactorKillsProcesses.<locals>.StubProcessTransport.__init__c                 S   rA   )zF
                Append C{signal} to C{self.signals}.
                N)rn   rB   )r   Úsignalr   r   r   ÚsignalProcess  rE   zXJanitorTests.test_cleanReactorKillsProcesses.<locals>.StubProcessTransport.signalProcessN)r(   r)   r*   r+   r@   rp   r   r   r   r   ÚStubProcessTransport÷   s    rq   NrS   ÚKILL)r   r   r;   r   rl   r   rn   )r   rq   ÚptrT   rW   r   r   r   Útest_cleanReactorKillsProcessesò   s   z,JanitorTests.test_cleanReactorKillsProcessesc                 C   s@   G dd„ dƒ}t g |ƒ gƒ}tdd|d�}|  | ¡ dg¡ dS )z‹
        The Janitor returns string representations of the selectables that it
        cleaned up from the reactor cleanup method.
        c                   @   s   e Zd ZdZdefdd„ZdS )zJJanitorTests.test_cleanReactorReturnsSelectableStrings.<locals>.Selectablezl
            A stub Selectable which only has an interesting string
            representation.
            Úreturnc                 S   rY   )Nú(SELECTABLE!)r   rF   r   r   r   Ú__repr__  r\   zSJanitorTests.test_cleanReactorReturnsSelectableStrings.<locals>.Selectable.__repr__N)r(   r)   r*   r+   r1   rw   r   r   r   r   Ú
Selectable  s    rx   NrS   rv   )r;   r   r   rl   )r   rx   rT   rW   r   r   r   Ú)test_cleanReactorReturnsSelectableStrings  s   	z6JanitorTests.test_cleanReactorReturnsSelectableStringsc                 C   sB   t g ƒ}tƒ }tƒ }t|||d�}|  | ¡ ¡ |  |jg ¡ dS )z�
        The post-case cleanup method will return True and not call C{addError}
        on the result if there are no pending calls.
        rS   N)r;   ÚobjectrL   r   r    ÚpostCaseCleanupr   rN   ©r   rT   rP   ÚreporterrW   r   r   r   Útest_postCaseCleanupNoErrors   s   z)JanitorTests.test_postCaseCleanupNoErrorsc              	   C   s”   t ddd„ di dd„ dd„ dd„ d�}t|ƒ}t|gg ƒ}tƒ }tƒ }t|||d�}|  | ¡ ¡ |  t	|j
ƒd	¡ |  |j
d
 d	 jj|g¡ dS )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.
        r]   c                   S   r^   rJ   r   r   r   r   r   ra   3  rb   z=JanitorTests.test_postCaseCleanupWithErrors.<locals>.<lambda>r   c                 S   r^   rJ   r   r_   r   r   r   ra   3  rb   c                   S   rY   rf   r   r   r   r   r   ra   3  rb   rg   rS   rH   r   N)r   r1   r;   rz   rL   r   r"   r{   r   ÚlenrN   Úvaluer<   ©r   rd   ri   rT   rP   r}   rW   r   r   r   Útest_postCaseCleanupWithErrors,  s   ÿ z+JanitorTests.test_postCaseCleanupWithErrorsc                 C   s<   t g ƒ}tƒ }tƒ }t|||d�}| ¡  |  |jg ¡ dS )z�
        The post-class cleanup method will not call C{addError} on the result
        if there are no pending calls or selectables.
        rS   N)r;   rz   rL   r   ÚpostClassCleanupr   rN   r|   r   r   r   Útest_postClassCleanupNoErrors>  s   z*JanitorTests.test_postClassCleanupNoErrorsc              	   C   sŽ   t ddd„ di dd„ dd„ dd„ d�}t|ƒ}t|gg ƒ}tƒ }tƒ }t|||d�}| ¡  |  t|j	ƒd	¡ |  |j	d
 d	 j
j|g¡ dS )zŸ
        The post-class cleanup method call C{addError} on the result with a
        L{DirtyReactorAggregateError} Failure if there are pending calls.
        r]   c                   S   r^   rJ   r   r   r   r   r   ra   P  rb   zIJanitorTests.test_postClassCleanupWithPendingCallErrors.<locals>.<lambda>r   c                 S   r^   rJ   r   r_   r   r   r   ra   P  rb   c                   S   rY   rf   r   r   r   r   r   ra   P  rb   rg   rS   rH   r   N)r   r1   r;   rz   rL   r   rƒ   r   r   rN   r€   r<   r�   r   r   r   Ú*test_postClassCleanupWithPendingCallErrorsJ  s   ÿ z7JanitorTests.test_postClassCleanupWithPendingCallErrorsc                 C   sh   d}t g |gƒ}tƒ }tƒ }t|||d�}| ¡  |  t|jƒd¡ |  |jd d jj	t
|ƒg¡ dS )z�
        The post-class cleanup method call C{addError} on the result with a
        L{DirtyReactorAggregateError} Failure if there are selectables.
        zSELECTABLE HERErS   rH   r   N)r;   rz   rL   r   rƒ   r   r   rN   r€   r?   Úrepr)r   Ú
selectablerT   rP   r}   rW   r   r   r   Ú)test_postClassCleanupWithSelectableErrors[  s   $z6JanitorTests.test_postClassCleanupWithSelectableErrorsN)r(   r)   r*   r+   rX   re   rk   rm   rt   ry   r~   r‚   r„   r…   rˆ   r   r   r   r   rR   ¸   s    	rR   c                   @   r,   )	ÚRemoveSafelyTestsz*
    Tests for L{util._removeSafely}.
    c                 C   s8   |   ¡  d¡}t |¡ t |¡}|  tjtj	|¡ dS )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ÚdirPathr   r   r   Útest_removeSafelyNoTrialMarkero  s   

z0RemoveSafelyTests.test_removeSafelyNoTrialMarkerc                 C   sp   dd„ }t ƒ }|  td|¡ |  ¡  d¡}t |¡ t |¡}| 	d¡ 
¡  ||_t |¡ |  d| ¡ ¡ dS )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                   S   s   t ƒ ‚)ú…
            Raise an C{OSError} to emulate the branch of L{util._removeSafely}
            in which path removal fails.
            ©ÚOSErrorr   r   r   r   ÚdummyRemove�  s   zORemoveSafelyTests.test_removeSafelyRemoveFailsMoveSucceeds.<locals>.dummyRemoveÚstdoutrŠ   ó   _trial_markerúcould not remove FilePathN)r   ÚpatchÚsysr   r‹   r   rŒ   r   r�   ÚchildÚtouchÚremover   r�   ÚassertInÚgetvalue)r   r—   Úoutr‘   r’   r   r   r   Ú(test_removeSafelyRemoveFailsMoveSucceedsz  s   


z:RemoveSafelyTests.test_removeSafelyRemoveFailsMoveSucceedsc                 C   s”   dd„ }dd„ }t ƒ }|  td|¡ |  ¡  d¡}t |¡ t |¡}| 	d¡ 
¡  ||_||_|  ttj|¡}|  t|ƒd¡ |  d	| ¡ ¡ d
S )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                   S   ó   t dƒ‚)r”   zpath removal failedr•   r   r   r   r   r—   ž  ó   zLRemoveSafelyTests.test_removeSafelyRemoveFailsMoveFails.<locals>.dummyRemovec                 S   r¤   )z†
            Raise an C{OSError} to emulate the branch of L{util._removeSafely}
            in which path movement fails.
            úpath movement failedr•   )r   r   r   r   ÚdummyMoveTo¥  r¥   zLRemoveSafelyTests.test_removeSafelyRemoveFailsMoveFails.<locals>.dummyMoveTor˜   rŠ   r™   r¦   rš   N)r   r›   rœ   r   r‹   r   rŒ   r   r�   r�   rž   rŸ   ÚmoveTorŽ   r–   r   r�   r   r1   r    r¡   )r   r—   r§   r¢   r‘   r’   r3   r   r   r   Ú%test_removeSafelyRemoveFailsMoveFails—  s   

z7RemoveSafelyTests.test_removeSafelyRemoveFailsMoveFailsN)r(   r)   r*   r+   r“   r£   r©   r   r   r   r   r‰   j  s
    r‰   c                   @   rK   )ÚExcInfoTestsz1
    Tests for L{excInfoOrFailureToExcInfo}.
    c                 C   s$   t t dƒdf}|  |t|ƒu ¡ dS )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   Úinfor   r   r   Útest_excInfoÄ  s   zExcInfoTests.test_excInfoc                 C   sF   zdd  W n t y   tƒ }Y nw |  |j|j|jft|ƒ¡ dS )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.
        rH   r   N)ÚBaseExceptionr   r   Útyper€   Útbr   )r   Úfr   r   r   Útest_failureÌ  s   
ÿ zExcInfoTests.test_failureN)r(   r)   r*   r+   r®   r³   r   r   r   r   rª   ¿  s    rª   c                   @   r   )ÚAcquireAttributeTestsz(
    Tests for L{acquireAttribute}.
    c                 C   s*   t ƒ  | _}|  |t| t ƒ gdƒu ¡ dS )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©rz   r€   r    r   ©r   r€   r   r   r   Útest_foundOnEarlierObjectÞ  s   z/AcquireAttributeTests.test_foundOnEarlierObjectc                 C   s*   t ƒ  | _}|  |tt ƒ | gdƒu ¡ dS )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¶   r   r   r   Útest_foundOnLaterObjectç  s   z-AcquireAttributeTests.test_foundOnLaterObjectc                 C   s   |   tttƒ gd¡ dS )z•
        If none of the objects passed in the list to L{acquireAttribute} have
        the requested attribute, L{AttributeError} is raised.
        r«   N)rŽ   ÚAttributeErrorr   rz   rF   r   r   r   Útest_notFoundExceptionï  s   z,AcquireAttributeTests.test_notFoundExceptionc                 C   s$   t ƒ }|  |tt ƒ gd|ƒu ¡ dS )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)rz   r    r   )r   Údefaultr   r   r   Útest_notFoundDefaultö  s   z*AcquireAttributeTests.test_notFoundDefaultN)r(   r)   r*   r+   r·   r¸   rº   r¼   r   r   r   r   r´   Ù  s    	r´   c                   @   sX   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )Ú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                 C   s$   g }d}t  |d¡}|  ||¡ dS )zB
        If things is empty, an empty string is returned.
        Ú ÚandN©r   Ú_listToPhraser   ©r   ÚsampleÚexpectedÚresultr   r   r   Ú
test_empty  s   zListToPhraseTests.test_emptyc                 C   s&   dg}d}t  |d¡}|  ||¡ dS )z;
        With a single item, the item is returned.
        ÚOner¿   NrÀ   rÂ   r   r   r   Útest_oneWord  s   zListToPhraseTests.test_oneWordc                 C   s(   ddg}d}t  |d¡}|  ||¡ dS )zA
        Two words are separated by the final delimiter.
        rÇ   ÚTwozOne and Twor¿   NrÀ   rÂ   r   r   r   Útest_twoWords  ó   zListToPhraseTests.test_twoWordsc                 C   ó(   g d¢}d}t  |d¡}|  ||¡ dS )zY
        With more than two words, the first two are separated by the delimiter.
        )rÇ   rÉ   ÚThreezOne, Two, and Threer¿   NrÀ   rÂ   r   r   r   Útest_threeWords"  rË   z!ListToPhraseTests.test_threeWordsc                 C   s,   g d¢}d}t j|ddd�}|  ||¡ dS )zW
        If a delimiter is specified, it is used instead of the default comma.
        )rÇ   rÉ   rÍ   ÚFourzOne; Two; Three; or FourÚorz; )Ú	delimiterNrÀ   rÂ   r   r   r   Útest_fourWords+  s   z ListToPhraseTests.test_fourWordsc                 C   rÌ   )zS
        If something in things is not a string, it is converted into one.
        )rH   é   Úthreez1, 2, and threer¿   NrÀ   rÂ   r   r   r   Útest_notString4  rË   z ListToPhraseTests.test_notStringc                 C   s*   d}|   ttj|d¡}|  t|ƒd¡ dS )z?
        If things is a string, a TypeError is raised.
        zOne, two, threer¿   ú Things must be a list or a tupleN©rŽ   Ú	TypeErrorr   rÁ   r   r1   ©r   rÃ   r3   r   r   r   Útest_stringTypeError=  s   z&ListToPhraseTests.test_stringTypeErrorc                 C   s2   t g d¢ƒ}|  ttj|d¡}|  t|ƒd¡ dS )zB
        If things is an iterator, a TypeError is raised.
        )rH   rÓ   é   r¿   rÖ   N)ÚiterrŽ   rØ   r   rÁ   r   r1   rÙ   r   r   r   Útest_iteratorTypeErrorE  s   z(ListToPhraseTests.test_iteratorTypeErrorc                 C   s.   dd„ }|   ttj|d¡}|  t|ƒd¡ dS )zB
        If things is a generator, a TypeError is raised.
        c                   s   s   � t dƒE d H  d S )NrÓ   )Úranger   r   r   r   rÃ   R  s   €z9ListToPhraseTests.test_generatorTypeError.<locals>.sampler¿   rÖ   Nr×   rÙ   r   r   r   Útest_generatorTypeErrorM  s   z)ListToPhraseTests.test_generatorTypeErrorN)r(   r)   r*   r+   rÆ   rÈ   rÊ   rÎ   rÒ   rÕ   rÚ   rÝ   rß   r   r   r   r   r½      s    						r½   )!r+   r   rœ   Úior   Úzope.interfacer   Útwisted.internet.baser   Útwisted.internet.interfacesr   Útwisted.pythonr   Útwisted.python.failurer   Útwisted.trialr   Útwisted.trial.unittestr	   Útwisted.trial.utilr
   r   r   r   r   r-   r;   rL   rR   r‰   rª   r´   r½   r   r   r   r   Ú<module>   s,   )3+ 3U'