§
    ÈtºfÖ  ã                   óÖ  — d Z g d¢ZddlmZmZmZmZmZ ddlm	Z	m
Z
mZmZmZ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  ed¦  «        Z G d„ dee         ¦  «        Z edee         ¬¦  «        Z ed¦  «         ed¦  «         ed¦  «         ed¦  «         ed¦  «         ed¦  «        fdee         dee         dee         dee         dee         dee         dee         fd„Z G d„ deee                  ¦  «        Z G d„ deee                  ¦  «        Z dee!         dee!         fd„Z"de#de#deeee#e#e$ee!         ee!         f                           fd „Z%d!S )"z5
Hamcrest matchers useful throughout the test suite.
)Úmatches_resultÚHasSumÚIsSequenceOfé    )ÚAnyÚListÚSequenceÚTupleÚTypeVar)Úcontains_exactlyÚcontains_stringÚequal_toÚ
has_lengthÚhas_propertiesÚinstance_of)ÚBaseMatcher)ÚAllOf)ÚDescription)ÚMatcher)ÚProtocol)ÚFailureÚTc                   ó"   — e Zd ZdZdedefd„ZdS )Ú	Semigroupz˜
    A type with an associative binary operator.

    Common examples of a semigroup are integers with addition and strings with
    concatenation.
    ÚotherÚreturnc                 ó   — dS )zF
        This must be associative: a + (b + c) == (a + b) + c
        N© )Úselfr   s     ú`/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/trial/_dist/test/matchers.pyÚ__add__zSemigroup.__add__+   s   € € € ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r   r!   r   r   r   #   s@   € € € € € ðð ð˜Qð  1ð ð ð ð ð ð r!   r   ÚS)ÚboundÚ	successesÚerrorsÚfailuresÚskipsÚexpectedFailuresÚunexpectedSuccessesr   c           	      ó.   — t          | |||||dœ¦  «        S )zA
    Match a L{TestCase} instances with matching attributes.
    ©r(   r)   r*   r+   r,   r-   )r   r/   s         r   r   r   4   s2   € õ à"ØØ ØØ 0Ø#6ð	
ð 	
ñ	ô 	ð 	r!   c                   óš   — e Zd ZdZdee         deddfd„Zdee         defd„Zd	ee         de	fd
„Z
d	ee         deddfd„Zdeddfd„ZdS )r   zÑ
    Match a sequence the elements of which sum to a value matched by
    another matcher.

    :ivar sumMatcher: The matcher which must match the sum.
    :ivar zero: The zero value for the matched type.
    Ú
sumMatcherÚzeror   Nc                 ó"   — || _         || _        d S ©N)r1   r2   )r   r1   r2   s      r   Ú__init__zHasSum.__init__T   s   € Ø$ˆŒØˆŒ	ˆ	ˆ	r!   Úsequencec                 ó:   — |s| j         S | j         }|D ]}||z   }Œ|S r4   )r2   )r   r6   ÚresultÚelems       r   Ú_sumzHasSum._sumX   s8   € Øð 	Ø”9ÐØ”ˆØð 	#ð 	#ˆDØ˜d‘]ˆFˆFØˆr!   Úitemc                 ó`   — |                       |¦  «        }| j                             |¦  «        S )zG
        Determine whether the sum of the sequence is matched.
        )r:   r1   Úmatches)r   r;   Úss      r   Ú_matcheszHasSum._matches`   s)   € ð �IŠI�d‰OŒOˆØŒ×&Ò& qÑ)Ô)Ð)r!   Údescriptionc                 ó�   — |                       |¦  «        }|                     | ¦  «         | j                             ||¦  «         dS )ú(
        Describe the mismatch.
        N)r:   Úappend_description_ofr1   Údescribe_mismatch)r   r;   r@   r>   s       r   rD   zHasSum.describe_mismatchg   sD   € ð �IŠI�d‰OŒOˆØ×)Ò)¨$Ñ/Ô/Ð/ØŒ×)Ò)¨!¨[Ñ9Ô9Ð9Øˆtr!   c                 óŽ   — |                      d¦  «         |                     | j        ¦  «         |                      d¦  «         dS )ú;
        Describe this matcher for error messages.
        za sequence with sum ú, N)Úappend_textrC   r1   ©r   r@   s     r   Údescribe_tozHasSum.describe_top   sI   € ð 	×ÒÐ 6Ñ7Ô7Ð7Ø×)Ò)¨$¬/Ñ:Ô:Ð:Ø×Ò Ñ%Ô%Ð%Ð%Ð%r!   )r"   r#   r$   r%   r   r&   r5   r   r:   Úboolr?   r   rD   rJ   r   r!   r   r   r   K   sç   € € € € € ðð ð 7¨1¤:ð °Qð ¸4ð ð ð ð ð˜X aœ[ð ¨Qð ð ð ð ð*˜X aœ[ð *¨Tð *ð *ð *ð *ð h¨q¤kð Àð ÐPTð ð ð ð ð& {ð &°tð &ð &ð &ð &ð &ð &r!   r   c                   óz   — e Zd ZdZdee         ddfd„Zdee         defd„Z	dee         de
ddfd	„Zde
ddfd
„ZdS )r   z¬
    Match a sequence where every element is matched by another matcher.

    :ivar elementMatcher: The matcher which must match every element of the
        sequence.
    ÚelementMatcherr   Nc                 ó   — || _         d S r4   )rM   )r   rM   s     r   r5   zIsSequenceOf.__init__�   s   € Ø,ˆÔÐÐr!   r;   c                 óJ   — |D ]}| j                              |¦  «        s dS Œ dS )zM
        Determine whether every element of the sequence is matched.
        FT)rM   r=   )r   r;   r9   s      r   r?   zIsSequenceOf._matches„   s=   € ð ð 	ð 	ˆDØÔ&×.Ò.¨tÑ4Ô4ð Ø�u�uðàˆtr!   r@   c                 óÄ   — t          |¦  «        D ]O\  }}| j                             |¦  «        s0|                     | ¦  «         |                     d|› d|›�¦  «         ŒPdS )rB   znot sequence with element #ú N)Ú	enumeraterM   r=   rC   rH   )r   r;   r@   Úidxr9   s        r   rD   zIsSequenceOf.describe_mismatch�   s   € õ # 4™œð 	Vð 	V‰IˆC�ØÔ&×.Ò.¨tÑ4Ô4ð VØ×1Ò1°$Ñ7Ô7Ð7Ø×'Ò'Ð(TÀcÐ(TÐ(TÈDÐ(TÐ(TÑUÔUÐUøð	Vð 	Vr!   c                 óŽ   — |                      d¦  «         |                     | j        ¦  «         |                      d¦  «         dS )rF   za sequence containing only rG   N)rH   rC   rM   rI   s     r   rJ   zIsSequenceOf.describe_to–   sJ   € ð 	×ÒÐ =Ñ>Ô>Ð>Ø×)Ò)¨$Ô*=Ñ>Ô>Ð>Ø×Ò Ñ%Ô%Ð%Ð%Ð%r!   )r"   r#   r$   r%   r   r   r5   r   rK   r?   r   rD   rJ   r   r!   r   r   r   y   sÁ   € € € € € ðð ð- w¨q¤zð -°dð -ð -ð -ð -ð˜X aœ[ð ¨Tð ð ð ð ðV h¨q¤kð VÀð VÐPTð Vð Vð Vð Vð& {ð &°tð &ð &ð &ð &ð &ð &r!   r   Ú
propertiesc                  óZ   — t          t          t          ¦  «        t          di | ¤Ž¦  «        S )zC
    Match an instance of L{Failure} with matching attributes.
    r   )r   r   r   r   )rU   s    r   Ú	isFailurerW   Ÿ   s2   € õ Ý•GÑÔÝÐ$Ð$˜Ð$Ð$ñô ð r!   ÚfunctionNameÚfileNamec           	      ó´   — t          t          | ¦  «        t          |¦  «        t          t          ¦  «        t          d¦  «        t          d¦  «        ¦  «        S )zk
    Match a tuple representation of a frame like those used by
    L{twisted.python.failure.Failure}.
    r   )r   r   r   r   Úintr   )rX   rY   s     r   ÚsimilarFramer\   ©   sK   € õ Ý�ÑÔÝ˜Ñ!Ô!Ý•CÑÔõ 	�1‰ŒÝ�1‰Œñô ð r!   N)&r%   Ú__all__Útypingr   r   r   r	   r
   Úhamcrestr   r   r   r   r   r   Úhamcrest.core.base_matcherr   Úhamcrest.core.core.allofr   Úhamcrest.core.descriptionr   Úhamcrest.core.matcherr   Útyping_extensionsr   Útwisted.python.failurer   r   r   r&   r   r   r   ÚobjectrW   Ústrr[   r\   r   r!   r   ú<module>rh      s  ððð ðð ð €ð 7Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 3Ð 2Ð 2Ð 2Ð 2Ð 2Ø *Ð *Ð *Ð *Ð *Ð *Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø )Ð )Ð )Ð )Ð )Ð )Ø &Ð &Ð &Ð &Ð &Ð &à *Ð *Ð *Ð *Ð *Ð *à€GˆC�L„L€ðð ð ð ð �˜”ñ ô ð ð €GˆC�y ”~Ð&Ñ&Ô&€ð '˜h q™kœkØ%˜: a™=œ=Ø'˜Z¨™]œ]Ø$˜* Q™-œ-Ø%/ Z°¡]¤]Ø(2¨
°1©¬ðð Ø�sŒ|ðà�CŒLðð �cŒlðð �3Œ<ð	ð
 ˜c”lðð ! œðð ˆS„\ðð ð ð ð.+&ð +&ð +&ð +&ð +&ˆ[˜ !œÔ%ñ +&ô +&ð +&ð\#&ð #&ð #&ð #&ð #&�;˜x¨œ{Ô+ñ #&ô #&ð #&ðL˜G FœOð °¸´ð ð ð ð ðØðØ!$ðàˆX�e˜C  c¨4°¬<¸¸f¼ÐEÔFÔGÔHðð ð ð ð ð r!   