o
    >h                     @   s   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 deZdS )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                   @   sl   e Zd ZdZee eddededdfddZeed	e	g d
dededdfddZ
dddZdS )FileContentsTestsz$
    Tests for L{fileContents}.
    utf-8contentsencodingreturnNc                 C   sV   t |  }||| t }ttt|||td tt	|td dS )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description r    /var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/twisted/trial/test/test_matchers.pytest_matches   s   zFileContentsTests.test_matchesz!some text, it doesn't matter what)asciizlatin-1r   c                 C   s`   t |  }||| t }tttt 	||t
d tt|t
d| d dS )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   r    r    r!   test_mismatches)   s   z!FileContentsTests.test_mismatchesc                 C   sZ   t |  }t }ttt ||td tt|t	t
dt
dt
t|j dS )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   r    r    r!   test_ioerrorB   s   zFileContentsTests.test_ioerror)r   N)__name__
__module____qualname____doc__r	   r   r
   r   r"   r   r%   r)   r    r    r    r!   r      s    
r   N)r-   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   r    r    r    r!   <module>   s    