σ
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	 j
 j j Z d  d l m Z d  d l m Z m Z m Z d d l m 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 e j j! e j" d d 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_scatter_scriptc          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   scpngt   PNGt   ArgumentParsert
   isinstancet   AssertionError(   R   R	   t   obj(    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt   test_create-   s    c           C` s   t  j j d k s t  d  S(   Nu   png(   R   R   t   nameR   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt	   test_name4   s    c           C` s   t  j j d k s t  d  S(   Nu8   Create standalone PNG files for one or more applications(   R   R   t   helpR   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt	   test_help7   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 PNG 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_png.pyt	   test_args:   s2    											c         C` s§   t  d d   } t |  + t j t   t d d g  Wd  QXWd  QX|  j   \ } } t j ro d } n d } | d | k s t	  | d k s t	  Wd  QXd  S(	   Nt   prefixu   bokeh-png-no-scriptu   bokehu   pngu   too few argumentsu9   the following arguments are required: DIRECTORY-OR-SCRIPTuΈ   usage: bokeh png [-h] [--height HEIGHT] [--width WIDTH] [-o FILENAME]
                 [--args ...]
                 DIRECTORY-OR-SCRIPT [DIRECTORY-OR-SCRIPT ...]
bokeh png: error: %s
u    (
   R   R   t   pytestt   raisest
   SystemExitR   t
   readouterrt   sixt   PY2R   (   t   capsyst   dirnamet   outt   errt   too_few(    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt   test_no_scriptb   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   pngu
   scatter.pyu    u   scatter.png(   R   R   R(   R   t   sett   ost   listdir(   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt   runv   s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt   test_basic_scripts   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   pngu
   scatter.pyu   --outputu   foo.pngu    (   R   R   R(   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyR4      s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.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   pngu   --outputu   foo.pngu
   scatter.pyu    (   R   R   R(   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyR4      s    u
   scatter.py(   R   R   (   R+   R4   (    (   R+   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt$   test_basic_script_with_output_before   s    	t   reasonu!   capsysbinary not available on Py2c         ` 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   pngu   --outputu   -u
   scatter.pyi    s   PNG(	   R   R   R(   t   lenR   t
   startswithR1   R2   R3   (   R,   R-   R.   (   t   capsysbinary(    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyR4   ‘   s    u
   scatter.py(   R   R   (   R;   R4   (    (   R;   sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.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   pngu   scatter1.pyu   scatter2.pyu   scatter3.pyu    u   scatter1.pngu   scatter2.pngu   scatter3.png(   R   R   R(   R   R1   R2   R3   (   R,   R-   R.   (   R+   (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.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_png.pyt)   test_basic_script_with_multiple_png_plots­   s
    	(%   t
   __future__R    R   R   R   R%   R   R2   R)   t   bokeh.command.subcommands.pngt   commandt   subcommandst   pngR   t   bokeh.command.bootstrapR   t   bokeh._testing.util.filesystemR   R   R   t    R   R   R   R   R#   R0   t   markt   unitt   seleniumR5   R6   R7   t   skipifR*   R<   R=   (    (    (    sG   lib/python2.7/site-packages/bokeh/command/subcommands/tests/test_png.pyt   <module>   s2   " 				(						*	