ó
Ýà‹]c           @   s¶   d  Z  d d l Z e j j Z d d l m Z d d l m Z m	 Z	 m
 Z
 d d l m Z d d l m Z d d l Z d d	 l m Z d d
 l m Z d Z d e f d „  ƒ  YZ d S(   s   Tests for the KernelClientiÿÿÿÿN(   t   TestCase(   t   KernelSpecManagert   NoSuchKernelt   NATIVE_KERNEL_NAMEi   (   t   start_new_kerneli   (   t   test_env(   t   string_types(   t   capture_outputi   t   TestKernelClientc           B   sY   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   c         C   s£   t  ƒ  |  _ |  j j ƒ  |  j |  j j ƒ y t ƒ  j t ƒ Wn t k
 r] t	 j
 ƒ  n Xt d t ƒ \ |  _ |  _ |  j |  j j ƒ |  j |  j j ƒ d  S(   Nt   kernel_name(   R   t	   env_patcht   startt
   addCleanupt   stopR   t   get_kernel_specR   R   t   pytestt   skipR   t   kmt   kct   stop_channelst   shutdown_kernel(   t   self(    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   setUp   s    c         C   sc   |  j  } t ƒ   } | j d d t ƒ} Wd  QXd | j k sE t ‚ | d d d k s_ t ‚ d  S(   Ns   print('hello')t   timeoutt   hellot   contentt   statust   ok(   R   R   t   execute_interactivet   TIMEOUTt   stdoutt   AssertionError(   R   R   t   iot   reply(    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_execute_interactive#   s
    	c         C   sL   |  j  | t ƒ |  j | d d | d ƒ |  j | d d | d ƒ d  S(   Nt   headert   msg_typet   _replyt   parent_headert   _request(   t   assertIsInstancet   dictt   assertEqual(   R   t
   reply_typeR!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   _check_reply+   s    c         C   s]   |  j  } | j d d ƒ } |  j | t ƒ | j d d d t d t ƒ } |  j d | ƒ d  S(   Nt   sessioni    R!   R   t   history(   R   R.   R(   R   t   TrueR   R,   (   R   R   t   msg_idR!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_history0   s
    	c         C   sW   |  j  } | j d ƒ } |  j | t ƒ | j d d t d t ƒ} |  j d | ƒ d  S(   Ns	   who carest   codeR!   R   t   inspect(   R   R3   R(   R   R/   R   R,   (   R   R   R0   R!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_inspect7   s
    	c         C   sW   |  j  } | j d ƒ } |  j | t ƒ | j d d t d t ƒ} |  j d | ƒ d  S(   Ns	   who caresR2   R!   R   t   complete(   R   R5   R(   R   R/   R   R,   (   R   R   R0   R!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_complete>   s
    	c         C   sQ   |  j  } | j ƒ  } |  j | t ƒ | j d t d t ƒ } |  j d | ƒ d  S(   NR!   R   t   kernel_info(   R   R7   R(   R   R/   R   R,   (   R   R   R0   R!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_kernel_infoE   s
    	c         C   sQ   |  j  } | j ƒ  } |  j | t ƒ | j d t d t ƒ } |  j d | ƒ d  S(   NR!   R   t	   comm_info(   R   R9   R(   R   R/   R   R,   (   R   R   R0   R!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_comm_infoL   s
    	c         C   sQ   |  j  } | j ƒ  } |  j | t ƒ | j d t d t ƒ } |  j d | ƒ d  S(   NR!   R   t   shutdown(   R   R;   R(   R   R/   R   R,   (   R   R   R0   R!   (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   test_shutdownS   s
    	(   t   __name__t
   __module__R   R"   R,   R1   R4   R6   R8   R:   R<   (    (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyR      s   								(   t   __doc__t   ost   patht   joint   pjoint   unittestR    t   jupyter_client.kernelspecR   R   R   t   managerR   t   utilsR   R   t   ipython_genutils.py3compatR   t   IPython.utils.captureR   R   R   (    (    (    s?   lib/python2.7/site-packages/jupyter_client/tests/test_client.pyt   <module>   s   