← Back
Editing: test_text.cpython-38.pyc
U W[g � @ s: d dl mZ d dlmZ d dlmZ G dd� dej�ZdS )� )�unittest)�text)� attributesc @ sX e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� ZdS )�FormattedTextTestsz. Tests for assembling formatted text. c C s | � t�tjd �d� dS )zu Using no formatting attributes produces no VT102 control sequences in the flattened output. � Hello, world.N)�assertEqualr �assembleFormattedText�A�normal��self� r �>/usr/lib/python3/dist-packages/twisted/conch/test/test_text.py�test_trivial s �zFormattedTextTests.test_trivialc C s | � t�tjd �d� dS )z� The bold formatting attribute, L{A.bold}, emits the VT102 control sequence to enable bold when flattened. r z[1mHello, world.N)r r r r �boldr r r r � test_bold s �zFormattedTextTests.test_boldc C s | � t�tjd �d� dS )z� The underline formatting attribute, L{A.underline}, emits the VT102 control sequence to enable underlining when flattened. r z[4mHello, world.N)r r r r Z underliner r r r �test_underline$ s �z!FormattedTextTests.test_underlinec C s | � t�tjd �d� dS )z� The blink formatting attribute, L{A.blink}, emits the VT102 control sequence to enable blinking when flattened. r z[5mHello, world.N)r r r r �blinkr r r r � test_blink. s �zFormattedTextTests.test_blinkc C s | � t�tjd �d� dS )z� The reverse-video formatting attribute, L{A.reverseVideo}, emits the VT102 control sequence to enable reversed video when flattened. r z[7mHello, world.N)r r r r ZreverseVideor r r r �test_reverseVideo8 s �z$FormattedTextTests.test_reverseVideoc C s0 | � t�tjtjdtjd df �d� dS )z� Formatting attributes prefixed with a minus (C{-}) temporarily disable the prefixed attribute, emitting no VT102 control sequence to enable it in the flattened output. ZHelloz world�.z[1;5mHello[0;5m world[1;5m.N)r r r r r r r r r r � test_minusB s ��zFormattedTextTests.test_minusc C s0 | � t�tjtjjd tjjd f �d� dS )z� The foreground color formatting attribute, L{A.fg}, emits the VT102 control sequence to set the selected foreground color when flattened. �Hello, �world!z[31mHello, [32mworld!N)r r r r r Zfg�red�greenr r r r �test_foregroundN s ��z"FormattedTextTests.test_foregroundc C s0 | � t�tjtjjd tjjd f �d� dS )z� The background color formatting attribute, L{A.bg}, emits the VT102 control sequence to set the selected background color when flattened. r r z[41mHello, [42mworld!N)r r r r r Zbgr r r r r r �test_backgroundY s ��z"FormattedTextTests.test_backgroundc C sn | � | jg�}| �t|�d� tj | � | jg�}| �t|�d� | �|d d t� | �|d d d� dS )zv L{twisted.conch.insults.text.flatten} emits a deprecation warning when imported or accessed. r � �category�messagez�twisted.conch.insults.text.flatten was deprecated in Twisted 13.1.0: Use twisted.conch.insults.text.assembleFormattedText instead.N)Z flushWarnings�test_flattenDeprecatedr �lenr Zflatten�DeprecationWarning)r Z warningsShownr r r r! d s �z)FormattedTextTests.test_flattenDeprecatedN) �__name__� __module__�__qualname__�__doc__r r r r r r r r r! r r r r r s r N) Z twisted.trialr Ztwisted.conch.insultsr Ztwisted.conch.insults.textr r ZTestCaser r r r r �<module> s
Save File
Cancel