
    _ h=                      v    d dl Z d dlZd dlmZ d dlmZmZmZm	Z	m
Z
mZ d dlmZ  G d dej                        Zy)    N)parseString)
LineStringMultiLineString
MultiPointMultiPolygonPointPolygon)GeometryCollectionc                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
SvgTestCasec                     |j                   di }	 t        |       |j                         }	 t        |      }d}|r|j                  }|j                  r|dz  }|j                  s|dz  }r |ddj                  fdD              z   z  }t        j                  j                  ||d	z         }	t        |	d
      5 }
|
j                  |j                                ddd       ||k(  sJ y# t        $ r t        dt	        |      z         w xY w# t        $ r t        dt	        |      z         w xY w# 1 sw Y   YxY w)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   X   K   | ]!  }t        |      d z   t        |         z    # yw)=N)str).0kkwrdss     y/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/shapely/tests/legacy/test_svg.py	<genexpr>z(SvgTestCase.assertSVG.<locals>.<genexpr>'   s&     'TAs58}(D'Ts   '*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   	assertSVGzSvgTestCase.assertSVG   sA   488$e$	WX& //#	W"7+C NNE}}!==#sxx'Te'TTTTww||NEFNCHh$ ,*+,8###)  	W !EH!UVV	W
  	W !FW!UVV	W, ,s"   C/ D ? D7/!D!D47E c                     | j                  t               d       t        dd      }| j                  |d       | j                  |dd       y )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)r4   r   r*   gs     r   
test_pointzSvgTestCase.test_point-   sQ    uw(!QKA	

 	A	 	 	
    c                     | j                  t               d       t        ddg      }| j                  |d       | j                  |dd       y )Nr6   r7   r8         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>r9   r:   )r4   r   r<   s     r   test_multipointzSvgTestCase.test_multipoint>   sW    z|W-'(E	
 	E  	 	
r?   c                     | j                  t               d       t        g d      }| j                  |d       | j                  |dd       | j                  t        ddg      d       y )	Nr6   ))r9      )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" />r9   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" />)r4   r   r<   s     r   test_linestringzSvgTestCase.test_linestringS   sq    z|W-56F	

 	F	 	 	
 	'(8	
r?   c                     | j                  t               d       | j                  t        ddgddgg      d       | j                  t        ddgddgg      d       y )	Nr6   rA   rB   )   rG   )	      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>)rL   rC   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>)r4   r   r*   s    r   test_multilinestringz SvgTestCase.test_multilinestringj   se    ('2ff-/?@A<	
 	ff-/?@A<	
r?   c                     | j                  t               d       t        g dg dg      }| j                  |d       | j                  |dd       | j                  t        g d      d	       y )
Nr6   )#   
   )-   rU   )   (   )rT   rH   rR   )rH      )rS   rS   rY   rH   rX   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" />r9   r:   r   rW   rI   rW   rW   )rW   r   r\   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" />)r4   r	   r<   s     r   test_polygonzSvgTestCase.test_polygon~   sw    wy'*>56
 	*	
 	*  	 	
 	AB4	
r?   c           
         | j                  t               d       | j                  t        t        g d      t        g dg dg      g      d       | j                  t        t        g d      t        g d      g      d       y )	Nr6   )r]   )rH   rU   )rU   rY   r]   )rH   rS   )rT   rY   )rT   rT   )rY   r9   )rU   rH   r`   )rZ   )rH   rV   )rH      rZ   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>)   rc   )x      )re      rb   r[   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>)r4   r   r	   rO   s    r   test_multipolygonzSvgTestCase.test_multipolygon   s|    |~w/DESAB:	
& 	LMIJ8	
r?   c           	         | j                  t               d       | j                  t        t        dd      t        ddg      g      d       | j                  t        dd      j	                  t        ddg            d       y )Nr6   r8   rC   )rD   rL   )rG   rD   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>)r4   r
   r   r   unionrO   s    r   test_collectionzSvgTestCase.test_collection   ss    )+W5aZ8H-IJK<	
 	!QKj&&)9:;<	
r?   N)__name__
__module____qualname__r4   r>   rE   rJ   rP   r^   rg   rj   r   r?   r   r   r      s+    $6
"
*
.
(
>$
L
r?   r   )r%   unittestxml.dom.minidomr   r   shapely.geometryr   r   r   r   r   r	   shapely.geometry.collectionr
   TestCaser   r   r?   r   <module>rs      s1    	  ;  ;D
(## D
r?   