
    = j                         S r SSKrSSKrSSKJr  SSKJr  SSKJ	r
  S rS rS rS	 rS
 rS rS rS rS rS rS rS rg)z
Test cases for Voronoi Diagram creation.

Overall, I'm trying less to test the correctness of the result
and more to cover input cases and behavior, making sure
that we return a sane result without error or raise a useful one.
    N)
MultiPoint)voronoi_diagram)loadsc                      [        S/S9n [        R                  " SS9   [        U 5      nS S S 5        [	        WR
                  5      S:X  d   eg ! , (       d  f       N*= f)N      ?r   pointsignore)invalidr   )r   nperrstater   lengeomsmpregionss     z/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/shapely/tests/legacy/test_voronoi_diagram.pytest_no_regionsr      sK    	J<	(B	X	&!"% 
' w}}""" 
'	&s   A
Ac                  f    [        SS/S9n [        U 5      n[        UR                  5      S:X  d   eg )Nr         ?r   r	      )r   r   r   r   r   s     r   test_two_regionsr      s2    	J
3	4Bb!Gw}}"""    c                      [        SS/S9n [        U SS9n[        UR                  5      S:X  d   e[	        S UR                   5       5      (       d   eg )Nr   r   r	   T)edges   c              3   V   #    U  H  oR                   R                  S 5      v   M!     g7f)
LineStringN)	geom_typeendswith.0rs     r   	<genexpr>test_edges.<locals>.<genexpr>&   s      I=a{{##L11=s   '))r   r   r   r   allr   s     r   
test_edgesr)       sO    	J
3	4Bb-Gw}}"""I7==IIIIIr   c                      [        SS/S9n [        S5      n[        XS9n[        UR                  5      S:X  d   e[        S UR                   5       5      UR                  :  d   eg )Nr   r   r	   +POLYGON ((0 0, 0.5 0, 0.5 0.5, 0 0.5, 0 0))enveloper   c              3   8   #    U  H  oR                   v   M     g 7fNarear#   s     r   r&   (test_smaller_envelope.<locals>.<genexpr>0        -}!vv}   r   load_wktr   r   r   sumr1   r   polyr   s      r   test_smaller_enveloper:   )   s^    	J
3	4BABDb0Gw}}"""-w}}--		999r   c                      [        SS/S9n [        S5      n[        XS9n[        UR                  5      S:X  d   e[        S UR                   5       5      UR                  :X  d   eg)	zWhen the envelope we specify is larger than the
area of the input feature, the created regions should
expand to fill that area.r   r   r	   z#POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))r,   r   c              3   8   #    U  H  oR                   v   M     g 7fr/   r0   r#   s     r   r&   'test_larger_envelope.<locals>.<genexpr>=   r3   r4   Nr5   r8   s      r   test_larger_enveloper>   3   s`     
J
3	4B9:Db0Gw}}"""-w}}--:::r   c                  f    [        S5      n [        U 5      n[        UR                  5      S:X  d   eg )N#POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))   r6   r   r   r   r9   r   s     r   test_from_polygonrD   @   s.    9:Dd#Gw}}"""r   c                  d    [        S5      n [        U SS9n[        UR                  5      S:X  d   eg )Nr+   r   	tolerancer   rB   rC   s     r   'test_from_polygon_with_enough_tolerancerH   G   s0    ABDdc2Gw}}"""r   c                     [        S5      n [        R                  " [        5       n[	        U SS9  S S S 5        S[        WR                  5      ;   d   eS[        UR                  5      ;   d   eg ! , (       d  f       NE= f)Nr+   g333333?rF   :Could not create Voronoi Diagram with the specified inputs/Try running again with default tolerance value.r6   pytestraises
ValueErrorr   strvaluer9   excs     r   *test_from_polygon_without_enough_tolerancerT   N   so    ABD	z	"c, 
# H3		L    =CIINNN 
#	"   A00
A>c                     [        S5      n [        R                  " [        5       n[	        U SS9  S S S 5        S[        WR                  5      ;   d   eS[        UR                  5      ;   d   eg ! , (       d  f       NE= f)Nr@   皙?rF   rJ   rK   rL   rR   s     r   4test_from_polygon_without_floating_point_coordinatesrX   Y   so    9:D	z	"c, 
# H3		L    =CIINNN 
#	"rU   c                     [        S5      n [        R                  " [        5       n[	        U SS9  SSS5        S[        WR                  5      ;   d   eS[        UR                  5      ;   d   eg! , (       d  f       NE= f)zNA Multipoint with the same "shape" as the above Polygon raises the same error.zMULTIPOINT (0 0, 1 0, 1 1, 0 1)rW   rF   NrJ   rK   rL   r   rS   s     r   7test_from_multipoint_without_floating_point_coordinatesr[   d   so    	3	4B	z	"cc* 
# H3		L    =CIINNN 
#	"rU   c                     [        S5      n [        R                  " [        5       n[	        U SS9  SSS5        S[        WR                  5      ;   d   eS[        UR                  5      ;   d   eg! , (       d  f       NE= f)z5This multipoint will not work with a tolerance value.MULTIPOINT (0 0, 1 0, 1 2, 0 1)rW   rF   NrJ   rK   rL   rZ   s     r   Etest_from_multipoint_with_tolerace_without_floating_point_coordinatesr^   q   so    	3	4B	z	"cc* 
# H3		L    =CIINNN 
#	"rU   c                  f    [        S5      n [        U 5      n[        UR                  5      S:X  d   eg)zBut it's fine without it.r]   rA   NrB   r   s     r   Htest_from_multipoint_without_tolerace_without_floating_point_coordinatesr`   }   s.    	3	4Bb!Gw}}"""r   )__doc__numpyr   rM   shapely.geometryr   shapely.opsr   shapely.wktr   r6   r   r   r)   r:   r>   rD   rH   rT   rX   r[   r^   r`    r   r   <module>rg      s\      ' ' )##J:
;##OO
O	O#r   