Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/twisted/test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/twisted/test/__pycache__/test_text.cpython-37.pyc

B

;��]8�@s�dZddlmZddlmZddlmZdZGdd�dej	�Z
Gdd	�d	ej	�ZGd
d�dej	�ZGdd
�d
ej	�Z
Gdd�dej	�ZdS)z#
Tests for L{twisted.python.text}.
�)�NativeStringIO)�unittest)�texta�Every attempt to employ mathematical methods in the study of chemical
questions must be considered profoundly irrational and contrary to the
spirit of chemistry ...  If mathematical analysis should ever hold a
prominent place in chemistry - an aberration which is happily almost
impossible - it would occasion a rapid and widespread degeneration of that
science.

           --  Auguste Comte, Philosophie Positive, Paris, 1838
c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�	WrapTestsz'
    Tests for L{text.greedyWrap}.
    cCs$d|_t��|_t�t|j�|_dS)N�H)�	lineWidth�
sampleText�split�sampleSplitTextr�wordWrap�output)�self�r�I/opt/alt/python37/lib64/python3.7/site-packages/twisted/test/test_text.py�setUps
zWrapTests.setUpcCsDg}x|jD]}|�|���qWt|�}t|j�}|�||�dS)z.
        Compare the number of words.
        N)r�extendr	�lenr
�assertEqual)r
�words�lineZ	wordCountZsampleTextWordCountrrr�test_wordCount$s
zWrapTests.test_wordCountcCs6g}x|jD]}|�|���qW|�|j|k�dS)z-
        Compare the lists of words.
        N)rrr	�
assertTruer
)r
rrrrr�test_wordMatch1szWrapTests.test_wordMatchcCsZg}x*|jD] }t|�|jks|�t|��qW|rV|�dt|�t|j�|j|f�dS)z0
        Check the length of the lines.
        z%%d of %d lines were too long.
%d < %sN)rrr�appendZfail)r
Zfailuresrrrr�test_lineLength>szWrapTests.test_lineLengthcCs*d}t�||j�}|�|ddddg�dS)z7
        Allow paragraphs delimited by two 
s.
        zet

phone
home.�et�zphone home.N)rrrr)r
r�resultrrr�test_doubleNewlineLszWrapTests.test_doubleNewlineN)	�__name__�
__module__�__qualname__�__doc__rrrrrrrrrrs

rc@s eZdZdZdd�Zdd�ZdS)�	LineTestsz8
    Tests for L{isMultiline} and L{endsInNewline}.
    cCs4d}t�|�}|�|�d}t�|�}|�|�dS)zX
        L{text.isMultiline} returns C{True} if the string has a newline in it.
        zThis code
 "breaks."zThis code does not "break."N)rZisMultiliner�assertFalse)r
�s�mrrr�test_isMultilineZs


zLineTests.test_isMultilinecCs4d}t�|�}|�|�d}t�|�}|�|�dS)zX
        L{text.endsInNewline} returns C{True} if the string ends in a newline.
        znewline
ZoldlineN)rZ
endsInNewlinerr$)r
r%r&rrr�test_endsInNewlinegs


zLineTests.test_endsInNewlineN)rr r!r"r'r(rrrrr#Vs
r#c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�StringyStringTestsz*
    Tests for L{text.stringyString}.
    cCsd}t�|�}|�|d�dS)zA
        Tuple elements are displayed on separate lines.
        )�a�bz	(a,
 b,)
N)r�
stringyStringr)r
r%r&rrr�
test_tupleys
zStringyStringTests.test_tuplecCs"ddi}t�|�}|�|d�dS)z>
        Dicts elements are displayed using C{str()}.
        r*rz{a: 0}N)rr,r)r
r%r&rrr�	test_dict�s
zStringyStringTests.test_dictcCs"ddg}t�|�}|�|d�dS)zO
        List elements are displayed on separate lines using C{str()}.
        r*r+z	[a,
 b,]
N)rr,r)r
r%r&rrr�	test_list�s
zStringyStringTests.test_listN)rr r!r"r-r.r/rrrrr)us		r)c@s eZdZdZdd�Zdd�ZdS)�
SplitTestsz(
    Tests for L{text.splitQuoted}.
    cCs$d}t�|�}|�dddg|�dS)z:
        Splitting strings with one-word phrases.
        zThis code "works."ZThis�codezworks.N)r�splitQuotedr)r
r%�rrrr�test_oneWord�s
zSplitTests.test_oneWordcCs&d}t�|�}|�ddddg|�dS)NzThe "hairy monkey" likes pie.ZThezhairy monkeyZlikeszpie.)rr2r)r
r%r3rrr�test_multiWord�s
zSplitTests.test_multiWordN)rr r!r"r4r5rrrrr0�s	r0c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�StrFileTestscCstd�|_dS)Nzthis is a test string)�StringIO�io)r
rrrr�szStrFileTests.setUpcCsdS)Nr)r
rrr�tearDown�szStrFileTests.tearDowncCs|�t�d|j��dS)N�x)r$r�strFiler8)r
rrr�test_1_f�szStrFileTests.test_1_fcCs|�t�d|j��dS)N�t)rrr;r8)r
rrr�test_1_1�szStrFileTests.test_1_1cCs|�t�d|j��dS)N�h)rrr;r8)r
rrr�test_1_2�szStrFileTests.test_1_2cCs|�t�d|j��dS)N�i)rrr;r8)r
rrr�test_1_3�szStrFileTests.test_1_3cCs|�t�d|j��dS)Nr%)rrr;r8)r
rrr�test_1_4�szStrFileTests.test_1_4cCs|�t�d|j��dS)N�n)rrr;r8)r
rrr�test_1_5�szStrFileTests.test_1_5cCs|�t�d|j��dS)N�g)rrr;r8)r
rrr�test_1_6�szStrFileTests.test_1_6cCs|�t�d|j��dS)NZthi)rrr;r8)r
rrr�test_3_1�szStrFileTests.test_3_1cCs|�t�d|j��dS)NZhis)rrr;r8)r
rrr�test_3_2�szStrFileTests.test_3_2cCs|�t�d|j��dS)Nzis )rrr;r8)r
rrr�test_3_3�szStrFileTests.test_3_3cCs|�t�d|j��dS)NZing)rrr;r8)r
rrr�test_3_4�szStrFileTests.test_3_4cCs|�t�d|j��dS)NZbla)r$rr;r8)r
rrr�test_3_f�szStrFileTests.test_3_fcCs|�t�d|j��dS)Nzthis is a test)rrr;r8)r
rrr�test_large_1�szStrFileTests.test_large_1cCs|�t�d|j��dS)Nzis a test string)rrr;r8)r
rrr�test_large_2�szStrFileTests.test_large_2cCs|�t�d|j��dS)Nzds jhfsa k fdas)r$rr;r8)r
rrr�test_large_f�szStrFileTests.test_large_fcCs|�t�d|j��dS)Nz-djhsakj dhsa fkhsa s,mdbnfsauiw bndasdf hreew)r$rr;r8)r
rrr�test_overlarge_f�szStrFileTests.test_overlarge_fcCs|�t�d|j��dS)Nzthis is a test string)rrr;r8)r
rrr�	test_self�szStrFileTests.test_selfcCs|�t�d|jd��dS)NzThIs is A test STRINGF)rrr;r8)r
rrr�test_insensitive�szStrFileTests.test_insensitiveN)rr r!rr9r<r>r@rBrCrErGrHrIrJrKrLrMrNrOrPrQrRrrrrr6�s(r6N)r"Ztwisted.python.compatrr7Z
twisted.trialrZtwisted.pythonrrZTestCaserr#r)r0r6rrrr�<module>s< !