ó
æNXc           @  sˆ  d  Z  d d l m Z d d l Z d d l j Z d d l m Z e	 d d d d d	 d
 d d d d d d ƒ Z
 i d d 6d d 6Z i i d d 6d d 6d 6Z i d d 6d d 6d d
 6d d 6d d 6d d 6Z i i d d 6d 6i d d 6d 6i d d 6d
 6i d d 6d 6i d d 6d 6i d d  6d 6Z d! Z d" Z d# „  Z d$ „  Z d% „  Z d& „  Z d' „  Z d( „  Z d) „  Z d* „  Z d+ „  Z d S(,   s   Tests for IPython.utils.captureiÿÿÿÿ(   t   print_functionN(   t   capturet
   _repr_png_s	   image/pngt   _repr_jpeg_s
   image/jpegt
   _repr_svg_s   image/svg+xmlt   _repr_html_s	   text/htmlt   _repr_json_s   application/jsont   _repr_javascript_s   application/javascriptt
   binarydatas   <b>bold</b>i
   t   widthi   t   heights   <svg>s   alert();s   {}t   existst   pngt   jpegt   svgt   htmlt   jst   jsons   hello, stdouts   hello, stderrc          c  sJ   t  j ƒ  }  x7 t j ƒ  D]) \ } } t j t |  | ƒ ƒ  d f Vq Wd S(   s   RichOutput with no argsN(   R   t
   RichOutputt	   _mime_mapt   itemst   ntt   assert_equalt   getattrt   None(   t   richt   methodt   mime(    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_rich_output_emptyG   s    c          c  s­   t  }  t } t j d |  d | ƒ } t j | j ƒ  |  d f Vt j | j ƒ  |  d | d f f Vt j | j ƒ  d f Vt j | j
 ƒ  d f Vt j | j ƒ  d f Vd S(   s   test RichOutput basicst   datat   metadatas	   text/htmls	   image/pngN(   t
   basic_datat   basic_metadataR   R   R   R   R   R   t   _repr_latex_R   R   R   (   R   R   R   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_rich_outputM   s    %c          c  sZ   t  }  t j d |  ƒ } x; t j ƒ  D]- \ } } t j t | | ƒ ƒ  |  | f Vq% Wd S(   s    test RichOutput with no metadataR   N(   t	   full_dataR   R   R   R   R   R   R   (   R   R   R   R   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_rich_output_no_metadataX   s    c          c  sp   t  }  t } t j d |  d | ƒ } xE t j ƒ  D]7 \ } } t j t | | ƒ ƒ  |  | | | f f Vq1 Wd S(   s   test RichOutput with metadataR   R   N(	   R#   t   full_metadataR   R   R   R   R   R   R   (   R   R   R   R   R   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_rich_output_metadata_   s
    c          c  s   t  }  t j d |  ƒ } t j ƒ   } | j ƒ  Wd QXt j t | j ƒ d f V| j d } t j | j	 | j	 f Vt j | j
 | j
 f Vd S(   s   test RichOutput.display
    
    This is a bit circular, because we are actually using the capture code we are testing
    to test itself.
    R   Ni   i    (   R#   R   R   t   capture_outputt   displayR   R   t   lent   outputsR   R   (   R   R   t   capt   rich2(    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_rich_output_displayg   s    c       
   c  s†   t  j d t ƒ }  t  j ƒ  : } t t d d ƒt t d d d t j ƒ|  j	 ƒ  Wd QXt
 j t | j f Vt
 j t | j f Vd S(   s   capture_output worksR   t   endt    t   fileN(   R   R   R#   R'   t   printt   hello_stdoutt   hello_stderrt   syst   stderrR(   R   R   t   stdout(   R   R+   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_capture_outputv   s    c       
   c  s¦   t  j d t ƒ }  t  j d t ƒ : } t t d d ƒt t d d d t j	 ƒ|  j
 ƒ  Wd QXt j d | j f Vt j t | j	 f Vt j t | j ƒ d f Vd S(   s!   test capture_output(stdout=False)R   R6   R.   R/   R0   Ni   (   R   R   R#   R'   t   FalseR1   R2   R3   R4   R5   R(   R   R   R6   R)   R*   (   R   R+   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_capture_output_no_stdout€   s    c          c  s¹   t  j d t ƒ }  t  j ƒ  S t  j d t ƒ : } t t d d ƒt t d d d t j	 ƒ|  j
 ƒ  Wd QXWd QXt j t | j f Vt j d | j	 f Vt j t | j ƒ d f Vd S(   s!   test capture_output(stderr=False)R   R5   R.   R/   R0   Ni   (   R   R   R#   R'   R8   R1   R2   R3   R4   R5   R(   R   R   R6   R)   R*   (   R   R+   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_capture_output_no_stderr‹   s     c       
   c  s    t  j d t ƒ }  t  j d t ƒ : } t t d d ƒt t d d d t j	 ƒ|  j
 ƒ  Wd QXt j t | j f Vt j t | j	 f Vt j | j g  f Vd S(   s"   test capture_output(display=False)R   R(   R.   R/   R0   N(   R   R   R#   R'   R8   R1   R2   R3   R4   R5   R(   R   R   R6   R*   (   R   R+   (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   test_capture_output_no_display—   s    (   t   __doc__t
   __future__R    R4   t
   nose.toolst   toolsR   t   IPython.utilsR   t   dictR   R   R    R#   R%   R2   R3   R   R"   R$   R&   R-   R7   R9   R:   R;   (    (    (    sX   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/tests/test_capture.pyt   <module>   sV   	

						
		