Format: application/x-python-code
⬇ Download File (3.0 KB)
   1  o
   2  
   3  ��h��@s`dZddlZddlZddlZddlmZddlmZddlm	Z	dZ
   4  dZdd	�Zed
   5  d��Z
   6  dS)zTest embedding of IPython�N)�NamedFileInTemporaryDirectory)�
   7  skip_win32)�IPYTHON_TESTING_TIMEOUT_SCALEsO
   8  import IPython
   9  
  10  a = 3
  11  b = 14
  12  print(a, '.', b)
  13  
  14  IPython.embed()
  15  
  16  print('bye!')
  17  sexit
  18  cCs�td��\}|�t�|��|��tj|jg}tj	�
  19  �}d|d<tj||tj
  20  tj
  21  tj
  22  d�}|�t�\}}|�d�}|jdksAJ�d|vsGJ�tjdkrRd	|vsRJ�d
  23  |vsXJ�Wd�dS1scwYdS)z!test that `IPython.embed()` workszfile_with_embed.py�1�IPY_TEST_SIMPLE_PROMPT)�env�stdin�stdout�stderrzUTF-8rz3 . 14�nt�IPythonzbye!N)r�write�
  24  _sample_embed�flush�close�sys�
  25  executable�name�os�environ�copy�
  26  subprocess�Popen�PIPE�communicate�_exit�decode�
  27  returncode)�f�cmdr�p�out�errZstd�r#�Wc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/terminal/tests/test_embed.py�test_ipython_embed)s$
  28  
  29  
  30  �
  31  
  32  "�r%c
  33  Cs�ddl}d}tj��}d|d<|jtjgd�|d�}dt|_|�	|�d	t|_|�
  34  d
  35  �|�	|�|�
  36  d�|�
  37  d�zd
  38  }|dkrO|�	|dg�}|dksDWn|jyg}z
  39  t|�WYd}~nd}~ww|�
  40  d�|�	|�|�
  41  d�|�	ddg�dks�J�|�	|�|�
  42  d�|�	ddg�dks�J�|�	|�|�
  43  d�zd
  44  }|dkr�|�	|dg�}|dks�Wn|jy�}z
  45  t|�WYd}~nd}~ww|�
  46  d�|�	|�|�
  47  d�|�	ddg�dks�J�|�	|�|�
  48  d�|�	ddg�dks�J�|�	|�|�
  49  d�|�	|�|�
  50  d�|�	ddg�dk�sJ�|�	|�|�
  51  d�|�	ddg�dk�s1J�|�	|�|�
  52  d�|�	|�|�
  53  d�|�	ddg�dk�sQJ�|�	|�|�
  54  d�|�	ddg�dk�sgJ�|�	|�|�
  55  d�|�
  56  �dS)z'test that `IPython.embed()` is nestablerNz]:rr)z-mrz--colors=nocolor)r��zimport IPythonzip0 = get_ipython()zIPython.embed()�����z
  57  zembed1 = get_ipython()z/print('true' if embed1 is not ip0 else 'false')ztrue
  58  zfalse
  59  z=print('true' if IPython.get_ipython() is embed1 else 'false')zembed2 = get_ipython()z2print('true' if embed2 is not embed1 else 'false')z=print('true' if embed2 is IPython.get_ipython() else 'false')�exitz5print('true' if get_ipython() is embed1 else 'false')z2print('true' if get_ipython() is ip0 else 'false')z:print('true' if IPython.get_ipython() is ip0 else 'false'))�pexpectrrrZspawnrrr�timeout�expectZsendline�TIMEOUT�printr)r*Z
  60  ipy_promptr�childZprompted�er#r#r$�test_nest_embedBs�
  61  �
  62  
  63  
  64  
  65  
  66  
  67  
  68  ����
  69  
  70  
  71  
  72  
  73  
  74  
  75  ����
  76  
  77  
  78  
  79  
  80  
  81  
  82  
  83  
  84  
  85  
  86  
  87  
  88  
  89  
  90  
  91  
  92  
  93  
  94  r1)�__doc__rrrZIPython.utils.tempdirrZIPython.testing.decoratorsrZIPython.testingrrrr%r1r#r#r#r$�<module>s
  95