σ
mάJ]c           @` sA  d  d l  m Z m Z m Z m Z d  d l Z e d  d l Z d  d l Z d  d l m	 Z	 m
 Z
 d  d l m Z m Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z d  d l j j Z e   d	 e f d
     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   CodeHandlert   FunctionHandler(   t   Intt   Instance(   t   Document(   t   Model(   t   figure(   t   basicConfigt   AnotherModelInTestApplicationc           B` s   e  Z e d   Z RS(   i   (   t   __name__t
   __module__R   t   baar(    (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR   +   s   t   SomeModelInTestApplicationc           B` s    e  Z e d   Z e e  Z RS(   i   (   R   R   R   t   fooR   R	   t   child(    (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR   .   s   t   Test_Applicationc           B` s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 e
 j d  d	    Z e
 j d  d
    Z RS(   c         C` s,   t  j   } | j   } | j s( t  d  S(   N(   t   baat   Applicationt   create_documentt   rootst   AssertionError(   t   selft   at   doc(    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt
   test_empty:   s    c         C` s*   t  j t   t j d d  Wd  QXd  S(   Nt   junku   foo(   t   pytestt   raisest	   TypeErrorR   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_invalid_kwarg?   s    c         C` sY   t  j   } d   } t |  } | j |  | j   } t | j  d k sU t  d  S(   Nc         S` s$   |  j  t    |  j  t    d  S(   N(   t   add_rootR   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt	   add_rootsE   s    i   (   R   R   R   t   addR   t   lenR   R   (   R   R   R#   t   handlerR   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_one_handlerC   s    	c         C` s{   t  j   } d   } d   } t |  } | j |  t |  } | j |  | j   } t | j  d k sw t  d  S(   Nc         S` s$   |  j  t    |  j  t    d  S(   N(   R"   R   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR#   O   s    c         S` s   |  j  t    d  S(   N(   R"   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   add_one_rootR   s    i   (   R   R   R   R$   R   R%   R   R   (   R   R   R#   R(   R&   t   handler2R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_two_handlersM   s    		c         C` s   t  j   } t d d d d  } | j |  t   } | j t j  H t | j	  d k se t
  | j |  t | j	  d k s t
  Wd  QXd  S(   Nt   filenameu   junkt   sourceu   bad(i    i   (   R   R   R   R$   R   t   at_levelt   loggingt   ERRORR%   t   recordsR   t   initialize_document(   R   t   caplogR   R&   t   d(    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_failed_handler[   s    	c         C` si   t  j   } d   } d   } t |  } | j |  t |  } | j |  | j d  k se t  d  S(   Nc         S` s$   |  j  t    |  j  t    d  S(   N(   R"   R   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR#   g   s    c         S` s   |  j  t    d  S(   N(   R"   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR(   j   s    (   R   R   R   R$   t   static_patht   NoneR   (   R   R   R#   R(   R&   R)   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_no_static_pathe   s    		c         C` sr   t  j   } d   } d   } t |  } d | _ | j |  t |  } | j |  | j d k sn t  d  S(   Nc         S` s$   |  j  t    |  j  t    d  S(   N(   R"   R   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR#   t   s    c         S` s   |  j  t    d  S(   N(   R"   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR(   w   s    u   foo(   R   R   R   t   _staticR$   R5   R   (   R   R   R#   R(   R&   R)   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_static_pathr   s    			c         C` s   t  j   } d   } d   } t |  } d | _ | j |  t |  } d | _ t j t   } | j |  Wd  QXd t |  k s t	  d  S(   Nc         S` s$   |  j  t    |  j  t    d  S(   N(   R"   R   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR#      s    c         S` s   |  j  t    d  S(   N(   R"   R   (   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR(      s    u   foou   baru   More than one static path(
   R   R   R   R8   R$   R   R   t   RuntimeErrort   strR   (   R   R   R#   R(   R&   R)   t   e(    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_excess_static_path   s    				u'   bokeh.document.document.check_integrityc         C` sE   t  j   } t   } | j t    | j |  | j sA t  d  S(   N(   R   R   R   R"   R
   R1   t   calledR   (   R   t   check_integrityR   R3   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt.   test_application_validates_document_by_default   s
    	c         C` sV   | j  d d  t j   } t   } | j t    | j |  | j sR t  d  S(   Nu   BOKEH_VALIDATE_DOCu   false(	   t   setenvR   R   R   R"   R
   R1   R>   R   (   R   R?   t   monkeypatchR   R3   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt8   test_application_doesnt_validate_document_due_to_env_var   s    	(   R   R   R   R!   R'   R*   R4   R7   R9   R=   t   mockt   patchR@   RC   (    (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyR   6   s   			
		
			t   Test_ServerContextc           B` s   e  Z d    Z RS(   c         C` s$   t  j t   t j   Wd  QXd  S(   N(   R   R   R    R   t   ServerContext(   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   test_abstract©   s    (   R   R   RH   (    (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyRF   ₯   s   t   Test_SessionContextc           B` s   e  Z d    Z RS(   c         C` s$   t  j t   t j   Wd  QXd  S(   N(   R   R   R    R   t   SessionContext(   R   (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyRH   ―   s    (   R   R   RH   (    (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyRI   ­   s   (   t
   __future__R    R   R   R   R   R.   RD   t   bokeh.application.handlersR   R   t   bokeh.core.propertiesR   R   t   bokeh.documentR   t   bokeh.modelR	   t   bokeh.plottingR
   t   bokeh.util.logconfigR   t   bokeh.application.applicationt   applicationR   R   R   t   objectR   RF   RI   (    (    (    sG   lib/python2.7/site-packages/bokeh/application/tests/test_application.pyt   <module>   s"   " o