
Rc           @   s0  d  Z  d d l Z d d l m Z d d l m Z m Z m Z m Z m	 Z	 d d l
 m Z m Z m Z m Z d d l m Z m Z m Z m Z m Z e   Z e r d   Z n e Z d e f d	     YZ d
 e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d   Z d S(   s   
    jinja2.testsuite.lexnparse
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    All the unittests regarding lexing, parsing and syntax.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
iN(   t   JinjaTestCase(   t   Environmentt   Templatet   TemplateSyntaxErrort   UndefinedErrort   nodes(   t   nextt	   iteritemst	   text_typet   PY2(   t   Tokent   TokenStreamt	   TOKEN_EOFt   TOKEN_BLOCK_BEGINt   TOKEN_BLOCK_ENDc         C   s   t  |   d S(   Ni   (   t   repr(   t   string(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   jinja_string_repr   s    t   TokenStreamTestCasec           B   s>   e  Z e d  e d  e d e d  g Z d   Z d   Z RS(   i   t    i   c         C   s-   t  |  j d d  } t |  t |  d  S(   Nt   foot   bar(   R   t   test_tokensR   (   t   selft   ts(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_simple%   s    

c         C   s/   g  t  |  j d d  D] } | j ^ q } d  S(   NR   R   (   R   R   t   type(   R   t   tt   token_types(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_iter3   s    +(   t   __name__t
   __module__R
   R   R   R   R   R   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR       s   	t   LexerTestCasec           B   sY   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   c         C   s   t  j d  } d  S(   NsH   {% raw %}foo{% endraw %}|{%raw%}{{ bar }}|{% baz %}{%       endraw    %}(   t   envt   from_string(   R   t   tmpl(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_raw1:   s    c         C   s   t  j d  } d  S(   Ns'   1  {%- raw -%}   2   {%- endraw -%}   3(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_raw2?   s    c         C   s(   t  d d d d  } | j d  } d  S(   Ns   {%s   %}s   ${t   }sC   {% for item in seq
            %}${{'foo': item}|upper}{% endfor %}(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_balancingC   s    	c         C   s(   t  d d d d  } | j d  } d  S(   Ns   <!--s   -->t   {R&   sG   <ul>
<!--- for item in seq -->
  <li>{item}</li>
<!--- endfor -->
</ul>(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_commentsI   s    	c         C   s.   x' d D] } t  j d t |   } q Wd  S(	   Nu    u   ♨u   äu   	u   u   
s   {{ %s }}(   u    u   ♨u   äu   	u   u   
(   R!   R"   R   (   R   t   charR#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_string_escapesT   s    c         C   s#   d d l  m } t j d  } d  S(   Ni(   t   pformatu&   {{ 'foo'|pprint }}|{{ 'bär'|pprint }}(   t   pprintR,   R!   R"   (   R   R,   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_bytefallbackZ   s    c         C   sc   d d l  m } xL t |  D]> \ } } | d k r; q n  t j j d |  } t |  q Wd  S(   Ni(   t	   operatorss   ([{}])s   {{ %s }}(   t   jinja2.lexerR/   R   R!   t   lexert   tokenizeR   (   R   R/   t   testt   expectt   stream(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_operators_   s    
c         C   s?   x8 d D]0 } t  d |  } | j d  } | j   } q Wd  S(   Ns   s   
s   
t   newline_sequences	   1
2
3
4
(   s   s   
s   
(   R   R"   t   render(   R   t   seqR!   R#   t   result(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_normalizingh   s
    c         C   s   x t  t g D] } t d |  } xs d i  f d i  f d i d t 6f d i d t 6f g D]9 \ } } | j |  } | j | |  } | j   } q[ Wq Wd  S(   Nt   keep_trailing_newlineR   s
   no
newlines   with
newline
s   with
newlines   with
several


s   with
several

(   t   Truet   FalseR   R"   t   getR8   (   R   t   keepR!   t   templatet   expectedR#   R4   R:   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_trailing_newlineo   s    		 (   R   R   R$   R%   R'   R)   R+   R.   R6   R;   RC   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR    8   s   									t   ParserTestCasec           B   sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C   s.   t  d d d d d d  } | j d  } d  S(   Ns   <?s   ?>s   <?=s   <!--s   -->s_   <!-- I'm a comment, I'm not interesting --><? for item in seq -?>
    <?= item ?>
<?- endfor ?>(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_php_syntax   s    	c         C   s.   t  d d d d d d  } | j d  } d  S(   Ns   <%s   %>s   <%=s   <%#s]   <%# I'm a comment, I'm not interesting %><% for item in seq -%>
    <%= item %>
<%- endfor %>(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_erb_syntax   s    	c         C   s.   t  d d d d d d  } | j d  } d  S(   Ns   <!--s   -->s   ${R&   s   <!--#sb   <!--# I'm a comment, I'm not interesting --><!-- for item in seq --->
    ${item}
<!--- endfor -->(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_comment_syntax   s    	c         C   s   t  j d  } d  S(   Ns   {{{'foo':'bar'}.foo}}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR'      s    c         C   s   t  j d  } d  S(   NsR   {# foo comment
and bar comment #}
{% macro blub() %}foo{% endmacro %}
{{ blub() }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_start_comment   s    	c      	   C   sa   t  d d d d d d d  } | j d  } t  d d d d d d d d  } | j d	  } d  S(
   Ns   <%s   %>s   ${R&   s   <%#t   %s>   <%# regular comment %>
% for item in seq:
    ${item}
% endfors   ##sW   <%# regular comment %>
% for item in seq:
    ${item} ## the rest of the stuff
% endfor(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_line_syntax   s    	!	c      	   C   sd   t  d d d d d d d d  } | j d	  } t  d d d d d d d d  } | j d
  } d  S(   Ns   {%s   %}s   ${R&   s   /*s   */s   ##t   #sw   /* ignore me.
   I'm a multiline comment */
## for item in seq:
* ${item}          # this is just extra stuff
## endfors   /* ignore me.
   I'm a multiline comment */
# for item in seq:
* ${item}          ## this is just extra stuff
    ## extra stuff i just want to ignore
# endfor(   R   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_line_syntax_priority   s    !	!	c         C   s[   d   } | d d  | d d  | d d  | d d	  | d
 d  | d d  d  S(   Nc         S   s(   y t  |   Wn t k
 r# } n Xd  S(   N(   R   R   (   t   codeRB   t   e(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   assert_error   s
    s#   {% for item in seq %}...{% endif %}s   Encountered unknown tag 'endif'. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.s<   {% if foo %}{% for item in seq %}...{% endfor %}{% endfor %}s   Encountered unknown tag 'endfor'. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.s   {% if foo %}s   Unexpected end of template. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.s   {% for item in seq %}s   Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.s   {% block foo-bar-baz %}sp   Block names in Jinja have to be valid Python identifiers and may not contain hyphens, use an underscore instead.s   {% unknown_tag %}s&   Encountered unknown tag 'unknown_tag'.(    (   R   RO   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_error_messages   s    	(
   R   R   RE   RF   RG   R'   RH   RJ   RL   RP   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyRD   }   s   										t   SyntaxTestCasec           B   s1  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" RS(!   c         C   s,   t    } d   | j d <| j d  } d  S(   Nc         S   s   |  | | | | S(   N(    (   t   at   bt   cRN   t   g(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   <lambda>   s    R   s2   {{ foo('a', c='d', e='f', *['b'], **{'g': 'h'}) }}(   R   t   globalsR"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_call   s    	c         C   s   t  j d  } d  S(   Ns(   {{ [1, 2, 3][:] }}|{{ [1, 2, 3][::-1] }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_slicing   s    c         C   s   t  j d  } d  S(   Ns   {{ foo.bar }}|{{ foo['bar'] }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_attr   s    c         C   s   t  j d  } d  S(   Ns   {{ foo[0] }}|{{ foo[-1] }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_subscript   s    c         C   s   t  j d  } d  S(   Ns    {{ () }}|{{ (1,) }}|{{ (1, 2) }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt
   test_tuple   s    c         C   s   t  j d  } d  S(   Ns$   {{ (1 + 1 * 2) - 3 / 2 }}|{{ 2**3 }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_math  s    c         C   s   t  j d  } d  S(   Ns$   {{ 3 // 2 }}|{{ 3 / 2 }}|{{ 3 % 2 }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_div  s    c         C   s   t  j d  } d  S(   Ns   {{ +3 }}|{{ -3 }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt
   test_unary  s    c         C   s   t  j d  } d  S(   Ns   {{ [1, 2] ~ 'foo' }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_concat  s    c         C   s   t  j d  } d  S(   Ns>   {{ 1 > 0 }}|{{ 1 >= 1 }}|{{ 2 < 3 }}|{{ 2 == 2 }}|{{ 1 <= 1 }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_compare  s    c         C   s   t  j d  } d  S(   Ns-   {{ 1 in [1, 2, 3] }}|{{ 1 not in [1, 2, 3] }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_inop  s    c         C   s   t  j d  } d  S(   Ns   {{ [] }}|{{ {} }}|{{ () }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_literals  s    c         C   s   t  j d  } d  S(   Ns8   {{ true and false }}|{{ false or true }}|{{ not false }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt	   test_bool!  s    c         C   s   t  j d  } d  S(   Ns8   {{ (true and false) or (false and true) and not false }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_grouping&  s    c         C   s   t  j d  } d  S(   Ns!   {{ [1, 2, 3].0 }}|{{ [[1]].0.0 }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_django_attr*  s    c         C   s   t  j d  } d  S(   Ns   {{ 0 if true else 1 }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_conditional_expression.  s    c         C   s5   t  j d  } t  j d  } |  j t | j  d  S(   Ns   <{{ 1 if false }}>s   <{{ (1 if false).bar }}>(   R!   R"   t   assert_raisesR   R8   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt!   test_short_conditional_expression2  s    c         C   s   t  j d  } d  S(   Ns   {{ "foo"|upper + "bar"|upper }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_filter_priority9  s    c         C   s   t  d f t  d f t  d f t  d f t  d f t d f t d f t d f t d	 f t d
 f g
 } xH | D]@ \ } } | r |  j t t j d |  qg t j d |  qg Wd  S(   Ns	   *foo, bars
   *foo, *bars   *foo, bar=42s   **foo, *bars
   **foo, bars   foo, bars   foo, bar=42s   foo, bar=23, *argss   a, b=c, *d, **es   *foo, **bars   {{ foo(%s) }}s   foo(%s)(   R=   R>   Rh   R   R!   R"   (   R   t   testst   should_failt   sig(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_function_calls=  s    										c         C   s-   x& d d d d d d d d g D] } q Wd  S(	   Ns   {{ () }}s   {{ (1, 2) }}s   {{ (1, 2,) }}s   {{ 1, }}s
   {{ 1, 2 }}s(   {% for foo, bar in seq %}...{% endfor %}s&   {% for x in foo, bar %}...{% endfor %}s"   {% for x in foo, %}...{% endfor %}(    (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_tuple_exprQ  s    c         C   s   t  j d  } d  S(   Ns)   {{ (1, 2,) }}|{{ [1, 2,] }}|{{ {1: 2,} }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_trailing_comma^  s    c         C   s'   t  j d  |  j t t  j d  d  S(   Ns$   {% block foo %}...{% endblock foo %}s   {% block x %}{% endblock y %}(   R!   R"   Rh   R   (   R   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_block_end_nameb  s    c         C   sX   xQ t  t d  f D]@ } t j d t |  t |  j   t |  j   f  } q Wd  S(   Ns   {{ %s }}|{{ %s }}|{{ %s }}(   R=   R>   t   NoneR!   R"   t   strt   lowert   upper(   R   t   constR#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_constant_casingg  s    	1c         C   s   |  j  t t j d  d  S(   Ns   {{ foo is string is sequence }}(   Rh   R   R!   R"   (   R   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_test_chainingn  s    c         C   s   t  j d  } d  S(   Ns   {{ "foo" "bar" "baz" }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_string_concatenationt  s    c         C   s   t  d  } t j d  } d  S(   Nid   s   {{ not 42 in bar }}(   t   rangeR!   R"   (   R   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt
   test_notinx  s    c         C   s)   d t  f d     Y} t j d  } d  S(   Nt   Fooc           B   s   e  Z d    Z RS(   c         S   s   | S(   N(    (   R   t   x(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   __getitem__  s    (   R   R   R~   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR|   ~  s   s   {{ foo[1, 2] }}(   t   objectR!   R"   (   R   R|   R   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_implicit_subscribed_tuple}  s    c         C   s   t  j d  } d  S(   Ns,   {% raw %}{{ FOO }} and {% BAR %}{% endraw %}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR%     s    c         C   s   t  j d  } d  S(   NsP   {{ true }}|{{ false }}|{{ none }}|{{ none is defined }}|{{ missing is defined }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt
   test_const  s    c         C   s   t  j d  } d  S(   Ns   {{ -1|foo }}(   R!   t   parse(   R   t   node(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_neg_filter_priority  s    c         C   s=   d } d } x* | | f D] } |  j  t t j |  q Wd  S(   Ns   {% set true = 42 %}s!   {% for none in seq %}{% endfor %}(   Rh   R   R!   R"   (   R   t	   constass1t	   constass2R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_const_assign  s    c         C   s   t  j d  } d  S(   NsO   {% set foo = 0 %}{% for item in [1, 2] %}{% set foo = 1 %}{% endfor %}{{ foo }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_localset  s    	c         C   s"   t  j d  } t  j d  } d  S(   Ns   {{ -foo["bar"] }}s   {{ -foo["bar"]|abs }}(   R!   R"   (   R   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_parse_unary  s    (#   R   R   RX   RY   RZ   R[   R\   R]   R^   R_   R`   Ra   Rb   Rc   Rd   Re   Rf   Rg   Ri   Rj   Rn   Ro   Rp   Rq   Rw   Rx   Ry   R{   R   R%   R   R   R   R   R   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyRQ      sB   																																t   LstripBlocksTestCasec           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s(   t  d t d t  } | j d  } d  S(   Nt   lstrip_blockst   trim_blockss!       {% if True %}
    {% endif %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s!       {% if True %}
    {% endif %}(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_trim  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s#       {%+ if True %}
    {%+ endif %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_no_lstrip  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s-       hello{% if True %}
    goodbye{% endif %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_endline  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s%       {% if True %}hello    {% endif %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_inline  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s:       {% if True %}a {% if True %}b {% endif %}c {% endif %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_nested  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s.       abc {% if True %}
        hello{% endif %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_left_chars  s    	c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s&       {% set x = " {% str %} " %}{{ x }}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_embeded_strings  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s   


{% set hello = 1 %}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt%   test_lstrip_preserve_leading_newlines  s    c         C   s(   t  d t d t  } | j d  } d  S(   NR   R   s%       {# if True #}
hello
    {#endif#}(   R   R=   R>   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_comment  s    	c         C   s@   t  d d d d d d d d d t d	 t } | j d
  } d  S(   Ns   <%s   %>s   ${R&   s   <%#RI   s   ##R   R   s%       <% if True %>hello    <% endif %>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt    test_lstrip_angle_bracket_simple  s    c         C   s@   t  d d d d d d d d d t d	 t } | j d
  } d  S(   Ns   <%s   %>s   ${R&   s   <%#RI   s   ##R   R   s'       <%# if True %>hello    <%# endif %>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt!   test_lstrip_angle_bracket_comment  s    c         C   s@   t  d d d d d d d d d t d	 t } | j d
  } d  S(   Ns   <%s   %>s   ${R&   s   <%#RI   s   ##R   R   se       <%# regular comment %>
    <% for item in seq %>
${item} ## the rest of the stuff
   <% endfor %>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_lstrip_angle_bracket  s
    	c         C   s@   t  d d d d d d d d d t d	 t } | j d
  } d  S(   Ns   <%s   %>s   ${R&   s   <%#RI   s   ##R   R   s_       <%#regular comment%>
    <%for item in seq%>
${item} ## the rest of the stuff
   <%endfor%>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt!   test_lstrip_angle_bracket_compact  s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(	   Ns   <?s   ?>s   <?=s   <!--s   -->R   R   sp       <!-- I'm a comment, I'm not interesting -->
    <? for item in seq -?>
        <?= item ?>
    <?- endfor ?>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_php_syntax_with_manual  s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(	   Ns   <?s   ?>s   <?=s   <!--s   -->R   R   sn       <!-- I'm a comment, I'm not interesting -->
    <? for item in seq ?>
        <?= item ?>
    <? endfor ?>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyRE     s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(	   Ns   <?s   ?>s   <?=s   <!--s   -->R   R   sh       <!-- I'm a comment, I'm not interesting -->
    <?for item in seq?>
        <?=item?>
    <?endfor?>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_php_syntax_compact  s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(   Ns   <%s   %>s   <%=s   <%#R   R   se   <%# I'm a comment, I'm not interesting %>
    <% for item in seq %>
    <%= item %>
    <% endfor %>
(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyRF     s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(   Ns   <%s   %>s   <%=s   <%#R   R   sj   <%# I'm a comment, I'm not interesting %>
    <% for item in seq -%>
        <%= item %>
    <%- endfor %>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_erb_syntax_with_manual,  s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(   Ns   <%s   %>s   <%=s   <%#R   R   sk   <%# I'm a comment, I'm not interesting %>
    <%+ for item in seq -%>
        <%= item %>
    <%- endfor %>(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   test_erb_syntax_no_lstrip6  s
    	c         C   s:   t  d d d d d d d t d t } | j d  } d  S(	   Ns   <!--s   -->s   ${R&   s   <!--#R   R   sb   <!--# I'm a comment, I'm not interesting --><!-- for item in seq --->
    ${item}
<!--- endfor -->(   R   R=   R"   (   R   R!   R#   (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyRG   @  s
    	(   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   RE   R   RF   R   R   RG   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR     s*   															
	
	
		
	
c          C   s~   t  j   }  |  j t  j t   |  j t  j t   |  j t  j t   |  j t  j t   |  j t  j t   |  S(   N(	   t   unittestt	   TestSuitet   addTestt	   makeSuiteR   R    RD   RQ   R   (   t   suite(    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyR   J  s    (   t   __doc__R   t   jinja2.testsuiteR    t   jinja2R   R   R   R   R   t   jinja2._compatR   R   R   R	   R0   R
   R   R   R   R   R!   R   R   R   R    RD   RQ   R   R   (    (    (    s>   /usr/lib/python2.7/site-packages/jinja2/testsuite/lexnparse.pyt   <module>
   s   ("(	Eo