σ
mάJ]c           @` s+  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	 Z	 d  d l
 Z
 d  d l m Z d  d l m Z m Z m Z d d l m Z d  d l j j j Z e
 j d  d k Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z  d   Z! e d  d    Z" d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   patch(   t   main(   t   TmpDirt
   WorkingDirt   with_directory_contentsi   (   t   basic_scatter_scripti   c          C` sM   d d  l  }  d d l m } t j d |  j    } t | |  sI t  d  S(   Ni    (   t
   Subcommandt   parser(   t   argparset   bokeh.command.subcommandR
   t   schtmlt   HTMLt   ArgumentParsert
   isinstancet   AssertionError(   R   R
   t   obj(    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt   test_create2   s    c           C` s   t  j j d k s t  d  S(   Nu   html(   R   R   t   nameR   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt	   test_name9   s    c           C` s   t  j j d k s t  d  S(   Nu9   Create standalone HTML files for one or more applications(   R   R   t   helpR   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt	   test_help<   s    c           C` s   t  j j d t d d d d d d d d   f d	 t d
 d d d  f d t d d d
 d d t d d  f d t d d d t j d d  f f k s t  d  S(   Nu   filest   metavaru   DIRECTORY-OR-SCRIPTt   nargsu   +R   u3   The app directories or scripts to generate HTML fort   defaultu   --showt   actionu
   store_trueu#   Open generated file(s) in a browseru   -ou   --outputu   FILENAMEu   appendt   typeu1   Name of the output file or - for standard output.u   --argsu   COMMAND-LINE-ARGSuM   Any command line arguments remaining are passed on to the application handler(   u   -ou   --output(	   R   R   t   argst   dictt   Nonet   strR   t	   REMAINDERR   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt	   test_args?   s$    									c         C` s€   t  d d   } t |  + t j t   t d d g  Wd  QXWd  QX|  j   \ } } t rl d } n d } | d | k s t  | d k s t  Wd  QXd  S(	   Nt   prefixu   bokeh-html-no-scriptu   bokehu   htmlu   too few argumentsu9   the following arguments are required: DIRECTORY-OR-SCRIPTu   usage: bokeh html [-h] [--show] [-o FILENAME] [--args ...]
                  DIRECTORY-OR-SCRIPT [DIRECTORY-OR-SCRIPT ...]
bokeh html: error: %s
u    (	   R   R   t   pytestt   raisest
   SystemExitR   t
   readouterrt
   is_python2R   (   t   capsyst   dirnamet   outt   errt   too_few(    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt   test_no_script^   s    	c         ` s'     f d   } t  i t d 6|  d  S(   Nc         ` s   t  |    t d d d g  Wd  QX  j   \ } } | d k sJ t  | d k s\ t  t d d g  t t j |    k s t  d  S(   Nu   bokehu   htmlu
   scatter.pyu    u   scatter.html(   R   R   R(   R   t   sett   ost   listdir(   R+   R,   R-   (   R*   (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt   runo   s    u
   scatter.py(   R   R	   (   R*   R3   (    (   R*   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt   test_basic_scriptn   s    	c         ` s'     f d   } t  i t d 6|  d  S(   Nc      
   ` s   t  |    t d d d d d g  Wd  QX  j   \ } } | d k sP t  | d k sb t  t d d g  t t j |    k s t  d  S(   Nu   bokehu   htmlu
   scatter.pyu   --outputu   foo.htmlu    (   R   R   R(   R   R0   R1   R2   (   R+   R,   R-   (   R*   (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyR3   {   s    u
   scatter.py(   R   R	   (   R*   R3   (    (   R*   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt#   test_basic_script_with_output_afterz   s    	c         ` s'     f d   } t  i t d 6|  d  S(   Nc      
   ` s   t  |    t d d d d d g  Wd  QX  j   \ } } | d k sP t  | d k sb t  t d d g  t t j |    k s t  d  S(   Nu   bokehu   htmlu   --outputu   foo.htmlu
   scatter.pyu    (   R   R   R(   R   R0   R1   R2   (   R+   R,   R-   (   R*   (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyR3      s    u
   scatter.py(   R   R	   (   R*   R3   (    (   R*   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt$   test_basic_script_with_output_before   s    	u   bokeh.util.browser.viewc         ` s*      f d   } t  i t d 6|  d  S(   Nc      	   ` sΈ   t  |    t d d d d g  Wd  QX  j   \ } } | d k sM t  | d k s_ t  t d d g  t t j |    k s t   j s t   j d d k s΄ t  d  S(	   Nu   bokehu   htmlu   --showu
   scatter.pyu    u   scatter.htmli    (   u   scatter.html(	   R   R   R(   R   R0   R1   R2   t   calledt	   call_args(   R+   R,   R-   (   R*   t	   mock_view(    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyR3      s    -u
   scatter.py(   R   R	   (   R9   R*   R3   (    (   R*   R9   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt	   test_show   s    (#   t
   __future__R    R   R   R   R%   R   t   mockR   R1   t   syst   bokeh.command.bootstrapR   t   bokeh._testing.util.filesystemR   R   R   t    R	   t   bokeh.command.subcommands.htmlt   commandt   subcommandst   htmlR   t   version_infoR)   R   R   R   R#   R/   R4   R5   R6   R:   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_html.pyt   <module>   s(   " 
								