σ
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 Z d  d l Z d  d l	 m
 Z
 d  d l m Z m Z m Z d d l m Z 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 e j j e j j  d     Z! e j j e j j  d     Z" e j j e j j  d     Z# e j j e j j  d     Z$ e j j e j j  d     Z% e j j e j j  d     Z& d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   main(   t   TmpDirt
   WorkingDirt   with_directory_contentsi   (   t   basic_svg_scatter_scriptt   multi_svg_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   scsvgt   SVGt   ArgumentParsert
   isinstancet   AssertionError(   R   R
   t   obj(    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt   test_create1   s    c           C` s   t  j j d k s t  d  S(   Nu   svg(   R   R   t   nameR   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt	   test_name8   s    c           C` s   t  j j d k s t  d  S(   Nu8   Create standalone SVG files for one or more applications(   R   R   t   helpR   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.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 t d d d d   f d t d d 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   u2   The app directories or scripts to generate SVG fort   defaultu   --heightu   HEIGHTt   typeuJ   The desired height of the exported layout obj only if it's a Plot instanceu   --widthu   WIDTHuI   The desired width of the exported layout obj only if it's a Plot instanceu   -ou   --outputu   FILENAMEt   actionu   appendu1   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   intt   strR   t	   REMAINDERR   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt	   test_args>   s2    											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-svg-no-scriptu   bokehu   svgu   too few argumentsu9   the following arguments are required: DIRECTORY-OR-SCRIPTuΈ   usage: bokeh svg [-h] [--height HEIGHT] [--width WIDTH] [-o FILENAME]
                 [--args ...]
                 DIRECTORY-OR-SCRIPT [DIRECTORY-OR-SCRIPT ...]
bokeh svg: error: %s
u    (	   R   R   t   pytestt   raisest
   SystemExitR   t
   readouterrt
   is_python2R   (   t   capsyst   dirnamet   outt   errt   too_few(    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt   test_no_scripte   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   svgu
   scatter.pyu    u   scatter.svg(   R   R   R)   R   t   sett   ost   listdir(   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt   runy   s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt   test_basic_scriptv   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   svgu
   scatter.pyu   --outputu   foo.svgu    (   R   R   R)   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyR4      s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt#   test_basic_script_with_output_after   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   svgu   --outputu   foo.svgu
   scatter.pyu    (   R   R   R)   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyR4      s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt$   test_basic_script_with_output_before   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   \ } } t |  d k sV t  t |  d k sn t  | j d  s t  t d g  t t j |    k s­ t  d  S(   Nu   bokehu   svgu   --outputu   -u
   scatter.pyi    u   <svg version=(	   R   R   R)   t   lenR   t
   startswithR1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyR4   £   s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt$   test_basic_script_with_output_stdout    s    
c         ` s5     f d   } t  i t d 6t d 6t 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 d	 d d d g  t t j |    k s t  d  S(
   Nu   bokehu   svgu   scatter1.pyu   scatter2.pyu   scatter3.pyu    u   scatter1.svgu   scatter2.svgu   scatter3.svg(   R   R   R)   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyR4   ²   s    u   scatter1.pyu   scatter2.pyu   scatter3.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt   test_multiple_svg_scripts―   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 d g  t t j |    k s t  d  S(   Nu   bokehu   svgu
   scatter.pyu    u   scatter.svgu   scatter_1.svg(   R   R   R)   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyR4   Γ   s    u
   scatter.py(   R   R	   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt)   test_basic_script_with_multiple_svg_plotsΐ   s    	('   t
   __future__R    R   R   R   R&   R   R2   t   syst   bokeh.command.bootstrapR   t   bokeh._testing.util.filesystemR   R   R   t    R   R	   t   bokeh.command.subcommands.svgt   commandt   subcommandst   svgR   t   version_infoR*   R   R   R   R$   R0   t   markt   unitt   seleniumR5   R6   R7   R:   R;   R<   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_svg.pyt   <module>   s6   " 
				'							