
    9i=                      v    S SK r S SKrS SKJr  S SKJrJrJrJ	r	J
r
Jr  S SKJr   " S S\R                  5      rg)    N)parseString)
LineStringMultiLineString
MultiPointMultiPolygonPointPolygon)GeometryCollectionc                   D    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
rg)SvgTestCase   c                   ^ UR                   " S0 TD6n [        U5        UR                  5       n [        U5      nSnU(       a  UR                  nUR                  (       a  US-  nUR                  (       d  US-  nT(       a!  USSR                  U4S jT 5       5      -   -  n[        R                  R                  XxS	-   5      n	[        U	S
5       n
U
R                  UR                  5       5        SSS5        XB:X  d   eg! [         a    [        S[	        U5      -   5      ef = f! [         a    [        S[	        U5      -   5      ef = f! , (       d  f       N`= f)z*Helper function to check XML and debug SVGz"XML is not valid for SVG element: z#XML is not valid for SVG document: N_empty_invalid_,c              3   ^   >#    U  H"  n[        U5      S -   [        TU   5      -   v   M$     g7f)=N)str).0kkwrdss     ]/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/shapely/tests/legacy/test_svg.py	<genexpr>(SvgTestCase.assertSVG.<locals>.<genexpr>'   s&     'TeAs58}(Des   *-z.svgw )svgparse_xml_string	ExceptionAssertionErrorr   
_repr_svg_	geom_typeis_emptyis_validjoinospathopenwritetoprettyxml)selfgeomexpectedr   svg_elemsvg_docdocsvg_output_dirfnamesvg_pathfps      `       r   	assertSVGSvgTestCase.assertSVG   s4   88$e$	WX& //#	W"7+C NNE}}!==#sxx'Te'TTTTww||NFNCHh$*+ %###)  	W !EH!UVV	W
  	W !FW!UVV	W %$s"   D D(  E"D%("E

Ec                     U R                  [        5       S5        [        SS5      nU R                  US5        U R                  USSS9  g )N<g />      ze<circle cx="6.0" cy="7.0" r="3.0" stroke="#555555" stroke-width="1.0" fill="#66cc99" opacity="0.6" />zf<circle cx="6.0" cy="7.0" r="15.0" stroke="#555555" stroke-width="5.0" fill="#66cc99" opacity="0.6" />   scale_factor)r6   r   r,   gs     r   
test_pointSvgTestCase.test_point-   sQ    uw(!QKA	

 	A	 	 	
    c                     U R                  [        5       S5        [        SS/5      nU R                  US5        U R                  USSS9  g )Nr9   r:   r;         z<g><circle cx="6.0" cy="7.0" r="3.0" stroke="#555555" stroke-width="1.0" fill="#66cc99" opacity="0.6" /><circle cx="3.0" cy="4.0" r="3.0" stroke="#555555" stroke-width="1.0" fill="#66cc99" opacity="0.6" /></g>z<g><circle cx="6.0" cy="7.0" r="15.0" stroke="#555555" stroke-width="5.0" fill="#66cc99" opacity="0.6" /><circle cx="3.0" cy="4.0" r="15.0" stroke="#555555" stroke-width="5.0" fill="#66cc99" opacity="0.6" /></g>r<   r=   )r6   r   r?   s     r   test_multipointSvgTestCase.test_multipoint>   sW    z|W-'(E	
 	E  	 	
rC   c                     U R                  [        5       S5        [        / SQ5      nU R                  US5        U R                  USSS9  U R                  [        SS/5      S5        g )	Nr9   ))r<      )i  i)i     zq<polyline fill="none" stroke="#66cc99" stroke-width="2.0" points="5.0,8.0 496.0,-6.0 530.0,20.0" opacity="0.8" />zr<polyline fill="none" stroke="#66cc99" stroke-width="10.0" points="5.0,8.0 496.0,-6.0 530.0,20.0" opacity="0.8" />r<   r=   r   r   zc<polyline fill="none" stroke="#ff3333" stroke-width="2.0" points="0.0,0.0 0.0,0.0" opacity="0.8" />)r6   r   r?   s     r   test_linestringSvgTestCase.test_linestringS   sq    z|W-56F	

 	F	 	 	
 	'(8	
rC   c                     U R                  [        5       S5        U R                  [        SS/SS//5      S5        U R                  [        SS/SS//5      S5        g )	Nr9   rE   rF   )   rL   )	      z<g><polyline fill="none" stroke="#66cc99" stroke-width="2.0" points="6.0,7.0 3.0,4.0" opacity="0.8" /><polyline fill="none" stroke="#66cc99" stroke-width="2.0" points="2.0,8.0 9.0,1.0" opacity="0.8" /></g>)rR   rG   z<g><polyline fill="none" stroke="#ff3333" stroke-width="2.0" points="2.0,3.0 2.0,3.0" opacity="0.8" /><polyline fill="none" stroke="#ff3333" stroke-width="2.0" points="2.0,8.0 9.0,1.0" opacity="0.8" /></g>)r6   r   r,   s    r   test_multilinestring SvgTestCase.test_multilinestringj   se    ('2ff-/?@A<	
 	ff-/?@A<	
rC   c                     U R                  [        5       S5        [        / SQ/ SQ/5      nU R                  US5        U R                  USSS9  U R                  [        / SQ5      S	5        g )
Nr9   )#   
   )-   r\   )   (   )r[   rM   rY   )rM      )rZ   rZ   r`   rM   r_   z<path fill-rule="evenodd" fill="#66cc99" stroke="#555555" stroke-width="2.0" opacity="0.6" d="M 35.0,10.0 L 45.0,45.0 L 15.0,40.0 L 10.0,20.0 L 35.0,10.0 z M 20.0,30.0 L 35.0,35.0 L 30.0,20.0 L 20.0,30.0 z" />z<path fill-rule="evenodd" fill="#66cc99" stroke="#555555" stroke-width="10.0" opacity="0.6" d="M 35.0,10.0 L 45.0,45.0 L 15.0,40.0 L 10.0,20.0 L 35.0,10.0 z M 20.0,30.0 L 35.0,35.0 L 30.0,20.0 L 20.0,30.0 z" />r<   r=   r   r^   rN   r^   r^   )r^   r   rc   z<path fill-rule="evenodd" fill="#ff3333" stroke="#555555" stroke-width="2.0" opacity="0.6" d="M 0.0,40.0 L 0.0,0.0 L 40.0,40.0 L 40.0,0.0 L 0.0,40.0 z" />)r6   r	   r?   s     r   test_polygonSvgTestCase.test_polygon~   sw    wy'*>56
 	*	
 	*  	 	
 	AB4	
rC   c           
         U R                  [        5       S5        U R                  [        [        / SQ5      [        / SQ/ SQ/5      /5      S5        U R                  [        [        / SQ5      [        / SQ5      /5      S5        g )	Nr9   )rd   )rM   r\   )r\   r`   rd   )rM   rZ   )r[   r`   )r[   r[   )r`   r<   )r\   rM   rh   )ra   )rM   r]   )rM      ra   av  <g><path fill-rule="evenodd" fill="#66cc99" stroke="#555555" stroke-width="2.0" opacity="0.6" d="M 40.0,40.0 L 20.0,45.0 L 45.0,30.0 L 40.0,40.0 z" /><path fill-rule="evenodd" fill="#66cc99" stroke="#555555" stroke-width="2.0" opacity="0.6" d="M 20.0,35.0 L 10.0,30.0 L 10.0,10.0 L 30.0,5.0 L 45.0,20.0 L 20.0,35.0 z M 30.0,20.0 L 20.0,15.0 L 20.0,25.0 L 30.0,20.0 z" /></g>)   rk   )x      )rm      rj   rb   a<  <g><path fill-rule="evenodd" fill="#ff3333" stroke="#555555" stroke-width="2.0" opacity="0.6" d="M 140.0,140.0 L 120.0,145.0 L 145.0,130.0 L 140.0,140.0 z" /><path fill-rule="evenodd" fill="#ff3333" stroke="#555555" stroke-width="2.0" opacity="0.6" d="M 0.0,40.0 L 0.0,0.0 L 40.0,40.0 L 40.0,0.0 L 0.0,40.0 z" /></g>)r6   r   r	   rU   s    r   test_multipolygonSvgTestCase.test_multipolygon   s|    |~w/DESAB:	
& 	LMIJ8	
rC   c           	         U R                  [        5       S5        U R                  [        [        SS5      [        SS/5      /5      S5        U R                  [        SS5      R	                  [        SS/5      5      S5        g )Nr9   r;   rG   )rH   rR   )rL   rH   z<g><circle cx="7.0" cy="3.0" r="3.0" stroke="#555555" stroke-width="1.0" fill="#66cc99" opacity="0.6" /><polyline fill="none" stroke="#66cc99" stroke-width="2.0" points="4.0,2.0 8.0,4.0" opacity="0.8" /></g>z<g><circle cx="7.0" cy="3.0" r="3.0" stroke="#555555" stroke-width="1.0" fill="#ff3333" opacity="0.6" /><polyline fill="none" stroke="#ff3333" stroke-width="2.0" points="4.0,2.0 4.0,2.0" opacity="0.8" /></g>)r6   r
   r   r   unionrU   s    r   test_collectionSvgTestCase.test_collection   ss    )+W5aZ8H-IJK<	
 	!QKj&&)9:;<	
rC   r   N)__name__
__module____qualname____firstlineno__r6   rA   rI   rO   rV   re   ro   rs   __static_attributes__r   rC   r   r   r      s+    $6
"
*
.
(
>$
L
rC   r   )r'   unittestxml.dom.minidomr   r   shapely.geometryr   r   r   r   r   r	   shapely.geometry.collectionr
   TestCaser   r   rC   r   <module>r      s1    	  ;  ;D
(## D
rC   