
    @6i\                        d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
 dd	d
ddddZi dddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0i d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRZdSdTdUdVdWdXdYdZd[d\d]d^d_d`daZdbdcdddedfdgdhZ G di dje      Z G dk dl edlej"                  fi             Z G dm dne      Z G do dpe      Z G dq dre      Z G ds dte      Z G du dve      Z G dw dxe      Z G dy dze      Zd{ Zed|k(  r ej8                          yy)}a  
Copyright (c) 2013, Dave Mankoff
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of Dave Mankoff nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DAVE MANKOFF BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    )unicode_literalsN)htmlmin)HTMLMinMiddleware   )test_escape)z  a  bz a b)a  When doing     test-driven development, or
    running automated builds that need testing before they are  deployed
		 for downloading or use, it's often useful to be able to run a project's
unit tests without actually deploying the project anywhere.


The
test command runs project's unit tests without actually deploying it, by
    temporarily putting the project's source on sys.path, after first running
     build_ext -i to ensure that any C extensions are built.

    a  When doing test-driven development, or running automated builds that need testing before they are deployed for downloading or use, it's often useful to be able to run a project's unit tests without actually deploying the project anywhere. The test command runs project's unit tests without actually deploying it, by temporarily putting the project's source on sys.path, after first running build_ext -i to ensure that any C extensions are built. )zQ <body> <b>  a <i pre>b  </i><pre>   x </pre> <textarea>   Y  </textarea></body> zL <body> <b> a <i>b  </i><pre>   x </pre> <textarea>   Y  </textarea></body> )z+

<!DOCTYPE html>

<body>   X   Y   </body>z!<!DOCTYPE html><body> X Y </body>)<p>first pager   )<html><p>next pager	   )simple_text	long_textsimple_htmlwith_doctypedangling_tagdangling_tag_followupremove_quotes)z@<body  >  <div id="x" style="   abc " data-a=b></div></  body>  z8<body> <div id=x style="   abc " data-a=b></div></body> !remove_quotes_drop_trailing_slash)z<div x="x/" y="y/"></div>z<div x=x/ y=y/ ></div>%remove_quotes_keep_space_before_slash)z<foo x="x/"/>z<foo x=x/ />remove_single_quotes)z&<body><div thing='what'></div></body> z$<body><div thing=what></div></body> keep_nested_single_quotes)'<body><div thing="wh'at"></div></body> r   remove_tag_name_whitespace)z<<body  >  <br   />  <textarea  >   </ textarea  ></  body>  z,<body> <br> <textarea>   </textarea></body> no_reduce_empty_attributes)(<body><img src="/x.png" alt="" /></body>z$<body><img src=/x.png alt=""></body>&no_reduce_empty_attributes_keep_quotes)r   z&<body><img src="/x.png" alt=""></body>reduce_empty_attributes)r   z!<body><img src=/x.png alt></body>keep_boolean_attributes)/<body><input id="x" disabled="disabled"></body>z+<body><input id=x disabled=disabled></body>reduce_boolean_attributes)r   z"<body><input id=x disabled></body>remove_close_tags)z+<body><br></br><br pre>   x   </br> </body>z<body><br><br>   x   </body>remove_comments)zG<body> this text should <!-- X --> have <!----> comments removed</body>z4<body> this text should have comments removed</body>keep_comments)zB<body> this text should <!--! not --> have comments removed</body>zA<body> this text should <!-- not --> have comments removed</body>keep_empty_comments)E<body> this text should not<!----> have empty comments removed</body>r"   keep_conditional_comments)`<body>keep IE conditional styles <!--[if IE8]><style>h1 {color: red;}</style><![endif]--></body>r$   remove_nonconditional_comments)zf<body>remove other [if] things <!-- so [if IE8]--><style>h1 {color: red;}</style><!--[endif]--></body>zE<body>remove other [if] things <style>h1 {color: red;}</style></body>keep_optional_attribute_quotes)z0<img width="100" height="50" src="#something" />z.<img width="100" height="50" src="#something"> remove_optional_attribute_quotes))z;<td data-text="&lt;script&gt;alert('123');&lt;/script&gt;">z/<td data-text="<script>alert('123');</script>">)z9<td data-text="&lt;script&gt;alert(123);&lt;/script&gt;">z-<td data-text="<script>alert(123);</script>">keep_pre_attribute)zB<body>the <strong pre   style="">pre</strong> should stay  </body>z<<body>the <strong pre style>pre</strong> should stay </body>custom_pre_attribute)zG<body>the <strong pre  >   X  </strong><span custom>  Y  </span></body>z;<body>the <strong pre> X </strong><span>  Y  </span></body>
keep_empty)zF<body> <div id="x"  >  A </div>  <div id="  y ">  B    </div>  </body>z;<body> <div id=x> A </div> <div id="  y "> B </div> </body>remove_empty)zh<body>  
  <div id="x"  >  A </div><div id="  y ">  B    </div>
  <div> C </div>  <div>D</div> </body>zT<body><div id=x> A </div><div id="  y "> B </div><div> C </div> <div>D</div> </body>remove_all_empty)zf<body>  
  <div id=x  >  A </div><div id="  y ">  B    </div>
  <div> C </div>  <div>D</div> </body>zR<body><div id=x> A </div><div id="  y "> B </div><div> C </div><div>D</div></body>dont_minify_div)z#<body>  <div>   X  </div>   </body>z <body> <div>   X  </div> </body>
minify_pre)z#<body>  <pre>   X  </pre>   </body>z<body> <pre> X </pre> </body>remove_head_spaces)z:<head>  <title>   &#x2603;X  Y  &amp;  Z </title>  </head>z/<head><title>&#x2603;X Y &amp; Z</title></head>dont_minify_scripts_or_styles)z><body>  <script>   X  </script>  <style>   X</style>   </body>z:<body> <script>   X  </script> <style>   X</style> </body>remove_close_from_tags)z<body> <area/> <base/> <br /> <col/><command /><embed /><hr/> <img />   <input   /> <keygen/> <meta  /><param/><source/><track  /><wbr />  </body>zt<body> <area> <base> <br> <col><command><embed><hr> <img> <input> <keygen> <meta><param><source><track><wbr> </body>"remove_space_from_self_closed_tags)z!<body>    <y />   <x    /></body>z<body> <y/> <x/></body>remove_redundant_lang_0)zo<html><body lang=en><p lang=en>This is an example.<p lang=pl>I po polsku <span lang=el>and more English</span>.zg<html><body lang=en><p>This is an example.<p lang=pl>I po polsku <span lang=el>and more English</span>.convert_charrefs);<input value="&#34;&#39;&#39;&#39;&lt;&#46;&pi;&gt; &#34;">u#   <input value="&#34;'''<.π> &#34;">convert_charrefs_false)r5   r5   dont_convert_pre_attr)z?<input pre-value="&#34;&#39;&#39;&#39;&lt;&#46;&pi;&gt; &#34;">z9<input value=&#34;&#39;&#39;&#39;&lt;&#46;&pi;&gt; &#34;>)z<body>  <p pre  >  X  <p>  Y  z<body> <p>  X  <p> Y )z9<body> <ul>  <li pre  >  X  <li>  Y  <li pre>  Z</ul>   Qz*<body> <ul> <li>  X  <li> Y <li>  Z</ul> Q)z><body> <dl>  <dt pre  >  X  <dt>  Y  <dt pre>  Z</dt></dl>   Qz/<body> <dl> <dt>  X  <dt> Y <dt>  Z</dt></dl> Q)z9<body> <dl>  <dd pre  >  X  <dd>  Y  <dd pre>  Z</dl>   Qz*<body> <dl> <dd>  X  <dd> Y <dd>  Z</dl> Q)z<body>   <select  a >  <optgroup pre>   <option>   X</option>   <optgroup>   <option>   Y</option> </optgroup> </select>   </body>zs<body> <select a> <optgroup>   <option>   X</option>   <optgroup> <option> Y</option> </optgroup> </select> </body>)zW<body>   <select  a >  <option pre  >   X    <option> Y    </option></select>   </body>zG<body> <select a> <option>   X    <option> Y </option></select> </body>)z1<body>  <table>  <colgroup pre>   </table></body>z+<body> <table> <colgroup>   </table></body>)zm<body>  <table>   <tbody pre>  <tr>  <td> X  </td></tr>  

  <tbody>   <tr>   <td>Y   </td></tr>


   </body>z[<body> <table> <tbody>  <tr>  <td> X  </td></tr>  

  <tbody> <tr> <td>Y </td></tr> </body>)zf<body>  <table>   <thead pre>  <tr>  <td> X  </td></tr>    <tbody>   <tr>   <td>Y   </td></tr> </body>zY<body> <table> <thead>  <tr>  <td> X  </td></tr>    <tbody> <tr> <td>Y </td></tr> </body>)zf<body>  <table>   <tfoot pre>  <tr>  <td> X  </td></tr>    <tbody>   <tr>   <td>Y   </td></tr> </body>zY<body> <table> <tfoot>  <tr>  <td> X  </td></tr>    <tbody> <tr> <td>Y </td></tr> </body>)zU<body>  <table>   <thead>  <tr pre >  <td> X  </td>      <tr>   <td>Y   </td> </body>zH<body> <table> <thead> <tr>  <td> X  </td>      <tr> <td>Y </td> </body>)zC<body>  <table>   <thead>  <tr>  <td  pre> X       <td>Y    </body>z6<body> <table> <thead> <tr> <td> X       <td>Y </body>)zC<body>  <table>   <thead>  <tr>  <th pre> X        <th>Y    </body>z7<body> <table> <thead> <tr> <th> X        <th>Y </body>)z.<body><a>   <p pre>  X  </a>    <p>   Y</body>z&<body><a> <p>  X  </a>    <p> Y</body>)p_self_closeli_self_closedt_self_closedd_self_closeoptgroup_self_closeoption_self_closecolgroup_self_closetbody_self_closethead_self_closetfoot_self_closetr_self_closetd_self_closeth_self_closea_p_interaction)z&<head></head><body>  X  </body></html>z$<head></head><body> X </body></html>)z    </head><body>  X  </body>z </head><body> X </body>)z   X  </body>z
 X </body>)z.<body>  <table>  </colgroup>   </table></body>z*<body> <table> </colgroup> </table></body>)z+<body>  <table>  </tbody>   </table></body>z'<body> <table> </tbody> </table></body>)zB<body><div pre>   X  </p>   </div><div>    Y   </p>  </div></body>z8<body><div>   X  </p>   </div><div> Y </p> </div></body>)html_closed_no_openhead_closed_no_openbody_closed_no_opencolgroup_self_opentbody_self_openp_closed_no_openc                       e Zd Zd Zy)HTMLMinTestMetac                     d }|j                  di       j                         D ]  \  }}d|z   |vs ||      |d|z   <    t        j                  | t	        |      ||      S )Nc                       fd}|S )Nc                 T    | j                  | j                  d         d          y )Nr   r   )assertEqualminifyselftexts    V/home/azureuser/techstart-app/venv/lib/python3.12/site-packages/htmlmin/tests/tests.py
inner_testz>HTMLMinTestMeta.__new__.<locals>.make_test.<locals>.inner_testT  s$    T!W-tAw7     )rU   rW   s   ` rV   	make_testz*HTMLMinTestMeta.__new__.<locals>.make_testS  s    8rX   __reference_texts__test_)getitemstype__new__str)clsnamebasesdctrZ   kvs          rV   r`   zHTMLMinTestMeta.__new__R  si    
 -b1779 &1	#	"1GAI& <<SYs33rX   N)__name__
__module____qualname__r`   rY   rX   rV   rM   rM   Q  s    	4rX   rM   c                       e Zd Zd Zy)HTMLMinTestCasec                 .    t         j                  | _        y N)r   rR   rT   s    rV   setUpzHTMLMinTestCase.setUp_  s    ..DKrX   N)rh   ri   rj   rp   rY   rX   rV   rl   rl   ]  s    !rX   rl   c                       e Zd ZeZd Zd Zy)TestMinifyFunctionc                     dd l }|j                  dd      5 }|j                         }d d d        | j                        }| j	                  t        |      t        |      z
  d       y # 1 sw Y   BxY w)Nr   htmlmin/tests/large_test.htmlutf-8encodingi$  codecsopenreadrR   rQ   lenrT   ry   inpfinpouts        rV   test_basic_minification_qualityz2TestMinifyFunction.test_basic_minification_qualitye  sc    	4w	G 4IIKc
++c
CSXC($/ s   A**A3c                     dd l }|j                  dd      5 }|j                         }d d d        | j                  dd      }| j	                  t        |      t        |      z
  d       y # 1 sw Y   ExY w)Nr   rt   ru   rv   T)remove_all_empty_spacer   i0  rx   r}   s        rV   test_high_minification_qualityz1TestMinifyFunction.test_high_minification_qualityl  si    	4w	G 4IIKc
++c$+
MCSXC(%0 s   A--A6N)rh   ri   rj   MINIFY_FUNCTION_TEXTSr[   r   r   rY   rX   rV   rr   rr   b  s    -01rX   rr   c                   (    e Zd ZeZd Zd Zd Zd Zy)TestMinifierObjectc                     t         j                  |        t        j                         | _        | j                  j
                  | _        y rn   )rl   rp   r   MinifierminifierrR   ro   s    rV   rp   zTestMinifierObject.setUpv  s1    $$$&DM--&&DKrX   c                     | j                   d   }| j                  | j                  |d         |d          | j                  | j                  |d         |d          y )Nr
   r   r   r[   rQ   rR   rS   s     rV   
test_reusezTestMinifierObject.test_reuse{  sT    ##M2DT[[a)473T[[a)473rX   c                     | j                   d   }| j                   d   }| j                  | j                  |d         |d          | j                  | j                  |d         |d          y )Nr   r   r   r   r   )rT   r   r   s      rV   test_dangling_tagz$TestMinifierObject.test_dangling_tag  sk    ++N;L 445LMT[[a1<?CT[[!6q!9:<QRS<TUrX   c                 <   | j                   d   }| j                  j                  |d   d t        |d         dz          | j                  j                  |d   t        |d         dz  d         | j	                  | j                  j                         |d          y )Nr   r      r   )r[   r   inputr|   rQ   finalizerS   s     rV   test_buffered_inputz&TestMinifierObject.test_buffered_input  s    ##K0DMMQ 2T!W!234MMQDG 1 234T]]++-tAw7rX   N)	rh   ri   rj   r   r[   rp   r   r   r   rY   rX   rV   r   r   s  s    -'
4
V8rX   r   c                       e Zd Z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y)TestMinifyFeaturesc                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr   r   Tr   r   r[   rQ   r   rR   rS   s     rV   test_remove_commentsz'TestMinifyFeatures.test_remove_comments  s6    ##$56DW^^DGTBDGLrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr   r   Fr   r   r   rS   s     rV   test_no_reduce_empty_attributesz2TestMinifyFeatures.test_no_reduce_empty_attributes  s7    ##$@ADW^^DGUKTRSWUrX   c                 ~    | j                   d   }| j                  t        j                  |d   dd      |d          y )Nr   r   F)r   r'   r   r   rS   s     rV   +test_no_reduce_empty_attributes_keep_quotesz>TestMinifyFeatures.test_no_reduce_empty_attributes_keep_quotes  s<    ##$LMDW^^DGUmrsuyz{u|}rX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr   r   Tr   r   r   rS   s     rV   test_reduce_empty_attributesz/TestMinifyFeatures.test_reduce_empty_attributes  s7    ##$=>DW^^DGTJDQRGTrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr   r   T)r   r   r   rS   s     rV   test_reduce_boolean_attributesz1TestMinifyFeatures.test_reduce_boolean_attributes  s7    ##$?@DW^^DGtLdSTgVrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr    r   Tr   r   r   rS   s     rV   test_keep_commentsz%TestMinifyFeatures.test_keep_comments  s5    ##O4DW^^DGTBDGLrX   c                 x    | j                   d   }| j                  t        j                  |d         |d          y )Nr!   r   r   r   rS   s     rV   test_keep_empty_commentsz+TestMinifyFeatures.test_keep_empty_comments  s4    ##$9:DW^^DG,d1g6rX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr#   r   Tr   r   r   rS   s     rV   test_keep_conditional_commentsz1TestMinifyFeatures.test_keep_conditional_comments  s6    ##$?@DW^^DGTBDGLrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr%   r   Tr   r   r   rS   s     rV   #test_remove_nonconditional_commentsz6TestMinifyFeatures.test_remove_nonconditional_comments  s6    ##$DEDW^^DGTBDGLrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr&   r   Fr'   r   r   rS   s     rV   #test_keep_optional_attribute_quotesz6TestMinifyFeatures.test_keep_optional_attribute_quotes  s9    ##$DEDW^^DGeTVZ[\V]^rX   c                     | j                   d   }|D ]/  }| j                  t        j                  |d   d      |d          1 y )Nr'   r   Tr   r   r   )rT   textsrU   s      rV   %test_remove_optional_attribute_quotesz8TestMinifyFeatures.test_remove_optional_attribute_quotes  sK    $$%GHE `
w~~d1gPTUW[\]W^_`rX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr(   r   T)keep_prer   r   rS   s     rV   test_keep_pre_attributez*TestMinifyFeatures.test_keep_pre_attribute  s6    ##$89DW^^DGd;T!WErX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr)   r   custom)pre_attrr   r   rS   s     rV   test_custom_pre_attributez,TestMinifyFeatures.test_custom_pre_attribute  s6    ##$:;DW^^DGh?aIrX   c                 x    | j                   d   }| j                  t        j                  |d         |d          y )Nr*   r   r   r   rS   s     rV   test_keep_emptyz"TestMinifyFeatures.test_keep_empty  s3    ##L1DW^^DG,d1g6rX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr+   r   T)remove_empty_spacer   r   rS   s     rV   test_remove_emptyz$TestMinifyFeatures.test_remove_empty  s5    ##N3DW^^DGEtAwOrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr,   r   T)r   r   r   rS   s     rV   test_remove_all_emptyz(TestMinifyFeatures.test_remove_all_empty  s9    ##$67DW^^DGDI!WrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr-   r   divpre_tagsr   r   rS   s     rV   test_dont_minify_divz'TestMinifyFeatures.test_dont_minify_div  s6    ##$56DW^^DGh?aIrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr.   r   r   r   r   r   rS   s     rV   test_minify_prez"TestMinifyFeatures.test_minify_pre  s5    ##L1DW^^DGh?aIrX   c                 x    | j                   d   }| j                  t        j                  |d         |d          y )Nr/   r   r   r   rS   s     rV   test_remove_head_spacesz*TestMinifyFeatures.test_remove_head_spaces  s4    ##$89DW^^DG,d1g6rX   c                 |    | j                   d   }| j                  t        j                  |d   g       |d          y )Nr0   r   r   r   r   rS   s     rV   "test_dont_minify_scripts_or_stylesz5TestMinifyFeatures.test_dont_minify_scripts_or_styles  s6    ##$CDDW^^DGb947CrX   c                 |    | j                   d   }| j                  t        j                  |d   d      |d          y )Nr6   r   F)r4   r   r   rS   s     rV   test_convert_charrefs_falsez.TestMinifyFeatures.test_convert_charrefs_false  s6    ##$<=DW^^DGeDd1gNrX   N)rh   ri   rj   FEATURES_TEXTSr[   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rY   rX   rV   r   r     s    &MV~UWM7MM_`
FJ7P
JJ7DOrX   r   c                       e Zd ZeZy)TestSelfClosingTagsN)rh   ri   rj   SELF_CLOSE_TEXTSr[   rY   rX   rV   r   r     s    (rX   r   c                       e Zd ZeZy)TestSelfOpeningTagsN)rh   ri   rj   SELF_OPENING_TEXTSr[   rY   rX   rV   r   r     s    *rX   r   c                       e Zd Zd Zd Zy)TestDecoratorc                 J    t         d        }| j                  d |              y )Nc                       y)Nz   X   Y   rY   rY   rX   rV   directly_decoratedz?TestDecorator.test_direct_decorator.<locals>.directly_decorated  s    rX    X Y htmlmindecoratorrQ   rT   r   s     rV   test_direct_decoratorz#TestDecorator.test_direct_decorator  s*      	W023rX   c                 V    t        d      d        }| j                  d |              y )NTr   c                       y)Nz   X <!-- Removed -->  Y   rY   rY   rX   rV   r   z@TestDecorator.test_options_decorator.<locals>.directly_decorated  s    *rX   r   r   r   s     rV   test_options_decoratorz$TestDecorator.test_options_decorator  s/    d++ ,+ 	W023rX   N)rh   ri   rj   r   r   rY   rX   rV   r   r     s    44rX   r   c                   B    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)TestMiddlewarec                 B    t         j                  |        d }|| _        y )Nc              3   8   K    || d   | d          | d    y w)NstatusheaderscontentrY   )environstart_responses     rV   wsgi_appz&TestMiddleware.setUp.<locals>.wsgi_app  s%     WX&	(:;Is   )rl   rp   r   )rT   r   s     rV   rp   zTestMiddleware.setUp  s    $ DMrX   c                 j    g g dfd	}dj                   ||||d|            }d   d   |fS )Nc                 J    j                  |        j                  |       y rn   )append)r   r   exc_inforesponse_headersresponse_statuss      rV   r   z/TestMiddleware.call_app.<locals>.start_response  s    V$g&rX    )r   r   r   r   rn   )join)	rT   appr   r   r   r   response_bodyr   r   s	          @@rV   call_appzTestMiddleware.call_app  sV    O' GGC6,3,3!5 !/0 1M 1/2MAArX   c                     t        | j                        }| j                  |ddd      \  }}}| j                  |d       y )N200 OKzContent-Typez	text/html    X    Y   r   r   r   r   rQ   rT   r   r   r   bodys        rV   test_middlwarezTestMiddleware.test_middlware  sB    
DMM
*C MM	85FGT 	T7#rX   c                     t        | j                  d      }| j                  |ddd      \  }}}| j                  |d       y )NTr   r   r   z    X    Y   <!-- Z -->r   r   r   s        rV   test_middlware_minifier_optionsz.TestMiddleware.test_middlware_minifier_options  sD    
DMM4
@C MM	85!FGT 	T7#rX   c                     t        | j                  d      }| j                  |ddd      \  }}}| j                  |d       y )NF
by_defaultr   r   r   r   r   s        rV   test_middlware_off_by_defaultz,TestMiddleware.test_middlware_off_by_default  sD    
DMMe
<C MM	85FGT 	T?+rX   c                     t        | j                  d      }| j                  |ddd      \  }}}| j                  |d       y )NFr  r   )r   )X-HTML-Min-EnableTruer   r   r   r   s        rV   test_middlware_on_by_headerz*TestMiddleware.test_middlware_on_by_header&  sH    
DMMe
<C MM	8 
 FGT 	T7#rX   c                     t        | j                        }| j                  |ddd      \  }}}| j                  |d       y )Nr   r   r  Falser   r   r   s        rV   test_middlware_off_by_headerz+TestMiddleware.test_middlware_off_by_header0  sF    
DMM
*C MM	8 
 FGT 	T?+rX   c                     t        | j                        }| j                  |ddd      \  }}}| j                  t	        d |D                     y )Nr   r  r   c              3   ,   K   | ]  \  }}|d k(    ywr  NrY   .0hrg   s      rV   	<genexpr>z>TestMiddleware.test_middlware_remove_header.<locals>.<genexpr>B  s     Gtq!!22G   )r   r   r   assertFalseanyr   s        rV   test_middlware_remove_headerz+TestMiddleware.test_middlware_remove_header:  sO    
DMM
*C MM	8 
 FGT 	SGwGHIrX   c                     t        | j                  d      }| j                  |dddgd      \  }}}| j                  t	        d |D                     y )NT)keep_headerr   r   r  r   c              3   ,   K   | ]  \  }}|d k(    ywr  rY   r  s      rV   r  z<TestMiddleware.test_middlware_keep_header.<locals>.<genexpr>L  s     Fda11Fr  )r   r   r   
assertTruer  r   s        rV   test_middlware_keep_headerz)TestMiddleware.test_middlware_keep_headerD  sU    
DMMt
<C MM	8%&
 FGT 	OOCFgFGHrX   N)rh   ri   rj   rp   r   r   r  r  r	  r  r  r  rY   rX   rV   r   r     s2    
B$$,$,JIrX   r   c                     t        j                         j                  t              } t        j                         j                  t              }t        j                         j                  t
              }t        j                         j                  t              }t        j                         j                  t              }t        j                         j                  t              }t        j                         j                  t              }t        j                  | ||||||t        j                         g      S rn   )unittest
TestLoaderloadTestsFromTestCaserr   r   r   r   r   r   r   	TestSuiter   suite)minify_function_suiteminifier_object_suiteminify_features_suiteself_closing_tags_suiteself_opening_tags_suitedecorator_suitemiddleware_suites          rV   r$  r$  N  s   $//101 $//101 $//101 &11312 &11312 ))+m, **,n- 	
 	 	rX   __main__)__doc__
__future__r   r   r   htmlmin.decoratorr   htmlmin.middlewarer   r   r   r   r   r   r   r_   rM   TestCaserl   rr   r   r   r   r   r   r   r$  rh   mainrY   rX   rV   <module>r3     s  6 (   9 0 &M* X[ [
 & ([ * ,[  [&   '[.  !/[6  !7[> + -?[F  G[N  O[V   W[^  _[f  g[n  o[v  w[~   [F # %G[N # %O[V % 	'W[j  k[r  s[z  {[B  C[N  O[Z  [[b  c[j  k[r " $s[z  {[J ' )K[R  S[^  _[f  g[n  o[|CE P
- 8
4d 
4!#h&7&7%:B?!
1 1"8 84WO WOt)/ )+/ +4O 4PI_ PId4 z(--/ rX   