
    w:i                         d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlm	Z	  G d dej
                  Zd Zedk    r ej        d	
           dS dS )    N)TEXT)TemplateSyntaxErrorEXPR)interpolatec                       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S )InterpolateTestCasec                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S )Nbla   r   listr   assertEquallenr   selfpartss     `/var/www/html/trac/venv/lib/python3.11/site-packages/genshi/template/tests/test_interpolation.pytest_interpolate_stringz+InterpolateTestCase.test_interpolate_string   su    [''((CJJ'''uQx{+++a,,,,,    c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )N${bla}r   r   r
   r   r   r   r   r   sourcer   s     r   test_interpolate_simplez+InterpolateTestCase.test_interpolate_simple   x    [**++CJJ'''uQx{+++a 233333r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S )Nz$${bla}r   r   r   r   r   s     r   test_interpolate_escapedz,InterpolateTestCase.test_interpolate_escaped%   su    [++,,CJJ'''uQx{+++58A;/////r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    |                     t
          |d         d                    |                     d|d         d         j                   d S )Nz$$${bla}   r   $r   r
   r   r   r   r   r   r   r   r   s     r   test_interpolate_dobuleescapedz2InterpolateTestCase.test_interpolate_dobuleescaped+   s    [,,--CJJ'''uQx{+++eAhqk***uQx{+++a 233333r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )N$blar   r   r
   r   r   s     r   test_interpolate_shortz*InterpolateTestCase.test_interpolate_short3   sx    [(())CJJ'''uQx{+++a 233333r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S )Nz$$blar   r   r$   r   r   s     r   test_interpolate_short_escapedz2InterpolateTestCase.test_interpolate_short_escaped9   su    [))**CJJ'''uQx{+++q!-----r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S )Nzmy $$bla = 2r   r   zmy $bla = 2r   r   s     r    test_interpolate_short_escaped_2z4InterpolateTestCase.test_interpolate_short_escaped_2?   su    [0011CJJ'''uQx{+++a44444r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    |                     t
          |d         d                    |                     d|d         d         j                   d S )Nz$$$blar   r   r    r   r
   r!   r   s     r   $test_interpolate_short_doubleescapedz8InterpolateTestCase.test_interpolate_short_doubleescapedE   s    [**++CJJ'''uQx{+++eAhqk***uQx{+++a 233333r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz$_blar   r   _blar   r   s     r   /test_interpolate_short_starting_with_underscorezCInterpolateTestCase.test_interpolate_short_starting_with_underscoreM   x    [))**CJJ'''uQx{+++q!!344444r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz$foo_barr   r   foo_barr   r   s     r   ,test_interpolate_short_containing_underscorez@InterpolateTestCase.test_interpolate_short_containing_underscoreS   x    [,,--CJJ'''uQx{+++E!HQK$677777r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S )Nz$.blar   r   r   r   s     r   (test_interpolate_short_starting_with_dotz<InterpolateTestCase.test_interpolate_short_starting_with_dotY   u    [))**CJJ'''uQx{+++%(1+.....r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz$foo.barr   r   zfoo.barr   r   s     r   %test_interpolate_short_containing_dotz9InterpolateTestCase.test_interpolate_short_containing_dot_   r3   r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S Nz$0blar   r   r   r   s     r   *test_interpolate_short_starting_with_digitz>InterpolateTestCase.test_interpolate_short_starting_with_digite   r6   r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S Nz$foo0r   r   foo0r   r   s     r   'test_interpolate_short_containing_digitz;InterpolateTestCase.test_interpolate_short_containing_digitk   r/   r   c                    t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    d S r:   r   r   s     r   r;   z>InterpolateTestCase.test_interpolate_short_starting_with_digitq   r6   r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S r=   r   r   s     r   r?   z;InterpolateTestCase.test_interpolate_short_containing_digitw   r/   r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz${{1:2}}r   r   z{1:2}r   r   s     r   %test_interpolate_full_nested_bracketsz9InterpolateTestCase.test_interpolate_full_nested_brackets}   sx    [,,--CJJ'''uQx{+++%(1+"455555r   c                     	 t          t          d                     |                     d           d S # t          $ r}Y d }~d S d }~ww xY w)Nz${{1:2}zExpected TemplateSyntaxError)r   r   failr   )r   es     r   )test_interpolate_full_mismatched_bracketsz=InterpolateTestCase.test_interpolate_full_mismatched_brackets   sf    	6Y''((( II455555 # 	 	 	DDDDD	s   5 
A
A
c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz${"}"}r   r   z"}"r   r   s     r   "test_interpolate_quoted_brackets_1z6InterpolateTestCase.test_interpolate_quoted_brackets_1   r   r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz${'}'}r   r   z'}'r   r   s     r   "test_interpolate_quoted_brackets_2z6InterpolateTestCase.test_interpolate_quoted_brackets_2   r   r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz
${'''}'''}r   r   z'''}'''r   r   s     r   "test_interpolate_quoted_brackets_3z6InterpolateTestCase.test_interpolate_quoted_brackets_3   sx    [..//CJJ'''uQx{+++E!HQK$677777r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz${'''}"""'''}r   r   z
'''}"""'''r   r   s     r   "test_interpolate_quoted_brackets_4z6InterpolateTestCase.test_interpolate_quoted_brackets_4   sy    [!34455CJJ'''uQx{+++%(1+*<=====r   c                     t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   d S )Nz${'\'}'}r   r   z'\'}'r   r   s     r   "test_interpolate_quoted_brackets_5z6InterpolateTestCase.test_interpolate_quoted_brackets_5   sx    [--..CJJ'''uQx{+++58A;#566666r   c                 N   t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d         j                   |                     t          |d         d                    |                     d|d         d                    |                     t          |d         d                    |                     d|d         d         j                   d S )	Nz$foo bar $baz   r   foor   z bar r   baz)r   r   r   r   r   r   r   r   s     r   test_interpolate_mixed1z+InterpolateTestCase.test_interpolate_mixed1   s    [1122CJJ'''uQx{+++a 2333uQx{+++%(1+...uQx{+++a 233333r   c                 D   t          t          d                    }|                     dt          |                     |                     t          |d         d                    |                     d|d         d                    |                     t
          |d         d                    |                     d|d         d         j                   |                     t          |d         d                    |                     d|d         d                    d S )	Nzfoo $bar bazrS   r   zfoo r   barr   z bazr!   r   s     r   test_interpolate_mixed2z+InterpolateTestCase.test_interpolate_mixed2   s    [0011CJJ'''uQx{+++q!---uQx{+++a 2333uQx{+++q!-----r   c                     t          t          d                    }|                     dt          |                     |                     d|d         d         j                   d S )Nz${"""foo
bar"""}r   z"""foo
bar"""r   )r   r   r   r   r   r   s     r   test_interpolate_triplequotedz1InterpolateTestCase.test_interpolate_triplequoted   s\    [!45566CJJ''')58A;+=>>>>>r   N)__name__
__module____qualname__r   r   r   r"   r%   r'   r)   r+   r.   r2   r5   r8   r;   r?   rC   rG   rI   rK   rM   rO   rQ   rV   rY   r[    r   r   r   r      s       - - -4 4 40 0 04 4 44 4 4. . .5 5 54 4 45 5 58 8 8/ / /8 8 8/ / /5 5 5/ / /5 5 56 6 66 6 64 4 44 4 48 8 8> > >7 7 74 4 4. . .? ? ? ? ?r   r   c                      t          j                    } |                     t          j        t
          j                             |                     t           j                            t                               | S )N)
unittest	TestSuiteaddTestdoctestDocTestSuiter   r]   defaultTestLoaderloadTestsFromTestCaser   )suites    r   rh   rh      sY      E	MM'&{'=>>???	MM(,BBCVWWXXXLr   __main__rh   )defaultTest)rd   sysra   genshi.corer   genshi.template.baser   r   genshi.template.interpolationr   TestCaser   rh   r\   mainr_   r   r   <module>rq      s     



        : : : : : : : : 5 5 5 5 5 5i? i? i? i? i?(+ i? i? i?X   zHMg&&&&&& r   