Format: application/x-python-code
⬇ Download File (4.1 KB)
   1  o
   2  
   3  ��h��@sdZddlZddlZddlmZedddddd	d
   4  �Zddd
   5  �Zdddd�iZddddddd�Z	ddiddiddiddiddiddid�Z
   6  dZdZej
   7  �de���dd ��Zd!d"�Zej
   8  �de���d#d$��Zej
   9  �de���d%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�ZdS)1zTests for IPython.utils.capture�N)�capture�	image/png�
  10  image/jpeg�
  11  image/svg+xml�	text/html�application/json�application/javascript)�
  12  _repr_png_�_repr_jpeg_�
  13  _repr_svg_�_repr_html_�_repr_json_�_repr_javascript_s
  14  binarydataz<b>bold</b>)rr�
  15  �)�width�heightz<svg>zalert();z{})rrrrrrZpng�existsZjpeg�svg�html�js�jsonz
  16  hello, stdoutz
  17  hello, stderr�method_mimecCs(t��}|\}}t||��dusJ�dS)zRichOutput with no argsN)r�
  18  RichOutput�getattr)r�rich�method�mime�r�Vc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/utils/tests/test_capture.py�test_rich_output_emptyEsr cCszt}t}tj||d�}|��|dksJ�|��|d|dfks#J�|��dus+J�|��dus3J�|��dus;J�dS)ztest RichOutput basics��data�metadatarrN)	�
  19  basic_data�basic_metadatarrrr	�_repr_latex_rr)r"r#rrrr�test_rich_outputLsr'cCs4t}tj|d�}|\}}t||��||ksJ�dS)z test RichOutput with no metadata�r"N)�	full_datarrr)rr"rrrrrr�test_rich_output_no_metadataXsr*cCsBt}t}tj||d�}|\}}t||��||||fksJ�dS)ztest RichOutput with metadatar!N)r)�
  20  full_metadatarrr)rr"r#rrrrrr�test_rich_output_metadataas
  21  $r,cCs�t}tj|d�}t���}|��Wd�n1swYt|j�dks)J�|jd}|j|jks6J�|j|jks>J�dS)z�test RichOutput.display
  22  
  23      This is a bit circular, because we are actually using the capture code we are testing
  24      to test itself.
  25      r(N�r)	r)rr�capture_output�display�len�outputsr"r#)r"r�capZrich2rrr�test_rich_output_displayjs
  26  
  27  �
  28  r3cCsxtjtd�}t���}ttdd�ttdtjd�|�	�Wd�n1s'wYt|j
  29  ks3J�t|jks:J�dS)zcapture_output worksr(���end�r6�fileN)rrr)r.�print�hello_stdout�hello_stderr�sys�stderrr/�stdout�rr2rrr�test_capture_outputys
  30  
  31  �r@cCs�tjtd�}tjdd��}ttdd�ttdtjd�|�	�Wd�n1s)wYd|j
  32  ks5J�t|jks<J�t|j�dksEJ�dS)	z!test capture_output(stdout=False)r(F)r>r4r5r7Nr-�
  33  rrr)r.r9r:r;r<r=r/r>r0r1r?rrr�test_capture_output_no_stdout�s
  34  �rBc	Cs�tjtd�}t���0tjdd��}ttdd�ttdtjd�|�	�Wd�n1s.wYWd�n1s=wYt|j
  35  ksIJ�d|jksPJ�t|j�dksYJ�dS)	z!test capture_output(stderr=False)r(F)r=r4r5r7Nr-rAr?rrr�test_capture_output_no_stderr�s
  36  ��rCcCs�tjtd�}tjdd��}ttdd�ttdtjd�|�	�Wd�n1s)wYt|j
  37  ks5J�t|jks<J�|jgksCJ�dS)z"test capture_output(display=False)r(F)r/r4r5r7N)rrr)r.r9r:r;r<r=r/r>r1r?rrr�test_capture_output_no_display�s
  38  �rD)�__doc__r<ZpytestZ
  39  IPython.utilsr�dictZ	_mime_mapr$r%r)r+r:r;�markZparametrize�itemsr r'r*r,r3r@rBrCrDrrrr�<module>s`�
  40  ����	�	
  41  
  42  
  43  
  44