
    h                         S r SSKJrJrJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  \" S5      r\" S	5      r " S
 S\\   5      rS\\/\4   S\\   S\\   4S jrSS\\   S\S\\   4S jjrg)z5
Hamcrest matchers useful throughout the test suite.
    )IOCallableOptionalTypeVar)BaseMatcher)Description)Matcher)	IFilePath)fullyQualifiedName_A_Bc                      ^  \ rS rSrSrS\\/\4   S\\   SS4S jr	S\S\
4S	 jrS\S
\SS4U 4S jjrS\SS4S jrSrU =r$ )_MatchAfter   a  
The implementation of L{after}.

@ivar f: The function to apply.
@ivar m: The matcher to use on the result.

@ivar _e: After trying to apply the function fails with an exception, the
    exception that was raised.  This can later be used by
    L{describe_mismatch}.
fmreturnNc                 *    Xl         X l        S U l        g N)r   r   _e)selfr   r   s      b/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/trial/test/matchers.py__init___MatchAfter.__init__!   s    '+    itemc                      U R                  U5      nU R                  R                  U5      $ ! [         a  nX0l         SnAgSnAff = f)z9
Apply the function and delegate matching on the result.
NF)r   r   matches	Exceptionr   )r   r   transformedes       r   _matches_MatchAfter._matches&   sC    	/&&,K
 66>>+..	  	G	s   . 
AAAmismatch_descriptionc           	         > U R                   c  [        TU ]	  X5        gUR                  [	        U R
                  5       SU< S[	        U R                   R                  5       SU R                    35        g)a  
Describe the mismatching item or the exception that occurred while
pre-processing it.

@note: Since the exception reporting here depends on mutable state it
    will only work as long as PyHamcrest calls methods in the right
    order.  The PyHamcrest Matcher interface doesn't seem to allow
    implementing this functionality in a more reliable way (see the
    implementation of L{assert_that}).
N(z	) raised
z: )r   superdescribe_mismatchappend_textr   r   	__class__)r   r   r$   r*   s      r   r(   _MatchAfter.describe_mismatch2   se     77?G%dA ,,%dff-.axz%dgg&7&789DGG9Fr   descriptionc                 x    UR                  SU R                   S35        U R                  R                  U5        g)z5
Create a text description of the match requirement.
z[after z] N)r)   r   r   describe_to)r   r,   s     r   r.   _MatchAfter.describe_toE   s1     	'$&& 45;'r   )r   r   r   )__name__
__module____qualname____firstlineno____doc__r   r   r   r	   r   boolr"   r   r(   r.   __static_attributes____classcell__)r*   s   @r   r   r      sw    	,(B48, , , ,

/R 
/D 
/b  PT &({ (t ( (r   r   r   r   r   c                     [        X5      $ )zF
Create a matcher which calls C{f} and uses C{m} to match the result.
)r   )r   r   s     r   afterr9   M   s     qr   encodingc                 B   ^ S[         S[        4U4S jjn[        X 5      $ )zY
Create a matcher which matches a L{FilePath} the contents of which are
matched by L{m}.
pr   c                    > U R                  5        nUR                  5       R                  T5      sS S S 5        $ ! , (       d  f       g = fr   )openreaddecode)r<   r   r:   s     r   
getContent fileContents.<locals>.getContentZ   s*    VVX668??8, XXs	   ;
A	)r
   strr9   )r   r:   rA   s    ` r   fileContentsrD   T   s#    -i -C -
 r   N)zutf-8)r4   typingr   r   r   r   hamcrest.core.base_matcherr   hamcrest.core.descriptionr   hamcrest.core.matcherr	   twisted.python.filepathr
   twisted.python.reflectr   r   r   r   r9   rC   rD    r   r   <module>rL      s    3 2 2 1 ) - 5T]T]5(+b/ 5(pXrdBh GBK GBK  GCL  C  gi>P  r   