ó
<…6ic           @   s½   d  d l  Z d  d l Z d  d l Z i  Z d a d Z d a d a	 d a
 d a d a d a e ƒ  Z d „  Z d e f d „  ƒ  YZ d „  Z d „  Z d „  Z d	 „  Z e j j d
 e ƒ d S(   iÿÿÿÿNi    c         C   s3   t  d k r d St |  t ƒ r/ t j |  ƒ n  d S(   s=   
    Takes the name of a statement that is about to run.
    N(   t   nodet   Nonet
   isinstancet
   basestringt   labelst   add(   t   name(    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyt	   take_name8   s    t   TestJumpc           B   s   e  Z d  Z d „  Z RS(   sA   
    An exception that is raised in order to jump to `node`.
    c         C   s   | |  _  d  S(   N(   R    (   t   selfR    (    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyt   __init__I   s    (   t   __name__t
   __module__t   __doc__R
   (    (    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyR   D   s   c         C   s9   |  t  k r t  |  St d j |  | j | j ƒ ƒ ‚ d S(   sk   
    Tries to look up the name with `target`. If found, returns it, otherwise
    raises an exception.
    s   Testcase {} not found at {}:{}.N(   t	   testcasest	   Exceptiont   formatt   filenamet
   linenumber(   R   t	   from_node(    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyt   lookupM   s    c         C   s    x{ t  r} yL | d k r- | j ƒ  } |  } n  | d k r= Pn  | j | |  | ƒ } PWq t k
 ry } | j } d } q Xq W| d k r“ d } n  | | | f S(   s1   
    Performs one execution cycle of a node.
    N(   t   TrueR   t   startt   executeR   R    (   t   nowR    t   stateR   t   e(    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyt   execute_nodeY   s    				c          C   s  t  j j j }  t d k r d St  j j j r< |  j	 r< d S|  j
 rX t  j j
 d ƒ n t  j j
 d ƒ x- t j j ƒ  D] } t | d t ƒ rx d Sqx Wt rÀ t } d a t  j j j | ƒ n  t  j j j ƒ  } t | t t t ƒ \ a a a t j ƒ  t d k rt  j j j ƒ  d St  j j ƒ  } t t k sAt | k rJ| a  n  t a | a | t  |  j! k rŒt" d j# t$ d t$ d ƒ ƒ ‚ n  d S(   sN   
    Called periodically by the test code to generate events, if desired.
    Ng      $@t   tests   Testcase stuck at {}:{}.i    i   (%   t   renpyR   t   testastt   _testR    R   t   displayt	   interfacet   suppress_underlayt   forcet   maximum_frameratet   exportst   pygame_sdl2t   eventt   copy_event_queuet   getattrt   Falset   actiont   behaviort   runt   coret   get_timeR   R   t
   start_timeR   t   cleart	   testmouset   resett   get_filename_linet	   old_statet   old_loct   last_state_changet   timeoutR   R   t   node_loc(   R   R   t
   old_actionR   t   loc(    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyR   v   s8    	
	c          C   s{   t  j j d d ƒ }  |  j d d d d d d d ƒ|  j ƒ  } | j t k rj t d	 j | j ƒ ƒ ‚ n  t | j a	 t
 S(
   sj   
    The dialogue command. This updates dialogue.txt, a file giving all the dialogue
    in the game.
    t   descriptions   Runs a testcase.t   testcaset   helps   The name of a testcase to run.t   nargst   ?t   defaults   Testcase {} was not found.(   R   t	   argumentst   ArgumentParsert   add_argumentt
   parse_argsR=   R   R   R   R    R   (   t   apt   args(    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyt   test_command°   s    R   (   t   renpy.displayR   t
   renpy.testR&   R   R   R    R9   R   R5   R6   R7   R0   R+   t   setR   R   R   R   R   R   R   RH   RB   t   register_command(    (    (    sg   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\test\testexecution.pyt   <module>   s&   						:	