ó
mÜJ]c           @` sÑ   d  d l  m Z m Z m Z m Z d  d l Z e d  d l m Z m Z m	 Z	 d  d l
 m Z d  d l m Z d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d  d l Td  d l Td „  Z d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   Intt   Stringt   List(   t   CustomJS(   t   Modelt	   SomeModelc           B` s8   e  Z e d  ƒ Z e d ƒ Z e e d d d g ƒ Z RS(   i   u   helloi   i   i   (   t   __name__t
   __module__R   t   aR   t   bR   t   c(    (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyR	   &   s   t   Test_js_on_changec           B` sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` s0   t  ƒ  } t j t ƒ  | j d ƒ Wd  QXd  S(   Nu   foo(   R	   t   pytestt   raisest
   ValueErrort   js_on_change(   t   selft   m(    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_exception_for_no_callbacks-   s    	c         C` sY   t  ƒ  } xI d d d  d g i  d g D], } t j t ƒ  | j d | ƒ Wd  QXq% Wd  S(   Ni
   u   bari   gffffff$@u   foo(   R	   t   NoneR   R   R   R   (   R   R   t   val(    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt    test_exception_for_bad_callbacks2   s    	"c         C` sr   t  d d ƒ } t ƒ  } xS | j |  ƒ D]B } t ƒ  } | j | | ƒ | j i | g d | 6k s( t ‚ q( Wd  S(   Nt   codeu    u	   change:%s(   R   R	   t
   propertiesR   t   js_property_callbackst   AssertionError(   R   t   cbt   m0t   nameR   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_with_propname8   s    		c         C` sƒ   t  d d ƒ } t ƒ  } | j d | ƒ | j i | g d 6k sG t ‚ t ƒ  } | j d | ƒ | j i | g d 6k s t ‚ d  S(   NR   u    u   foou   change:b(   R   R	   R   R   R   (   R   R   t   m1t   m2(    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_with_non_propname@   s    		c         C` s`   t  d d ƒ } t  d d ƒ } t ƒ  } | j d | | ƒ | j i | | g d 6k s\ t ‚ d  S(   NR   u    u   foo(   R   R	   R   R   R   (   R   t   cb1t   cb2R   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_with_multple_callbacksJ   s
    	c         C` sŒ   t  d d ƒ } t  d d ƒ } t ƒ  } | j d | ƒ | j i | g d 6k sV t ‚ | j d | ƒ | j i | | g d 6k sˆ t ‚ d  S(   NR   u    u   foo(   R   R	   R   R   R   (   R   R%   R&   R   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt&   test_with_multple_callbacks_separatelyQ   s    	c         C` sN   t  d d ƒ } t ƒ  } | j d | | ƒ | j i | g d 6k sJ t ‚ d  S(   NR   u    u   foo(   R   R	   R   R   R   (   R   R   R   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_ignores_dupe_callbacksZ   s    	(	   R
   R   R   R   R!   R$   R'   R(   R)   (    (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyR   +   s   				
			t   Test_js_linkc           B` s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C` sf   t  ƒ  } t  ƒ  } t j t ƒ  } | j d | d ƒ Wd  QXt | ƒ j d d | f ƒ sb t ‚ d  S(   Nu   junku   bu-   ValueError: %r is not a property of self (%r)(   R	   R   R   R   t   js_linkt   strt   endswithR   (   R   R"   R#   t   e(    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_value_error_on_bad_attrb   s
    		c         C` sW   t  ƒ  } t j t ƒ  } | j d d d ƒ Wd  QXt | ƒ j d d ƒ sS t ‚ d  S(   Nu   au   junku   bu,   ValueError: 'other' is not a Bokeh model: %r(   R	   R   R   R   R+   R,   R-   R   (   R   R"   R.   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_value_error_on_bad_otheri   s    	c         C` sf   t  ƒ  } t  ƒ  } t j t ƒ  } | j d | d ƒ Wd  QXt | ƒ j d d | f ƒ sb t ‚ d  S(   Nu   au   junku.   ValueError: %r is not a property of other (%r)(   R	   R   R   R   R+   R,   R-   R   (   R   R"   R#   R.   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt"   test_value_error_on_bad_other_attro   s
    		c         C` së   t  ƒ  } t  ƒ  } t | j ƒ d k s- t ‚ | j d | d ƒ t | j ƒ d k s[ t ‚ d | j k sp t ‚ | j d } t | ƒ d k s• t ‚ | d } t | t ƒ s´ t ‚ | j t d | ƒ k sÒ t ‚ | j	 d k sç t ‚ d  S(   Ni    u   au   bi   u   change:at   otheru   other.b = this.a(
   R	   t   lenR   R   R+   t
   isinstanceR   t   argst   dictR   (   R   R"   R#   t   cbsR   (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   test_creates_customjsv   s    		
(   R
   R   R/   R0   R1   R8   (    (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyR*   `   s   			(   t   *c          C` sa   g  }  xT t  j j j ƒ  D]@ \ } } y | ƒ  Wn |  j | ƒ n X|  g  k s t ‚ q Wd  S(   N(   R   t	   __class__t   model_class_reverse_mapt   itemst   appendR   (   t   badR    t   cls(    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt-   test_all_builtin_models_default_constructible†   s    (   t
   __future__R    R   R   R   R   t   bokeh.core.propertiesR   R   R   t   bokeh.models.callbacksR   t   bokeh.modelR   R	   t   objectR   R*   t   bokeh.modelst   bokeh.plottingR@   (    (    (    s5   lib/python2.7/site-packages/bokeh/tests/test_model.pyt   <module>   s   " 
5$

