o
    ¯bµ  ã                   @   s:   d dl mZ d dlmZ d dlmZ G dd„ dejƒZdS )é    )Útext)Ú
attributes)Úunittestc                   @   sX   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )ÚFormattedTextTestsz.
    Tests for assembling formatted text.
    c                 C   s   |   t tjd ¡d¡ dS )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   ó   ÿzFormattedTextTests.test_trivialc                 C   ó   |   t tjd ¡d¡ dS )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   r   zFormattedTextTests.test_boldc                 C   r   )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	   Ú	underliner   r   r   r   Útest_underline!   ó   þz!FormattedTextTests.test_underlinec                 C   r   )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+   r   zFormattedTextTests.test_blinkc                 C   r   )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	   ÚreverseVideor   r   r   r   Útest_reverseVideo4   r   z$FormattedTextTests.test_reverseVideoc              	   C   s0   |   t tjtjdtjd  df  ¡d¡ dS )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.
        ÚHelloz worldÚ.z[1;5mHello[0;5m world[1;5m.N)r   r   r   r	   r   r   r   r   r   r   Ú
test_minus>   s   ÿüzFormattedTextTests.test_minusc                 C   ó0   |   t tjtjjd tjjd f ¡d¡ dS )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
   ÚfgÚredÚgreenr   r   r   r   Útest_foregroundK   ó   ÿüz"FormattedTextTests.test_foregroundc                 C   r   )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
   Úbgr"   r#   r   r   r   r   Útest_backgroundW   r%   z"FormattedTextTests.test_backgroundc                 C   sn   |   | jg¡}|  t|ƒd¡ tj |   | jg¡}|  t|ƒd¡ |  |d d t¡ |  |d d d¡ dS )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)ÚflushWarningsÚtest_flattenDeprecatedr   Úlenr   ÚflattenÚDeprecationWarning)r   ÚwarningsShownr   r   r   r,   c   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)	Útwisted.conch.insultsr   Útwisted.conch.insults.textr   r	   Útwisted.trialr   ÚTestCaser   r   r   r   r   Ú<module>   s   