
    5\h                     
   	 d dl Z d dlZd dlZd dlZd dlZd dlmZ  G d de j                  Z G d dej	                  Z
d Zedk    r8d	ej        v r e                                             dS  ej                     dS dS )
    N)supportc                   L    e Zd Z	 d Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )samplecmdclassc                 $    t          d           d S )NzHello from preloopprintselfs    7/opt/python-3.11.14/usr/lib/python3.11/test/test_cmd.pypreloopzsamplecmdclass.preloop   s    "#####    c                 $    t          d           d S )NzHello from postloopr   r	   s    r   postloopzsamplecmdclass.postloop   s    #$$$$$r   c                 $    t          d           d S )Nz"This is the completedefault methodr   )r
   ignoreds     r   completedefaultzsamplecmdclass.completedefault   s    233333r   c                 $    t          d           d S )Nzcomplete commandr   r	   s    r   complete_commandzsamplecmdclass.complete_command   s     !!!!!r   c                     d S N )r
   ss     r   do_shellzsamplecmdclass.do_shell   s    r   c                    |                                 }t          |          dk    rt          d           d S 	 d |D             }n # t          $ r t          d           Y d S w xY wt          |d         |d         z              d S )N   z*** invalid number of argumentsc                 ,    g | ]}t          |          S r   )int).0is     r   
<listcomp>z)samplecmdclass.do_add.<locals>.<listcomp>   s    ###AQ###r   z*** arguments should be numbersr      )splitlenr   
ValueError)r
   r   ls      r   do_addzsamplecmdclass.do_add   s    GGIIq66Q;;3444F	#####AA 	 	 	3444FF	 	ad1Q4is   A A$#A$c                 $    t          d           d S )Nzhelp text for addr   r	   s    r   help_addzsamplecmdclass.help_add   s    !"""r   c                 $    t          d           d S )NzTry and be nice to people, avoid eating fat, read a good book every now and then, get some walking in, and try to live together in peace and harmony with people of all creeds and nations.r   r	   s    r   help_meaningzsamplecmdclass.help_meaning   s      2 	3 	3 	3 	r   c                 $    t          d           d S )Nz&Always look on the bright side of lifer   r	   s    r   	help_lifezsamplecmdclass.help_life   s    6777r   c                     dS NTr   )r
   args     r   do_exitzsamplecmdclass.do_exit   s    tr   N)__name__
__module____qualname__r   r   r   r   r   r&   r(   r*   r,   r0   r   r   r   r   r      s        EN$ $ $% % %4 4 4" " "  
 
 
          r   r   c                   \    e Zd Z G d dej                  Z G d de          Zd Zd ZdS )TestAlternateInputc                       e Zd Zd Zd ZdS )TestAlternateInput.simplecmdc                 2    t          || j                   d S )Nfiler   stdoutr
   argss     r   do_printz%TestAlternateInput.simplecmd.do_print   s    $T[))))))r   c                     dS r.   r   r=   s     r   do_EOFz#TestAlternateInput.simplecmd.do_EOF   s    4r   N)r1   r2   r3   r?   rA   r   r   r   	simplecmdr7      s2        	* 	* 	*	 	 	 	 	r   rB   c                       e Zd Zd ZdS )TestAlternateInput.simplecmd2c                 2    t          d| j                   dS )Nz*** Unknown syntax: EOFr9   Tr;   r=   s     r   rA   z$TestAlternateInput.simplecmd2.do_EOF   s    +$+>>>>4r   N)r1   r2   r3   rA   r   r   r   
simplecmd2rD      s#        	 	 	 	 	r   rF   c                     t          j        d          }t          j                    }|                     ||          }d|_         |j                     |                     |                                d           d S )Nprint test
print test2stdinr<   Fz(Cmd) test
(Cmd) test2
(Cmd) )ioStringIOrB   use_rawinputcmdloopassertMultiLineEqualgetvaluer
   inputoutputcmds       r   test_file_with_missing_final_nlz2TestAlternateInput.test_file_with_missing_final_nl   sz    566nn5n88 !!&//"3"3	 	 	 	 	r   c                    t          j        d          }t          j                    }|                     ||          }d|_         |j                     |                     |                                d           t          j        d          }t          j                    }||_        ||_         |j                     |                     |                                d           d S )NrH   rI   Fz5(Cmd) test
(Cmd) test2
(Cmd) *** Unknown syntax: EOF
zprint 

z,(Cmd) 
(Cmd) 
(Cmd) *** Unknown syntax: EOF
)	rK   rL   rF   rM   rN   rO   rP   rJ   r<   rQ   s       r   test_input_reset_at_EOFz*TestAlternateInput.test_input_reset_at_EOF   s    566ooE&o99 !!&//"3"3/	1 	1 	1 L))	
!!&//"3"3/	1 	1 	1 	1 	1r   N)	r1   r2   r3   rT   CmdrB   rF   rU   rW   r   r   r   r5   r5      s            CG       Y   	 	 	1 1 1 1 1r   r5   c                 R    |                     t          j                               |S r   )addTestdoctestDocTestSuite)loadertestspatterns      r   
load_testsr`      s"    	MM'&(()))Lr   __main__z-i)rT   sysr[   unittestrK   testr   rX   r   TestCaser5   r`   r1   argvrN   mainr   r   r   <module>rh      s   


 



   				      s s s s sSW s s sl01 01 01 01 01* 01 01 01f  
 zsx  """""	 r   