
    Vh                     R    d dl mZ d dlmZ d dlmZ  G d dej                        Zy)    )text)
attributes)unittestc                   X    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y)FormattedTextTestsz.
    Tests for assembling formatted text.
    Nc                 p    | j                  t        j                  t        j                  d         d       y)zu
        Using no formatting attributes produces no VT102 control sequences in
        the flattened output.
        Hello, world.N)assertEqualr   assembleFormattedTextAnormalselfs    L/home/dcms/DCMS/lib/python3.12/site-packages/twisted/conch/test/test_text.pytest_trivialzFormattedTextTests.test_trivial   s+    
 	&&qxx'@A?	
    c                 p    | j                  t        j                  t        j                  d         d       y)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   s    r   	test_boldzFormattedTextTests.test_bold   s,    
 	&&qvvo'>?AW	
r   c                 p    | j                  t        j                  t        j                  d         d       y)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   s    r   test_underlinez!FormattedTextTests.test_underline!   s,    
 	&&q{{?'CD"	
r   c                 p    | j                  t        j                  t        j                  d         d       y)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   s    r   
test_blinkzFormattedTextTests.test_blink+   s,    
 	&&qww'?@BX	
r   c                 p    | j                  t        j                  t        j                  d         d       y)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   s    r   test_reverseVideoz$FormattedTextTests.test_reverseVideo4   s,    
 	&&q~~o'FG"	
r   c           	          | j                  t        j                  t        j                  t        j
                  dt        j                  d    df            d       y)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   s    r   
test_minuszFormattedTextTests.test_minus>   sM     	&&qwww)9(93>?@ 6		
r   c                     | j                  t        j                  t        j                  t        j
                  j                  d   t        j
                  j                  d   f         d       y)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   s    r   test_foregroundz"FormattedTextTests.test_foregroundK   P    
 	&&),addjj.BBC ,		
r   c                     | j                  t        j                  t        j                  t        j
                  j                  d   t        j
                  j                  d   f         d       y)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   s    r   test_backgroundz"FormattedTextTests.test_backgroundW   r*   r   c                 h   | j                  | j                  g      }| j                  t        |      d       t        j
                   | j                  | j                  g      }| j                  t        |      d       | j                  |d   d   t               | j                  |d   d   d       y)zv
        L{twisted.conch.insults.text.flatten} emits a deprecation warning when
        imported or accessed.
        r      categorymessageztwisted.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   warningsShowns     r   r3   z)FormattedTextTests.test_flattenDeprecatedc   s    
 **D,G,G+HI]+Q/ 	**D,G,G+HI]+Q/q)*57IJ!Y'	
r   )returnN)__name__
__module____qualname____doc__r   r   r   r   r   r"   r)   r-   r3    r   r   r   r   
   s4    










r   r   N)	twisted.conch.insultsr   twisted.conch.insults.textr   r   twisted.trialr   TestCaser   r=   r   r   <module>rB      s$   
 ' 6 "l
** l
r   