
    Vh                         d Z ddl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mZmZ ddlmZ ddlmZ d	d
lmZ  G d de      Zy)z+
Tests for L{twisted.trial.test.matchers}.
    )anythingassert_thatcontains_stringequal_tonot_)AllOf)StringDescription)given)justsampled_fromtext)FilePath)SynchronousTestCase   )fileContentsc                       e Zd ZdZ e e        ed            dededdfd       Z e ed       e	g d	            dededdfd
       Z
ddZy)FileContentsTestsz$
    Tests for L{fileContents}.
    utf-8contentsencodingreturnNc                 4   t        | j                               }|j                  |j                  |             t	               }t        t        t        |            j                  ||      t        d             t        t        |      t        d             y)ah  
        L{fileContents} matches a L{IFilePath} that refers to a file that
        contains a string that is matched by the parameterized matcher.

        :param contents: The text string to place in the file and match
            against.

        :param encoding: The text encoding to use to encode C{contents} when
            writing to the file.
        T N)
r   mktemp
setContentencoder	   r   r   r   matchesstrselfr   r   pdescriptions        P/home/dcms/DCMS/lib/python3.12/site-packages/twisted/trial/test/test_matchers.pytest_matcheszFileContentsTests.test_matches   sn     T[[]#	X__X./')(+,44QDhtn	
 	C$hrl3    z!some text, it doesn't matter what)asciizlatin-1r   c                 L   t        | j                               }|j                  |j                  |             t	               }t        t        t        t                           j                  ||      t        d             t        t        |      t        d| d             y)a|  
        L{fileContents} does not match an L{IFilePath} that refers to a
        file that contains a string that is not matched by the parameterized
        matcher.

        :param contents: The text string to place in the file and match
            against.

        :param encoding: The text encoding to use to encode C{contents} when
            writing to the file.
        Fzwas <>N)r   r   r   r   r	   r   r   r   r   r   r   r   r   s        r#   test_mismatchesz!FileContentsTests.test_mismatches)   sy      T[[]#	X__X./')hj)*221kBHUO	
 	C$hqc|&<=r%   c                 R   t        | j                               }t               }t        t	        t                     j                  ||      t        d             t        t        |      t        t        d      t        d      t        t        |j                                           y)zq
        L{fileContents} reports details of any I/O error encountered while
        attempting to match.
        Fr   FileNotFoundErrorN)r   r   r	   r   r   r   r   r   r   r   r   reprpath)r    r!   r"   s      r#   test_ioerrorzFileContentsTests.test_ioerrorB   sy    
 T[[]#')L,44QDhuoV/ 34  QVV-	
r%   )r   N)__name__
__module____qualname____doc__r
   r   r   r   r$   r   r)   r.    r%   r#   r   r      s     464=!4S 4C 4D 4 "4( 0123> >s >t >	>*
r%   r   N)r2   hamcrestr   r   r   r   r   hamcrest.core.core.allofr    hamcrest.core.string_descriptionr	   
hypothesisr
   hypothesis.strategiesr   r   r   twisted.python.filepathr   twisted.trial.unittestr   matchersr   r   r3   r%   r#   <module>r<      s:    L K * >  : : , 6 "H
+ H
r%   