σ
mάJ]c           @` sY  d  d l  m Z m Z m Z m Z d  d l Z e d  d l Z d  d l m Z d  d l	 m
 Z
 d  d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d  d l m Z 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   Z  e j! d    Z" e j! d    Z# d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t
   MarkerType(   t   value(   t   BoxZoomToolt   Circlet   ColumnDataSourcet   LassoSelectToolt   Legendt
   LinearAxist   LogScalet   PanToolt	   ResetToolt   Scattert   Title(   t   _figuret
   TestFigurec           B` s‘   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   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   } t  j   } | j d d d g d d d g  | | k sL t  t  j   } | | k sj t  | | k s| t  d  S(   Ni   i   i   (   t   bpft   figuret   circlet   AssertionError(   t   selft   pt   qt   r(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt
   test_basic+   s    "c      
   C` sΰ   t  j d d d d  } | j d k s- t  | j d k sB t  t  j d d d d  } | j d k so t  | j d k s t  t j t   t  j d d d d  Wd  QXt j t   t  j d d d d  Wd  QXd  S(   Nt   widthid   t   heightix   t
   plot_widtht   plot_height(   R   R   R   R   R   t   pytestt   raisest
   ValueError(   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_width_height5   s    c         C` s:  t  j   } | j d d d g d d d g  t | j  d k sI t  t | j  } t   } | j |  | j	 j
 |  t | j  | k s t  t   } | j |  | j	 j
 |  t | j  | k sΪ t  | j j
 t    t | j  | k st  | j j
 t    t | j  | k s6t  d  S(   Ni   i   i   (   R   R   R   t   lent   xaxisR   t   setR   t   addt   abovet   appendt   leftt   right(   R   R   t   expectedt   axt   ax2(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt
   test_xaxisD   s     "		c         C` s:  t  j   } | j d d d g d d d g  t | j  d k sI t  t | j  } t   } | j |  | j	 j
 |  t | j  | k s t  t   } | j |  | j	 j
 |  t | j  | k sΪ t  | j j
 t    t | j  | k st  | j j
 t    t | j  | k s6t  d  S(   Ni   i   i   (   R   R   R   R$   t   yaxisR   R&   R   R'   R+   R)   R(   t   below(   R   R   R,   R-   R.   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt
   test_yaxis[   s     "		c         C` s`  t  j   } | j d d d g d d d g  t | j  d k sI t  t | j  } t   } | j |  | j	 j
 |  t | j  | k s t  t   } | j |  | j j
 |  t | j  | k sΪ t  t   } | j |  | j j
 |  t | j  | k st  t   } | j |  | j j
 |  t | j  | k s\t  d  S(   Ni   i   i   (   R   R   R   R$   t   axisR   R&   R   R'   R(   R)   R1   R*   R+   (   R   R   R,   R-   R.   t   ax3t   ax4(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt	   test_axisr   s(    "				c         C` s   t  j d d  } | j d d d g d d d g  t | j t  sL t  t  j d d  } | j d d d g d d d g  t | j t  s t  d  S(   Nt   x_axis_typeu   logi   i   i   t   y_axis_type(   R   R   R   t
   isinstancet   x_scaleR   R   t   y_scale(   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_log_axis   s    ""c         C` si   t  j   } | j d d d g d d d g  t | j  d k sI t  | j d j d k se t  d  S(   Ni   i   i   i    (   R   R   R   R$   t   xgridR   t	   dimension(   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt
   test_xgrid   s    "c         C` si   t  j   } | j d d d g d d d g  t | j  d k sI t  | j d j d k se t  d  S(   Ni   i   i   i    (   R   R   R   R$   t   ygridR   R>   (   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt
   test_ygrid   s    "c         C` sM   t  j   } | j d d d g d d d g  t | j  d k sI t  d  S(   Ni   i   i   (   R   R   R   R$   t   gridR   (   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt	   test_grid’   s    "c         C` s   d } t  j d |  } t t t t g } t | j  t |  k sK t  x6 t	 |  D]( \ } } t
 | j | |  sX t  qX Wd  S(   Nu   pan,box_zoom,reset,lasso_selectt   tools(   R   R   R   R   R   R	   R$   RD   R   t	   enumerateR9   (   R   t   TOOLSt   figR,   t   it   _type(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt
   test_tools§   s    !c      	   C` sΈ   t  j d d d d d d d d  } | j d k s9 t  | j d k sN t  | j d k sc t  | j d k sx t  d	 | _ d
 | _ | j d	 k s t  | j d
 k s΄ t  d  S(   Nt   background_fill_coloru   redt   background_fill_alphag      ΰ?t   border_fill_coloru   bluet   border_fill_alphagι?u   greenu   yellow(   R   R   RK   R   RL   RM   RN   (   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_plot_fill_props°   s    			c         C` s,   t  j d d  t |  d k s( t  d  S(   Nt   titleu   titlei    (   R   R   R$   R   (   R   t   recwarn(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_title_kwarg_no_warningΏ   s    c         C` s_   t  d d  } t j d |  } | j d d d g d d d g  | j j d k s[ t  d  S(   Nt   textu   Great TitleRP   i   i   i   (   R   R   R   t   lineRP   RS   R   (   R   RP   t   plot(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_title_should_accept_TitleΔ   s    "c         C` sP   t  j d d  } | j d d d g d d d g  | j j d k sL t  d  S(   NRP   u   Great Title 2i   i   i   (   R   R   RT   RP   RS   R   (   R   RU   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_title_should_accept_stringΚ   s    "c         C` sR   t  j   } i d d d g d 6d d d g d 6} | j d d d d d	 |  d  S(
   Ni   i   i   u   xi   u   yt   xt   yt   source(   R   R   R   (   R   R   t   dct(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt+   test_columnsource_auto_conversion_from_dictΟ   s    &c         C` s[   t  j   } | j i d d d g d 6d d d g d 6 } | j d d d d d	 |  d  S(
   Ni   i   i   u   xi   u   yRX   RY   RZ   (   R   R   t	   DataFrameR   (   R   t   pdR   t   df(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt-   test_columnsource_auto_conversion_from_pandasΤ   s    /c         C` sp  t  j   } t i d d d g d 6d d d g d 6 } t j t d d * | j d	 d d
 d d d g d |  Wd  QXt j t d d 9 | j d	 d d
 d d d g d d d d g d |  Wd  QXt j t  ; } | j d	 d d
 d d d g d d d d g d |  Wd  QXt j d t	 | j
   } | d  k	 sBt  t | j    t d d g  k slt  d  S(   Ni   i   i   u   xi   u   yt   matchu;   Expected y to reference fields in the supplied data source.RX   RY   RZ   uJ   Expected y and line_color to reference fields in the supplied data source.t
   line_coloru   redu   greenu   bluet   coloruJ   Expected y, (.+) and (.+) to reference fields in the supplied data source.u
   fill_coloru
   line_color(   R   R   R   R    R!   t   RuntimeErrorR   t   ret   searcht   strR   t   NoneR   R&   t   groups(   R   R   RZ   t   et   m(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt9   test_glyph_method_errors_on_sequence_literals_with_sourceΩ   s    ,+::(   t   __name__t
   __module__R   R#   R/   R2   R6   R<   R?   RA   RC   RJ   RO   RR   RV   RW   R\   R`   Rl   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyR   )   s"   	
																	t   TestMarkersc        
   B` s  e  Z e j j d  e e   d    Z e j j d  e e   e j j d d d d d g  d     Z e j j d  e e   e j j d d d d d g  d	     Z	 e j j d  e e   e j j d d d d g  d
     Z
 e j j d  e e   d    Z RS(   u   markerc   	   	   C` sT  t  j   } d } d } d } d } t | |  } | d d d g d d d g d | d	 | } | j j | k sx t  | j j | k s t  | d d d g d d d g d | d
 | } | j j | k sΥ t  | j j | k sν t  | d d d g d d d g d | d | d | } | j j | k s8t  | j j | k sPt  d  S(   Nid   i    g      ΰ?g      θ?i   i   i   Rc   Rb   t
   fill_colort   alphat
   line_alpha(   id   i    i    (   i    id   i    (	   R   R   t   getattrt   glyphRp   R   Rb   Rr   t
   fill_alpha(	   R   t   markerR   t   rgbt	   rgb_othert   alpha1t   alpha2t   funcR   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_mixed_inputsι   s     --*	u   colorg      Y@g      I@g      ΰ?id   i2   c         C` sά   t  j   } t | |  } | d d d g d d d g d | } | j j | k sZ t  | j j | k sr t  x0 | j j d d !D] } t | t  s t  q Wx0 | j j d d !D] } t | t  sΉ t  qΉ Wd  S(   Ni   i   i   Rc   i    (	   R   R   Rs   Rt   Rb   R   Rp   R9   t   int(   R   Rc   Rv   R   R{   R   t   v(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_color_input  s    'c         C` s   t  j   } t | |  } | d d d g d d d g d | } | j j | k sZ t  x0 | j j d d !D] } t | t  sn t  qn Wd  S(   Ni   i   i   Rb   i    (   R   R   Rs   Rt   Rb   R   R9   R}   (   R   Rc   Rv   R   R{   R   R~   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_line_color_input  s    'c         C` s   t  j   } t | |  } | d d d g d d d g d | } | j j | k sZ t  x0 | j j d d !D] } t | t  sn t  qn Wd  S(   Ni   i   i   Rp   i    (   R   R   Rs   Rt   Rp   R   R9   R}   (   R   Rc   Rv   R   R{   R   R~   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_fill_color_input  s    'c      	   C` s   t  j   } t | |  } | d d d g d d d g d d } | j d k sW t  t j t  - | j d d d g d d d g d d Wd  QXd  S(   Ni   i   i   t   levelu   underlayu	   bad_input(	   R   R   Rs   R   R   R    R!   R"   R   (   R   Rv   R   R{   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_render_level'  s    '(   g      Y@g      Y@g      Y@(   g      I@g      Y@g      I@g      ΰ?(   id   id   id   (   i2   id   i2   g      ΰ?(   g      Y@g      Y@g      Y@(   g      I@g      Y@g      I@g      ΰ?(   id   id   id   (   i2   id   i2   g      ΰ?(   g      Y@g      Y@g      Y@(   g      I@g      Y@g      I@g      ΰ?(   i2   id   i2   g      ΰ?(   Rm   Rn   R    t   markt   parametrizet   listR   R|   R   R   R   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyRo   η   s   $--
*
t   Test_scatterc           B` s>   e  Z e j j d  e e   d    Z d   Z d   Z	 RS(   u   markerc         C` sj   t  j   } | j d d d g d d d g d | } t | j t  sN t  | j j | k sf t  d  S(   Ni   i   i   Rv   (   R   R   t   scatterR9   Rt   R   R   Rv   (   R   Rv   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_marker_value2  s    *c      	   C` s   t  j   } t d d d d g d d d d g d d d d	 g  } | j d
 d d d d | } t | j t  sx t  | j j d k s t  d  S(   NRX   i   i   i   RY   t   foou   hexu   squareu   circleu   xu   yRv   u   fooRZ   (	   R   R   t   dictR   R9   Rt   R   R   Rv   (   R   R   t   dataR   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_marker_column9  s
    6c         C` sp   t  j   } | j d d d g d d d g d d d d } t | j t  sT t  | j j d k sl t  d  S(   Ni   i   i   Rv   u   circlet   radiusgΙ?(   R   R   R   R9   Rt   R   R   R   (   R   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_circle_with_radius@  s    0(
   Rm   Rn   R    R   R   R   R   R   R   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyR   0  s   $	t   Test_hbar_stackc           B` s   e  Z d    Z RS(   c   	      C` s\  d d d d d d g } d d d	 g } d
 d d g } i | d 6d d d d d d g d 6d d d d d d g d 6d d d d d d g d	 6} t  d |  } t j   } | j | d d d d d | d | d g  | D] } t |  ^ qΤ d | } t |  d k st  | d j d k s&t  | d j d k s?t  | d j d	 k sXt  d  S(   Nu   Applesu   Pearsu
   Nectarinesu   Plumsu   Grapesu   Strawberriesu   2015u   2016u   2017u   #c9d9d3u   #718dbfu   #e84d60u   fruitsi   i   i   i   i   i   R   RY   R   gΝΜΜΜΜΜμ?Rc   RZ   t   legendt   namei    (   R   R   R   t
   hbar_stackR   R$   R   R   (	   R   t   fruitst   yearst   colorsR   RZ   R   RX   t	   renderers(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   test_returns_renderersH  s    
$((   Rm   Rn   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyR   F  s   t   Test_vbar_stackc           B` s   e  Z d    Z RS(   c   	      C` s\  d d d d d d g } d d d	 g } d
 d d g } i | d 6d d d d d d g d 6d d d d d d g d 6d d d d d d g d	 6} t  d |  } t j   } | j | d d d d d | d | d g  | D] } t |  ^ qΤ d | } t |  d k st  | d j d k s&t  | d j d k s?t  | d j d	 k sXt  d  S(   Nu   Applesu   Pearsu
   Nectarinesu   Plumsu   Grapesu   Strawberriesu   2015u   2016u   2017u   #c9d9d3u   #718dbfu   #e84d60u   fruitsi   i   i   i   i   i   R   RX   R   gΝΜΜΜΜΜμ?Rc   RZ   R   R   i    (   R   R   R   t
   vbar_stackR   R$   R   R   (	   R   R   R   R   R   RZ   R   RX   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyR   \  s    
$((   Rm   Rn   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyR   Z  s   c         C` sp   d   } d   } d   } d   } d   } d   } d   } d   } d	   }	 d
   }
 d   } d   } d  S(   Nc      	   S` st   | j  d d d d d d d |  | j t  } t |  d k sI t  | d	 j d	 j i d d
 6k sp t  d  S(   NRX   u   xRY   u   yR   u   labelRZ   i   i    u   field(   R   t   selectR
   R$   R   t   itemst   label(   R   R   RZ   t   legends(    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pytE   test_glyph_label_is_legend_if_column_in_datasource_is_added_as_legendp  s    "c      	   S` st   | j  d d d d d d d |  | j t  } t |  d k sI t  | d	 j d	 j i d d
 6k sp t  d  S(   NRX   u   xRY   u   yR   u   milkRZ   i   i    u   value(   R   R   R
   R$   R   R   R   (   R   R   RZ   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pytH   test_glyph_label_is_value_if_column_not_in_datasource_is_added_as_legendw  s    "c         S` sΆ   | j  d t d d d d g d d d d g d d d	 d
 g   } | j d d d d d d d |  | j t  } t |  d k s t  | d j d j i d d 6k s² t  d  S(   NR   RX   i   i   i   RY   R   u   au   bu   cu   xu   yR   u   labelRZ   i    u   field(	   R]   R   R   R   R
   R$   R   R   R   (   R   R   R^   RZ   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pytH   test_glyph_label_is_legend_if_column_in_df_datasource_is_added_as_legend}  s
    B"c         S` sΆ   | j  d t d d d d g d d d d g d d d	 d
 g   } | j d d d d d d d |  | j t  } t |  d k s t  | d j d j i d d 6k s² t  d  S(   NR   RX   i   i   i   RY   R   u   au   bu   cu   xu   yR   u   milkRZ   i    u   value(	   R]   R   R   R   R
   R$   R   R   R   (   R   R   R^   RZ   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pytK   test_glyph_label_is_value_if_column_not_in_df_datasource_is_added_as_legend  s
    B"c      	   S` s{   | j  d d d d d i d d 6d |  | j t  } t |  d	 k sP t  | d
 j d
 j i d d 6k sw t  d  S(   NRX   u   xRY   u   yR   u   milku   fieldRZ   i   i    (   R   R   R
   R$   R   R   R   (   R   R   RZ   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt5   test_glyph_label_is_just_added_directly_if_not_string  s    )c      	   S` sM   | j  d d d d d d  d |  | j t  } t |  d k sI t  d  S(   NRX   u   xRY   u   yR   RZ   i    (   R   Rh   R   R
   R$   R   (   R   R   RZ   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt    test_no_legend_if_legend_is_none  s    "c      	   S` sr   | j  d d d d d d d |  } | j t  } t |  d k sK t  | d	 j d	 j | g k sn t  d  S(
   NRX   u   xRY   u   yR   u   labelRZ   i   i    (   R   R   R
   R$   R   R   R   (   R   R   RZ   t   rendererR   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt!   test_legend_added_when_legend_set  s    $c         S` sG   | j  d d d d d |  | j t  } t |  d k sC t  d  S(   NRX   u   xRY   u   yRZ   i    (   R   R   R
   R$   R   (   R   R   RZ   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt$   test_legend_not_added_when_no_legend   s    c         S` s\   | j  t    | j  t    t j t  ' | j d d d d d d d |  Wd  QXd  S(   NRX   u   xRY   u   yR   u   labelRZ   (   t
   add_layoutR
   R    R!   Rd   R   (   R   R   RZ   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt9   test_adding_legend_doesnt_work_when_legends_already_added¦  s    c      	   S` s  | j  d d d d d d d |  } | j d d d d d d d |  } | j t  } t |  d	 k so t  | d
 j d
 j | g k s t  | d
 j d
 j t	 d  k sΈ t  | d
 j d	 j | g k sΫ t  | d
 j d	 j t	 d  k st  d  S(   NRX   u   xRY   u   yR   u   squareRZ   u   circlei   i    (
   t   squareR   R   R
   R$   R   R   R   R   R   (   R   R   RZ   Rͺ   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt1   test_multiple_renderers_correctly_added_to_legend­  s    $$#&#c         S` s΄   | j  d d d d d d  } | j d d d d d d  } | j t  } t |  d k sc t  | d j d j | | g k s t  | d j d j i d d	 6k s° t  d  S(
   NRX   u   xRY   u   yR   u   compound legend stringi   i    u   value(	   Rͺ   R   R   R
   R$   R   R   R   R   (   R   R   RZ   Rͺ   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pytP   test_compound_legend_behavior_initiated_if_labels_are_same_on_multiple_renderersΈ  s    &c      	   S` sΐ   | j  d d d d d d d |  } | j d d d d d d d |  } | j t  } t |  d k so t  | d	 j d	 j | | g k s t  | d	 j d	 j i d d
 6k sΌ t  d  S(   NRX   u   xRY   u   yR   u   labelRZ   i   i    u   field(	   Rͺ   R   R   R
   R$   R   R   R   R   (   R   R   RZ   Rͺ   R   R   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt^   test_compound_legend_behavior_initiated_if_labels_are_same_on_multiple_renderers_and_are_fieldΒ  s    $$&(    (   t   obejctR   R    R‘   R’   R£   R€   R¦   R§   R©   R«   R¬   R­   (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   Test_figure_legendsn  s    											
c        
   C` s:   t  t d d d d g d d d d g d d d d	 g   S(
   NRX   i   i   i   RY   R   u   au   bu   c(   R   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyRZ   ά  s    c           C` s
   t  j   S(   N(   R   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyR   α  s    ($   t
   __future__R    R   R   R   R    Re   t   bokeh.core.enumsR   t   bokeh.core.propertiesR   t   bokeh.modelsR   R   R   R	   R
   R   R   R   R   R   R   t   bokeh.plottingR   R   t   objectR   Ro   R   R   R   R―   t   fixtureRZ   R   (    (    (    s?   lib/python2.7/site-packages/bokeh/plotting/tests/test_figure.pyt   <module>   s   " L
ΎI	n