σ
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 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 d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   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   scjsont   JSONt   ArgumentParsert
   isinstancet   AssertionError(   R   R	   t   obj(    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyt   test_create1   s    c           C` s   t  j j d k s t  d  S(   Nu   json(   R   R   t   nameR   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyt	   test_name8   s    c           C` s   t  j j d k s t  d  S(   Nu.   Create JSON files for one or more applications(   R   R   t   helpR   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.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 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 JSON fort   defaultu   --indentu   LEVELt   typeu    indentation to use when printingu   -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   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.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-json-no-scriptu   bokehu   jsonu   too few argumentsu9   the following arguments are required: DIRECTORY-OR-SCRIPTu   usage: bokeh json [-h] [--indent LEVEL] [-o FILENAME] [--args ...]
                  DIRECTORY-OR-SCRIPT [DIRECTORY-OR-SCRIPT ...]
bokeh json: 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_json.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   jsonu
   scatter.pyu    u   scatter.json(   R   R   R(   R   t   sett   ost   listdir(   R+   R,   R-   (   R*   (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyt   runo   s    u
   scatter.py(   R   R   (   R*   R3   (    (   R*   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.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   jsonu
   scatter.pyu   --outputu   foo.jsonu    (   R   R   R(   R   R0   R1   R2   (   R+   R,   R-   (   R*   (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyR3   |   s    u
   scatter.py(   R   R   (   R*   R3   (    (   R*   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.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   jsonu   --outputu   foo.jsonu
   scatter.pyu    (   R   R   R(   R   R0   R1   R2   (   R+   R,   R-   (   R*   (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyR3      s    u
   scatter.py(   R   R   (   R*   R3   (    (   R*   sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyt$   test_basic_script_with_output_before   s    	(    t
   __future__R    R   R   R   R%   R   R1   t   syst   bokeh.command.bootstrapR   t   bokeh._testing.util.filesystemR   R   R   t    R   t   bokeh.command.subcommands.jsont   commandt   subcommandst   jsonR   t   version_infoR)   R   R   R   R#   R/   R4   R5   R6   (    (    (    sH   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_json.pyt   <module>   s$   " 
				 			