
    }e                     0    d dl mZ d dlZd Zd Zd Zd Zy)    )capture_outputNc                     d} d}t         j                  }|j                          |j                  | |       |j	                  |       sJ |j                  |       |k(  sJ | |f|j                  v sJ t         j                  }g }|j                  t         _        	 t         j                  dj                  |              |D cg c]  }|j                          }}||gk(  sJ 	 |t         _        |j                  |        |j	                  |       rJ t        j                  t              5  |j                  |        d d d        | |f|j                  vsJ y c c}w # |t         _        w xY w# 1 sw Y   1xY w)Ntest_alias1zecho "Hello"z%{})_ipalias_managerclear_aliasesdefine_aliasis_aliasretrieve_aliasaliasessystemappendrun_cellformatstripundefine_aliaspytestraises
ValueError)namecmdamorig_systemresultcs         ?/usr/lib/python3/dist-packages/IPython/core/tests/test_alias.pytest_alias_lifecycler      sL   D
C			BOOD#;;tT"c)))#;"**$$$ **KFCJ!U\\$'(%+,!''),,# 
 d{{4   	z	"  
$ #;bjj((( - !

   s*   (E E
E ,E.E E+.E7c                      t         j                  j                  dd       t               5 } t         j	                  d       ddd        j
                  j                  d      d   dk(  sJ y# 1 sw Y   -xY w)z.Error expanding with wrong number of argumentspartszecho first %s second %szparts 1N:r   
UsageError)r   r   r	   r   r   stderrsplitcaps    r   test_alias_args_errorr&   "   sf    ""7,EF		  SY  ::C #|333   s   A--A6c                      t         j                  dd       t               5 } t         j                  d       ddd        j                  j                         dk(  sJ y# 1 sw Y   )xY w)z7Check that alias correctly ignores 'commented out' argsaliasz/commentarg echo this is %%s a commented out arg
commentargNzthis is %s a commented out arg)r   run_line_magicr   r   stdoutr   r$   s    r   test_alias_args_commentedr,   ,   sZ    w QR		 #S\"# ::"BBBB# #s   AA(c                      t         j                  } d}d}| j                  ||       | j                  |      sJ | j	                  |      }|j
                  dk(  sJ y)zECheck that alias correctly counts args, excluding those commented outcomargcountz7echo this is %%s a commented out arg and this is not %s   N)r   r   r	   r
   	get_aliasnargs)r   
alias_namer   thealiass       r   test_alias_args_commented_nargsr4   8   sW    			BJ
CCOOJ$;;z"""||J'H>>Q    )IPython.utils.capturer   r   r   r&   r,   r4    r5   r   <module>r8      s     0 ):4
C
r5   