Current File : //lib/python3/dist-packages/twisted/trial/test/__pycache__/test_matchers.cpython-312.pyc |
�
Ϫ�f� � � � d Z ddlmZmZmZmZmZ ddlmZ ddl m
Z
ddlmZ ddl
mZmZmZ ddlmZ ddlmZ d d
lmZ G d� de� Zy
)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 Zd ZdZ e e� ed� � dededdfd�� Z e ed� e g d �� � dededdfd
�� Z
dd�Zy)
�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 �B/usr/lib/python3/dist-packages/twisted/trial/test/test_matchers.py�test_matcheszFileContentsTests.test_matches sn � �
�T�[�[�]�#�� ���X�_�_�X�.�/�'�)�����(�+�,�4�4�Q��D�h�t�n�
� �C��$�h�r�l�3� z!some text, it doesn't matter what)�asciizlatin-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.
Fzwas <�>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�.�/�'�)�����h�j�)�*�2�2�1�k�B�H�U�O�
� �C��$�h��q�c��|�&<�=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"