+
    Dfjs}                     F   ^ RI t ^ RIHtHt ^ RIHtHt ^ RIHtH	t	H
t
HtHtHtHtHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt R	 tR
 tR tR t ]!! 4       t"R t#R t$]$! R^. RCO. RDO. REO. RFO. RGO. RHO. RIO. RJO. RKO. RLO. RMO. RNO. ROO. RPO. RQO. RRO.] PJ                  ! R4      R7      t&]$! R^RR.RR.RR.RR.RR.RR.RR.RR.R R!.R"R.R#R$.R%R&.R'R(.R)R*.R+R,.R-R...] PJ                  ! R/4      R7      t' ! R0 R14      t( ! R2 R34      t)R4t* ! R5 R6])4      t+A* ! R7 R8]+]PX                  4      t- ! R9 R:]+]PX                  4      t. ! R; R<]+]PX                  4      t/ ! R= R>]+]PX                  4      t0 ! R? R@]PX                  ])4      t1 ! RA RB]PX                  4      t2R# )S    N)OptionalType)ValueConstantValues)BLINKCS_ALTERNATECS_ALTERNATE_SPECIAL
CS_DRAWINGCS_UKCS_USG0G1	UNDERLINEClientProtocolServerProtocolmodesprivateModes)Protocol)StringTransport)	iterbytes)unittestc                 (    \         \        V `  V4      # N)superMock__getattribute__)mocknames   &&A/usr/lib/python3/dist-packages/twisted/conch/test/test_insults.py_getattrr       s    t-d33    c                     \        V R 4      # )occurrencesr    r   s   &r   r#   r#   #   s    D-((r!   c                     \        V R 4      # )methodsr$   r%   s   &r   r'   r'   '   s    D)$$r!   c                 :    \        V 4      P                  V4       R # r   )r#   append)r   objs   &&r   _appendr+   +   s    S!r!   c                H    \        \        V ^,          V,          .4      4      # )a  
Return the byte in 7- or 8-bit code table identified by C{column}
and C{row}.

"An 8-bit code table consists of 256 positions arranged in 16
columns and 16 rows.  The columns and rows are numbered 00 to 15."

"A 7-bit code table consists of 128 positions arranged in 8
columns and 16 rows.  The columns are numbered 00 to 07 and the
rows 00 to 15 (see figure 1)."

p.5 of "Standard ECMA-35: Character Code Structure and Extension
Techniques", 6th Edition (December 1994).
)bytes	bytearray)columnrows   &&r   _ecmaCodeTableCoordinater1   2   s     " Vq[C/0122r!   c                     \        V4       UUUU u/ uF?  w  rE\        V4       F+  w  r`V '       g   K  V \        \        Wa,           V4      4      bK-  	  KA  	  ppppp W7R &   \        X \        3V4      # u up pppi )__doc__)	enumerater   r1   typer   )r   	colOffsetnamesdocjr0   iattrss   &&&&    r   _makeControlFunctionSymbolsr<   F   sx      &&FA ~GA 	Hm4Q]AFGG% 	& 
  )vi''s
   A1
$A1
CSFinalByteaW  
    Symbolic constants for all control sequence final bytes
    that do not imply intermediate bytes.  This happens to cover
    movement control sequences.

    See page 11 of "Standard ECMA 48: Control Functions for Coded
    Character Sets", 5th Edition (June 1991).

    Each L{ValueConstant} maps a control sequence name to L{bytes}
    )r6   r7   r8   
C1SevenBitDCSPU1BPHPU2NBHSTSCCHNELMWSSASPAESAEPAHTSSOSHTJVTSSCIPLDCSIPLUSTRIOSCSS2PMSS3APCa   
    Symbolic constants for all 7 bit versions of the C1 control functions

    See page 9 "Standard ECMA 48: Control Functions for Coded
    Character Sets", 5th Edition (June 1991).

    Each L{ValueConstant} maps a control sequence name to L{bytes}
    c                   >   a  ] tR t^t o ]tR]3R ltR tR tRt	V t
R# )r   Nc                P    . V n         Vf   / pWn        V\        Jd	   W n        R# R# )zi
@param methods: Mapping of names to return values
@param callReturnValue: object __call__ should return
N)r#   r'   defaultcallReturnValue)selfr'   r^   s   &&&r   __init__Mock.__init__   s.    
 ?G')#2  *r!   c                d    \        V R 4      pV\        J d   \        4       p\        V RW1V34       V# )r^   __call__)r    r]   r   r+   )r_   akwreturnValues   &*, r   rc   Mock.__call__   s5    t%67'!&Kz;267r!   c                ~    \        V R 4      pW9   d   \        W!,          R7      pM
\        4       p\        WV34       V# )r'   )r^   )r    r   r+   )r_   r   r'   	attrValues   &&  r   r   Mock.__getattribute__   s9    4+?W];IIY'(r!   )r^   r'   r#   )__name__
__module____qualname____firstlineno__r]   r^   r`   rc   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s#     O#W 
3 r!   r   c                   .   a  ] tR t^t o R/ 3R ltRtV tR# )	MockMixinc                    Vw  rVV P                  WR4       V P                  \        \        V4      4      ^4       \        V4      w  w  rxrV P                  VR4       V P                  W4       V P                  W4       V# )   rc   )assertEquallenr#   )r_   
occurrence
methodNameexpectedPositionalArgsexpectedKeywordArgsattrr   callresultargsre   s   &&&&&      r   
assertCallMockMixin.assertCall   sv      
*[./3%0%6"	!$z*61r!    N)rk   rl   rm   rn   r   ro   rp   rq   s   @r   rt   rt      s     =?UW
 
r!   rt   a  def testByte%(groupName)s(self):
    transport = StringTransport()
    proto = Mock()
    parser = self.protocolFactory(lambda: proto)
    parser.factory = self
    parser.makeConnection(transport)

    bytes = self.TEST_BYTES
    while bytes:
        chunk = bytes[:%(bytesPer)d]
        bytes = bytes[%(bytesPer)d:]
        parser.dataReceived(chunk)

    self.verifyResults(transport, proto, parser)
c                   x   a  ] tR t^t o RtR F  w  tt]! ]R]R]/,          4       K  	  AAR t	V 3R lt
RtV tR# )ByteGroupingsMixinN	groupNamebytesPerc                    V P                  \        V4      P                  ^ 4      RV34      pV P                  \        V4      . 4       R# )r   makeConnectionN)r   r#   poprw   )r_   	transportprotoparserr   s   &&&& r   verifyResults ByteGroupingsMixin.verifyResults   s<    U!3!7!7!:<LviXV,b1r!   c                F   < V ^8  d   Qh/ S[ S[S[,          ,          ;R&   # )   protocolFactory)r   r   r   )formatrr   s   "r   __annotate__ByteGroupingsMixin.__annotate__   s     d8n-4 r!   r   ))Pairsr   )Triples   )Quads   )Quints   )Sexes   )rk   rl   rm   rn   r   wordnexec_byteGroupingTestTemplater   __annotate_func__ro   rp   rq   s   @r   r   r      sF     04Oa 	&+tZ)KKL 	a2  r!   r   c                   .   a  ] tR t^t o ]tRtR tRtV t	R# )ServerArrowKeysTestss   [A[B[C[Dc                `   \         P                  WW#4       VP                  VP                  VP                  VP
                  3 FK  pV P                  \        V4      P                  ^ 4      RVR34      pV P                  \        V4      . 4       KM  	  V P                  \        V4      4       R# )r   keystrokeReceivedN)r   r   UP_ARROW
DOWN_ARROWRIGHT_ARROW
LEFT_ARROWr   r#   r   rw   assertFalse)r_   r   r   r   arrowr   s   &&&&  r   r   "ServerArrowKeysTests.verifyResults   s    ((%H OO	
E __E"&&q)+>F [0"5
 	U+,r!   r   N
rk   rl   rm   rn   r   r   
TEST_BYTESr   ro   rp   rq   s   @r   r   r      s     $O -J- -r!   r   c                   .   a  ] tR tRt o ]tRtR tRtV t	R# )PrintableCharactersTestsi	  s   abc123ABC!@#abc123c                   \         P                  WW#4       \        R 4       FK  pV P                  \	        V4      P                  ^ 4      RVR34      pV P                  \	        V4      . 4       KM  	  \        R4       FT  pV P                  \	        V4      P                  ^ 4      RWCP                  34      pV P                  \	        V4      . 4       KV  	  \	        V4      pV P                  Wf: R24       R# )s   abc123ABC!@#r   Ns   abc123z should have been [])	r   r   r   r   r#   r   rw   ALTr   )r_   r   r   r   charr   occss   &&&&   r   r   &PrintableCharactersTests.verifyResults  s    ((%Ho.D__E"&&q)+>tF [0"5	 / i(D__E"&&q)+>zz@RF [0"5	 ) 5!)=>?r!   r   Nr   rq   s   @r   r   r   	  s     $O
 ?J@ @r!   r   c                      a  ] tR tRt o Rt]t. tR F  t]P                  R],           4       K  	  RP                  ]4      tAAR tRtV tR# )	ServerFunctionKeysTestsi$  z9Test for parsing and dispatching function keys (F1 - F12)   [r!   c                D   \         P                  WW#4       \        ^^4       F_  p\        VRV3,          4      pV P	                  \        V4      P                  ^ 4      RVR34      pV P                  \        V4      . 4       Ka  	  V P                  \        V4      4       R# )rv   zF%dr   N)	r   r   rangegetattrr   r#   r   rw   r   )r_   r   r   r   funcNumfuncArgr   s   &&&&   r   r   %ServerFunctionKeysTests.verifyResults<  s    ((%HQ|Gfewj&89G__E"&&q)+>$F [0"5 $ 	U+,r!   r   N)s   OPs   OQs   ORs   OSs   15~s   17~s   18~s   19~s   20~s   21~s   23~s   24~)rk   rl   rm   rn   r3   r   r   byteList	byteCodesr)   joinr   r   ro   rp   rq   s   @r   r   r   $  sP     C$OH	 	9,- (#J)- -r!   r   c                      a  ] tR tRt o ]tRtRtRtRt	]],           ],           ]	,           ],           ]	,           t
AAAA	R tRtV tR# )	ClientCursorMovementTestsiG  s   [2Bs   [4Cs   [As   [2Dc                   \         P                  WW#4       R FS  w  rEV P                  \        V4      P	                  ^ 4      RV,           V34      pV P                  \        V4      . 4       KU  	  V P                  \        V4      4       R# )DowncursorN))r   r   )Forwardr   Uprv   Backwardr   r   r   )r   r   r   r#   r   rw   r   )r_   r   r   r   methodcountr   s   &&&&   r   r   'ClientCursorMovementTests.verifyResultsR  sz    ((%H
MF __E"&&q)8f+<uhF [0"5
 	U+,r!   r   N)rk   rl   rm   rn   r   r   d2r4u1l2r   r   ro   rp   rq   s   @r   r   r   G  sM     $O	B	B	B	Bb2"R'",J
BB- -r!   r   c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )ClientControlSequencesTestsid  c                  a  \        4       S n        \        4       S n        \	        V 3R  l4      S n        S S P
                  n        S P
                  P                  S P                  4       S P                  \        S P                  4      P                  ^ 4      RS P
                  34      pS P                  \        V4      4       R# )c                     < S P                   # r   )r   r_   s   r   <lambda>3ClientControlSequencesTests.setUp.<locals>.<lambda>h  s	    TZZr!   r   N)r   r   r   r   r   r   factoryr   r   r#   r   r   )r_   r   s   f r   setUp!ClientControlSequencesTests.setUpe  s    (*V
$%78"""4>>2

#''*,<t{{n
 	V,-r!   c                r   V P                   P                  R P                  R \        R4       4       4      4       \	        V P
                  4      pR FP  pR FG  pV P                  VP                  ^ 4      RV,           V34      pV P                  \	        V4      4       KI  	  KR  	  V P                  V4       R# )r!   c              3   T   "   T F  pR F  pRV,           V,           x  K  	  K   	  R# 5i)r!   r   N)r!      2s   20s   200r   ).0chr   s   &  r   	<genexpr>BClientControlSequencesTests.testSimpleCardinals.<locals>.<genexpr>r  s0      ,B3A 1r!!3 ",s   &(s   BACDr   N)r   r   r   r   )rv   r         )	r   dataReceivedr   r   r#   r   r   r   r   )r_   r   methr   r   s   &    r   testSimpleCardinals/ClientControlSequencesTests.testSimpleCardinalsp  s      HH #G, 	
 4::&9D(!hoxP  V!45 ) : 	r!   c                x   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      RR4      pV P                  \        V4      4       V P	                  VP                  ^ 4      RR4      pV P                  \        V4      4       V P                  V4       R# )s
   [5;22r[rsetScrollRegionN)r      )NNr   r   r#   r   r   r   r   r_   r   r   s   &  r   testScrollRegion,ClientControlSequencesTests.testScrollRegion  s      !454::&!.?IV,-!.?NV,-r!   c                d   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      RR4      pV P                  \        V4      4       V P	                  VP                  ^ 4      RR4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   #3#4#5#6doubleHeightLinesingleWidthLinedoubleWidthLineN)T)Fr   r   s   &  r   testHeightAndWidth.ClientControlSequencesTests.testHeightAndWidth  s      !<=4::&!.@'JV,-!.@(KV,-!.?@V,-!.?@V,-r!   c                B   V P                   P                  R P                  \        R4       UUu. uF;  pR P                  \        R4       Uu. uF  pRV,           V,           NK  	  up4      NK=  	  upp4      4       \	        V P
                  4      p\        \        3 Fb  p\        \        \        \        \        3 F@  pV P                  VP                  ^ 4      RWT34      pV P                  \	        V4      4       KB  	  Kd  	  V P                  V4       R# u upi u uppi )r!   s   ()s   AB012   selectCharacterSetN)r   r   r   r   r#   r   r   r   r   r   r
   r   r	   r   r   r   )r_   gr   r   whichcharsetr   s   &      r   testCharacterSet,ClientControlSequencesTests.testCharacterSet  s      HH 'u-- HHy7JK7J!gkAoo7JKL-	
 4::&"XE$ HHQK!57G   V!45  	' Ls   DD%DDc                t   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   shiftInshiftOutNr   r   s   &  r   testShifting(ClientControlSequencesTests.testShifting  s      -4::&!i8V,-!j9V,-r!   c                t   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   NOsingleShift2singleShift3Nr   r   s   &  r   testSingleShifts,ClientControlSequencesTests.testSingleShifts  s      /4::&!n=V,-!n=V,-r!   c                t   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   =>applicationKeypadModenumericKeypadModeNr   r   s   &  r   testKeypadMode*ClientControlSequencesTests.testKeypadMode  s      /4::&!.EFV,-!.ABV,-r!   c                t   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   78
saveCursorrestoreCursorNr   r   s   &  r   
testCursor&ClientControlSequencesTests.testCursor  s      /4::&!l;V,-!o>V,-r!   c                    V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   cresetNr   r   s   &  r   	testReset%ClientControlSequencesTests.testReset  s[      *4::&!g6V,-r!   c                   V P                   P                  R 4       \        V P                  4      pV P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P	                  VP                  ^ 4      R4      pV P                  \        V4      4       V P                  V4       R# )s   DMEindexreverseIndexnextLineNr   r   s   &  r   	testIndex%ClientControlSequencesTests.testIndex  s      !344::&!g6V,-!n=V,-!j9V,-r!   c           	        V P                   P                  R RP                  R \        P                  \        P
                  \        P                  3 4       4      ,           R,           4       V P                   P                  R RP                  R \        P                  \        P
                  \        P                  3 4       4      ,           R,           4       \        V P                  4      pV P                  VP                  ^ 4      R\        P                  \        P
                  \        P                  .34      pV P                  \        V4      4       V P                  VP                  ^ 4      R\        P                  \        P
                  \        P                  .34      pV P                  \        V4      4       V P                  V4       R# )	r      ;c              3   6   "   T F  pR V3,          x  K  	  R# 5is   %dNr   r   ms   & r   r   8ClientControlSequencesTests.testModes.<locals>.<genexpr>       P.O.O      hc              3   6   "   T F  pR V3,          x  K  	  R# 5ir"  r   r#  s   & r   r   r%    r&  r'     lsetModes
resetModesN)r   r   r   r   KAMIRMLNMr#   r   r   r   r   r   s   &  r   	testModes%ClientControlSequencesTests.testModes  sB     iiPuyy%))UYY.OPPQ	

 	  iiPuyy%))UYY.OPPQ	

 4::&HHQKuyy%))UYY&G%I
 	V,-HHQKEIIuyy(I'K
 	V,-r!   c                   V P                   P                  R 4       \        V P                  4      pR F>  pV P	                  VP                  ^ 4      V4      pV P                  \        V4      4       K@  	  V P	                  VP                  ^ 4      RR4      pV P                  \        V4      4       V P                  V4       R# )s   [K[1K[2K[J[1J[2J[3PdeleteCharacterN)eraseToLineEnderaseToLineBeginning	eraseLineeraseToDisplayEnderaseToDisplayBeginningeraseDisplay)r   r   )r_   r   r   r   s   &   r   testErasure'ClientControlSequencesTests.testErasure  s      !ST4::&
D __TXXa[$7F[01
 !.?FV,-r!   c                   V P                   P                  R 4       \        V P                  4      pR F@  pV P	                  VP                  ^ 4      RV34      pV P                  \        V4      4       KB  	  V P                  V4       R# )s   [M[3M
deleteLineNrv   r   r   r_   r   argr   s   &   r   testLineDeletion,ClientControlSequencesTests.testLineDeletion"  l      !124::&C__TXXa[,GF[01  	r!   c                   V P                   P                  R 4       \        V P                  4      pR F@  pV P	                  VP                  ^ 4      RV34      pV P                  \        V4      4       KB  	  V P                  V4       R# )s   [L[3L
insertLineNr>  r   r?  s   &   r   testLineInsertion-ClientControlSequencesTests.testLineInsertion+  rC  r!   c                P   R\        V P                  4      R&   V P                  P                  R4       V P	                  V P
                  P                  4       R4       \        V P                  4      pV P                  VP                  ^ 4      R4      pV P	                  VR4       R# )r   reportCursorPositions   [6ns   [7;8RN)r      )
r'   r   r   r   rw   r   valuer#   r   r   r   s   &  r   testCursorPosition.ClientControlSequencesTests.testCursorPosition4  s~    6<

23  ,--/>4::&!.DE 	(r!   c                $   \        V P                  4      pV P                  P                  R4       V P	                  VP                  ^ 4      RR4       V P                  P                  R4       V P	                  VP                  ^ 4      RR4       R# )z
Contiguous non-control bytes are passed to a single call to the
C{write} method of the terminal to which the L{ClientProtocol} is
connected.
   awrite   bcN)rO  )rQ  )r#   r   r   r   r   r   )r_   r   s   & r   test_applicationDataBytes5ClientControlSequencesTests.test_applicationDataBytes?  sf     4::&  &Wg6  'Wh7r!   c                
   \        V P                  4      pV P                  P                  V4       V'       d5   V P                  ! VP                  ^ 4      .VP                  ^ 4      O5!   K<  V P                  VRV: 24       R# )r   zNo other calls should happen: N)r#   r   r   r   r   r   r   )r_   datacallsr   s   &&& r   _applicationDataTest0ClientControlSequencesTests._applicationDataTestK  s^    4::&  &OODHHQK7%))A,7!?xHIr!   c                .    V P                  RRR.4       R# )z
Application data bytes followed by a shift-in command are passed to a
call to C{write} before the terminal's C{shiftIn} method is called.
s   abNrP  )s   ab)r  rW  r   s   &r    test_shiftInAfterApplicationData<ClientControlSequencesTests.test_shiftInAfterApplicationDataR  s    
 	!!).A<-PQr!   c                .    V P                  RRR.4       R# )z
Application data bytes followed by a shift-out command are passed to a
call to C{write} before the terminal's C{shiftOut} method is called.
s   abNrZ  )r  r[  r   s   &r   !test_shiftOutAfterApplicationData=ClientControlSequencesTests.test_shiftOutAfterApplicationDataY  s    
 	!!).A=-QRr!   c                .    V P                  RRR.4       R# )z
Application data bytes followed by a cursor-backward command are passed
to a call to C{write} before the terminal's C{cursorBackward} method is
called.
s   abNrZ  )cursorBackwardr[  r   s   &r   'test_cursorBackwardAfterApplicationDataCClientControlSequencesTests.test_cursorBackwardAfterApplicationData`  s     	!!).ACV-WXr!   c                ^    V P                  RRR.4       V P                  RRR^.33.4       R# )z
Application data bytes followed by an escape character are passed to a
call to C{write} before the terminal's handler method for the escape is
called.
s   abDs   ab[4hr+  NrZ  )r  r[  r   s   &r   test_escapeAfterApplicationData;ClientControlSequencesTests.test_escapeAfterApplicationDatah  s>     	!!*/BJ.OP 	!!.qcV0DE	
r!   )r   r   r   N)rk   rl   rm   rn   r   r   r   r   r   r  r	  r  r  r  r  r0  r:  rA  rF  rL  rR  rW  r\  r_  rc  rf  ro   rp   rq   s   @r   r   r   d  s|     	. 	"2				0&	)
8JRSY
 
r!   r   c                     a  ] tR tRt o Rt]! ^^4      t]]! ^^4      ,           tR tR t	R t
R tR tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R t#R t$R  t%R! t&R"t'V t(R## )$ServerProtocolOutputTestsiz  z\
Tests for the bytes L{ServerProtocol} writes to its transport when its
methods are called.
c                    \        4       V n        \        4       V n        V P                  P	                  V P                  4       R # r   )r   protocolr   r   r   r   s   &r   r   ServerProtocolOutputTests.setUp  s,    &((*$$T^^4r!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )zi
L{ServerProtocol.cursorUp} writes the control sequence
ending with L{CSFinalByte.CUU} to its transport.
   1N)rk  cursorUprw   r   rK  rR   r=   CUUr   s   &r   test_cursorUp'ServerProtocolOutputTests.test_cursorUp  sM    
 	q!NN  "DHHtOkoo6K6K$K	
r!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )zk
L{ServerProtocol.cursorDown} writes the control sequence
ending with L{CSFinalByte.CUD} to its transport.
rn  N)rk  
cursorDownrw   r   rK  rR   r=   CUDr   s   &r   test_cursorDown)ServerProtocolOutputTests.test_cursorDown  sM    
 	  #NN  "DHHtOkoo6K6K$K	
r!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )zn
L{ServerProtocol.cursorForward} writes the control sequence
ending with L{CSFinalByte.CUF} to its transport.
rn  N)rk  cursorForwardrw   r   rK  rR   r=   CUFr   s   &r   test_cursorForward,ServerProtocolOutputTests.test_cursorForward  sM    
 	##A&NN  "DHHtOkoo6K6K$K	
r!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )zo
L{ServerProtocol.cursorBackward} writes the control sequence
ending with L{CSFinalByte.CUB} to its transport.
rn  N)rk  rb  rw   r   rK  rR   r=   CUBr   s   &r   test_cursorBackward-ServerProtocolOutputTests.test_cursorBackward  sM    
 	$$Q'NN  "DHHtOkoo6K6K$K	
r!   c                    V P                   P                  ^ ^ 4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.cursorPosition} writes a control sequence
ending with L{CSFinalByte.CUP} and containing the expected
coordinates to its transport.
s   1;1N)rk  cursorPositionrw   r   rK  rR   r=   CUPr   s   &r   test_cursorPosition-ServerProtocolOutputTests.test_cursorPosition  sP     	$$Q*NN  "DHHv$58M8M$M	
r!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )z
L{ServerProtocol.cursorHome} writes a control sequence ending
with L{CSFinalByte.CUP} and no parameters, so that the client
defaults to (1, 1).
N)rk  
cursorHomerw   r   rK  rR   r=   r  r   s   &r   test_cursorHome)ServerProtocolOutputTests.test_cursorHome  sD     	  "--/KOO<Q<Q1QRr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        ^^4      ,           4       R# )z
L{ServerProtocol.index} writes the control sequence ending in
the 8-bit code table coordinates 4, 4.

Note that ECMA48 5th Edition removes C{IND}.
N)rk  r  rw   r   rK  ESCr1   r   s   &r   
test_index$ServerProtocolOutputTests.test_index  sE     	NN  "DHH/G1/M$M	
r!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )z\
L{ServerProtocol.reverseIndex} writes the control sequence
ending in the L{C1SevenBit.RI}.
N)rk  r  rw   r   rK  r  r>   rU   r   s   &r   test_reverseIndex+ServerProtocolOutputTests.test_reverseIndex  sD    
 	""$--/JMM<O<O1OPr!   c                    V P                   P                  4        V P                  V P                  P	                  4       R4       R# )zM
        L{ServerProtocol.nextLine} writes C{"
"} to its transport.
        s   
N)rk  r  rw   r   rK  r   s   &r   test_nextLine'ServerProtocolOutputTests.test_nextLine  s1     	 --/9r!   c                z   \         P                  \         P                  \         P                  .pV P                  P                  V4       V P                  V P                  P                  4       V P                  RP                  R V 4       4      ,           \        P                  P                  ,           4       R# )zz
L{ServerProtocol.setModes} writes a control sequence
containing the requested modes and ending in the
L{CSFinalByte.SM}.
r   c              3   6   "   T F  pR V3,          x  K  	  R# 5ir"  r   r#  s   & r   r   :ServerProtocolOutputTests.test_setModes.<locals>.<genexpr>       9jjr'  N)r   r-  r.  r/  rk  r+  rw   r   rK  rR   r   r=   SMr_   
modesToSets   & r   test_setModes'ServerProtocolOutputTests.test_setModes  s|     iiEII6
z*NN  "HHii9j99:nn""#	
r!   c                z   \         P                  \         P                  \         P                  .pV P                  P                  V4       V P                  V P                  P                  4       V P                  RP                  R V 4       4      ,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.setPrivatesModes} writes a control sequence
containing the requested private modes and ending in the
L{CSFinalByte.SM}.
r   c              3   6   "   T F  pR V3,          x  K  	  R# 5ir"  r   r#  s   & r   r   AServerProtocolOutputTests.test_setPrivateModes.<locals>.<genexpr>  s     @.?.?r'  N)r   ERRORCOLUMNORIGINrk  r+  rw   r   rK  rR   r   r=   r  )r_   privateModesToSets   & r   test_setPrivateModes.ServerProtocolOutputTests.test_setPrivateModes  s     

 	01NN  "HHii@.?@@Ann""#	
r!   c                z   \         P                  \         P                  \         P                  .pV P                  P                  V4       V P                  V P                  P                  4       V P                  RP                  R V 4       4      ,           \        P                  P                  ,           4       R# )z[
L{ServerProtocol.resetModes} writes the control sequence
ending in the L{CSFinalByte.RM}.
r   c              3   6   "   T F  pR V3,          x  K  	  R# 5ir"  r   r#  s   & r   r   <ServerProtocolOutputTests.test_resetModes.<locals>.<genexpr>  r  r'  N)r   r-  r.  r/  rk  r,  rw   r   rK  rR   r   r=   RMr  s   & r   test_resetModes)ServerProtocolOutputTests.test_resetModes  s|    
 iiEII6
  ,NN  "HHii9j99:nn""#	
r!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )zX
L{ServerProtocol.singleShift2} writes an escape sequence
followed by L{C1SevenBit.SS2}
N)rk  r  rw   r   rK  r  r>   rW   r   s   &r   test_singleShift2+ServerProtocolOutputTests.test_singleShift2  D    
 	""$--/JNN<P<P1PQr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )zX
L{ServerProtocol.singleShift3} writes an escape sequence
followed by L{C1SevenBit.SS3}
N)rk  r  rw   r   rK  r  r>   rY   r   s   &r   test_singleShift3+ServerProtocolOutputTests.test_singleShift3  r  r!   c                H   V P                   P                  \        \        4      \        \        4      4       V P                  V P                  P                  4       V P                  R\        \        3,          ,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.selectGraphicRendition} writes a control
sequence containing the requested attributes and ending with
L{CSFinalByte.SGR}
s   %d;%dN)rk  selectGraphicRenditionstrr   r   rw   r   rK  rR   r=   SGRr   s   &r   test_selectGraphicRendition5ServerProtocolOutputTests.test_selectGraphicRendition%  sc     	,,SZYHNN  "HHx5)"444{7L7LL	
r!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )zb
L{ServerProtocol.horizontalTabulationSet} writes the escape
sequence ending in L{C1SevenBit.HTS}
N)rk  horizontalTabulationSetrw   r   rK  r  r>   rL   r   s   &r   test_horizontalTabulationSet6ServerProtocolOutputTests.test_horizontalTabulationSet1  sD    
 	--/--/JNN<P<P1PQr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )z
L{ServerProtocol.eraseToLineEnd} writes the control sequence
sequence ending in L{CSFinalByte.EL} and no parameters,
forcing the client to default to 0 (from the active present
position's current location to the end of the line.)
N)rk  r4  rw   r   rK  rR   r=   ELr   s   &r   test_eraseToLineEnd-ServerProtocolOutputTests.test_eraseToLineEnd9  sD     	$$&--/KNN<P<P1PQr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.eraseToLineBeginning} writes the control
sequence sequence ending in L{CSFinalByte.EL} and a parameter
of 1 (from the beginning of the line up to and include the
active present position's current location.)
rn  N)rk  r5  rw   r   rK  rR   r=   r  r   s   &r   test_eraseToLineBeginning3ServerProtocolOutputTests.test_eraseToLineBeginningC  sH     	**,--/D;>>CWCW1WXr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.eraseLine} writes the control
sequence sequence ending in L{CSFinalByte.EL} and a parameter
of 2 (the entire line.)
r   N)rk  r6  rw   r   rK  rR   r=   r  r   s   &r   test_eraseLine(ServerProtocolOutputTests.test_eraseLineM  sH     	!--/D;>>CWCW1WXr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  \        P                  P                  ,           4       R# )z
L{ServerProtocol.eraseToDisplayEnd} writes the control
sequence sequence ending in L{CSFinalByte.ED} and no parameters,
forcing the client to default to 0 (from the active present
position's current location to the end of the page.)
N)rk  r7  rw   r   rK  rR   r=   EDr   s   &r   test_eraseToDisplayEnd0ServerProtocolOutputTests.test_eraseToDisplayEndV  sD     	'')--/KNN<P<P1PQr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.eraseToDisplayBeginning} writes the control
sequence sequence ending in L{CSFinalByte.ED} a parameter of 1
(from the beginning of the page up to and include the active
present position's current location.)
rn  N)rk  r8  rw   r   rK  rR   r=   r  r   s   &r   test_eraseToDisplayBeginning6ServerProtocolOutputTests.test_eraseToDisplayBeginning`  sH     	--/--/D;>>CWCW1WXr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.eraseDisplay} writes the control sequence
sequence ending in L{CSFinalByte.ED} a parameter of 2 (the
entire page)
r   N)rk  r9  rw   r   rK  rR   r=   r  r   s   &r   test_eraseToDisplay-ServerProtocolOutputTests.test_eraseToDisplayj  sH     	""$--/D;>>CWCW1WXr!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.deleteCharacter} writes the control sequence
containing the number of characters to delete and ending in
L{CSFinalByte.DCH}
   4N)rk  r3  rw   r   rK  rR   r=   DCHr   s   &r   test_deleteCharacter.ServerProtocolOutputTests.test_deleteCharacters  sM     	%%a(NN  "DHHtOkoo6K6K$K	
r!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.insertLine} writes the control sequence
containing the number of lines to insert and ending in
L{CSFinalByte.IL}
   5N)rk  rE  rw   r   rK  rR   r=   ILr   s   &r   test_insertLine)ServerProtocolOutputTests.test_insertLine~  J     	  #--/D;>>CWCW1WXr!   c                    V P                   P                  ^4       V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.deleteLine} writes the control sequence
containing the number of lines to delete and ending in
L{CSFinalByte.DL}
   6N)rk  r=  rw   r   rK  rR   r=   DLr   s   &r   test_deleteLine)ServerProtocolOutputTests.test_deleteLine  r  r!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  R,           R,           4       R# )z
With no arguments, L{ServerProtocol.setScrollRegion} writes a
control sequence with no parameters, but a parameter
separator, and ending in C{b'r'}.
r      rNrk  r   rw   r   rK  rR   r   s   &r   test_setScrollRegionNoArgs4ServerProtocolOutputTests.test_setScrollRegionNoArgs  s>     	%%'--/D41GHr!   c                    V P                   P                  ^R7       V P                  V P                  P	                  4       V P
                  R,           R,           4       R# )z
With just a value for its C{first} argument,
L{ServerProtocol.setScrollRegion} writes a control sequence with
that parameter, a parameter separator, and finally a C{b'r'}.
)firsts   1;r  Nr  r   s   &r   test_setScrollRegionJustFirst7ServerProtocolOutputTests.test_setScrollRegionJustFirst  sD     	%%A%.--/E1AD1HIr!   c                    V P                   P                  ^R7       V P                  V P                  P	                  4       V P
                  R,           R,           4       R# )z
With just a value for its C{last} argument,
L{ServerProtocol.setScrollRegion} writes a control sequence with
a parameter separator, that parameter, and finally a C{b'r'}.
)lasts   ;1r  Nr  r   s   &r   test_setScrollRegionJustLast6ServerProtocolOutputTests.test_setScrollRegionJustLast  sD     	%%1%---/E1AD1HIr!   c                    V P                   P                  ^^R7       V P                  V P                  P	                  4       V P
                  R,           R,           4       R# )z
When given both C{first} and C{last}
L{ServerProtocol.setScrollRegion} writes a control sequence with
the first parameter, a parameter separator, the last
parameter, and finally a C{b'r'}.
)r  r  s   1;2r  Nr  r   s   &r    test_setScrollRegionFirstAndLast:ServerProtocolOutputTests.test_setScrollRegionFirstAndLast  sF     	%%AA%6--/F1BT1IJr!   c                    V P                   P                  4        V P                  V P                  P	                  4       V P
                  R,           \        P                  P                  ,           4       R# )z
L{ServerProtocol.reportCursorPosition} writes a control
sequence ending in L{CSFinalByte.DSR} with a parameter of 6
(the Device Status Report returns the current active
position.)
r  N)rk  rI  rw   r   rK  rR   r=   DSRr   s   &r   test_reportCursorPosition3ServerProtocolOutputTests.test_reportCursorPosition  sK     	**,NN  "DHHtOkoo6K6K$K	
r!   )rk  r   N))rk   rl   rm   rn   r3   r1   r  rR   r   rq  rv  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  ro   rp   rq   s   @r   ri  ri  z  s      #1b
)C
(B/
/C5




	
S

Q:

&
RR

RRYYRYY	
YYIJJK

 

r!   ri  )ICHr  HPA)rp  SSEHPR)ru  CPRREP)rz  SUDA)r~  SDVPA)CNLNPVPR)CPLPPHVP)CHACTCTBC)r  ECHr  )CHTCVTMC)r  CBTHPB)r  SRSVPB)r  PTXr  )r  SDSr  )EFSIMDr  )EANDAQ)3textwraptypingr   r   
constantlyr   r   twisted.conch.insults.insultsr   r   r	   r
   r   r   r   r   r   r   r   r   r   twisted.internet.protocolr   twisted.internet.testingr   twisted.python.compatr   twisted.trialr   r    r#   r'   r+   objectr]   r1   r<   dedentr=   r>   r   rt   r   r   TestCaser   r   r   r   r   ri  r   r!   r   <module>r!     s  
  ! ,    / 4 + "4)%" (3(( * 	#& 				-"J )	u	u			u									u		!$ 				+
D D  $2 2$ --x/@/@ -,@183D3D @6 -0(2C2C  -F- 2H4E4E -:P
("3"3Y P
lE
 1 1 E
r!   