o
    JfV4                     @   s\  d dl Zd dlZd dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
mZmZmZ ejZejZejZejdejejejgejdededed	dejd
dedgdd Zejdejejejejgejdejddgejddeeggdgdd Z ejdejejejgejdegdd dgdggdd Z!ejdedZ"de"j#_$ejdejejejgejdg dede"ejdedejdedejdedgd d! Z%d"d# Z&d$d% Z'd&d' Z(ejd(d dgeee	dgfd dgede	egfddgddeegfgd)d* Z)ejd+ddgddggd d geddgddgggfg d,g d-gd d geg d,g d-ggfddgddgddgddggg d.eddgddggeddgddgggfgd/d0 Z*d1d2 Z+ejd(g d3e
e
e	dgfg d4e
de	e
gfg d5dde
e
gfgd6d7 Z,ejdddgddgddgddggddgddgddgggd8d9 Z-ejddej.gddgddgddgggd:d; Z/d<d= Z0ejd(g d>edde	gfg d?dede	gfg d@dddegfgdAdB Z1ejdCddgejdDdEdFgdGdH Z2eg dIZ3eg dJZ4e5eZ6e Z7ej5ee3gdKZ8ej5ee4gdKZ9ej5ee3e4gdKZ:ejdLeegd dge6e6gfdegd dge7e6gfdeddgg d.e6e7gfee3egg dMe8e6gfeee3gg dNe6e8gfdeee3gg d.e6e8gfedee3gg d.e6e8gfedee3gg dOe6e8gfeede3gg dOe6e8gfeee3dgg dOe6e8gfee3e4egg dPe:e6gfee3ee4gg d.e8e9gfeee3e4gg dOe6e:gfee3de4egg dQe:e6gfee3dee4gg dRe8e9gfee3ede4gg dSe8e9gfgdTdU Z;ejd(d dge6e6e	dgfd dge6de	e6gfddgdde6e6gfgdVdW Z<ejdej5ejejejejgejdeegdd dgdggdXdY Z=ejdZee
gd d geee
ggfee
gd dgeegee
ggfedgd d geeggfedgd dgeegeg gfdeddgg d.eegeg gfede
gg d[eee
ggfgd\d] Z>d^d_ Z?ejd(d d geee
gdde	gfddgdddeee
ggfgd`da Z@dbdc ZAddde ZBdfdg ZCdhdi ZDejdjegej5fe
gej5fegej5fe
gejfegejfegejfegejfegejfe
gejfg	dkdl ZEdS )m    N)
LinearRingPolygon)assert_geometries_equal)empty_pointline_stringlinear_ringpointpolygonfunccoordinates)   )r         )r   r   )r   r   foodtypec                 C   D   t ttf | |ddgd W d    d S 1 sw   Y  d S Nr   r   indicespytestraises	TypeError
ValueError)r
   r    r   o/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/shapely/tests/test_creation_indices.pytest_invalid_coordinates   s   "r   
geometriesr   r   helloc                 C   r   r   r   )r
   r   r   r   r   test_invalid_geometries    s   "r    r   z helloc                 C   sF   t ttf | ddgg|d W d    d S 1 sw   Y  d S )N皙?333333?r   r   r
   r   r   r   r   test_invalid_indices_simple1   s   "r%      Fout)NNN)r&   r   r   c                 C   s   | t ju rddgddgg}ddg}n&| t ju r0ddgddgddgddgdd	gd	d	gg}g d
}nttg}ddg}tttf | |||d W d    d S 1 sRw   Y  d S )Nr"   r#   皙?g      ?r   r   r   r&   r   )r   r   r   r   r   r   r   r'   )	shapelypointslinestringsr   r   r   r   r   r   )r
   r'   xr   r   r   r   test_invalid_out>   s   


(
"r.   c                   C   sP   t tj tjddgddggddgd W d    d S 1 s!w   Y  d S Nr   r   r   r   )r   r   r*   GEOSExceptionr+   r   r   r   r   test_points_invalidZ       "r1   c                  C   sF   t jtjddgddggtdtjddgtjdd} t| ttg d S )Nr   r&   r   r   r   r   )r*   r+   nparrayfloatintpr   r   actualr   r   r   test_points`   s
   r9   c                   C   sd   t t# tjtjddgddggtdtjddgtjdd W d    d S 1 s+w   Y  d S )Nr   r&   r   r   r   )	r   r   r   r*   r+   r3   r4   r5   r6   r   r   r   r   test_points_no_index_raisesh   s   "r:   zindices,expectedc                 C   sL   t jdtd}t|d< tjddgddgg| |d}t|| ||u s$J d S )Nr   r   r   r&   r)   )r3   emptyobjectr   r*   r+   r   r   expectedr'   r8   r   r   r   test_points_outp   s   	
r?   zcoordinates,indices,expected)r   r   r   )r   r   r   )r   r   r   r   c                 C   2   t jtj| tdtj|tjdd}t|| d S Nr   r   )r*   r,   r3   r4   r5   r6   r   )r   r   r>   r8   r   r   r   test_linestrings   s   rB   c                   C   sP   t tj tjddgddggddgd W d    d S 1 s!w   Y  d S r/   )r   r   r*   r0   r,   r   r   r   r   test_linestrings_invalid   r2   rC   )r   r   r   r   r   r   )r   r   r   r&   r&   r&   )r   r   r   r&   r&   r&   c                 C   D   t jdtd}t|d< tjg d| |d}t|| ||u s J d S )Nr   r   r   )r   r   r   r   r   r   rE   rF   rG   r)   )r3   r;   r<   r   r*   r,   r   r=   r   r   r   test_linestrings_out      	
rH   c                 C   s>   t jtj| tjdtjt| tjdd}t|t |  d S rA   )	r*   linearringsr3   r4   float64zeroslenr6   r   )r   r8   r   r   r   test_linearrings   s
   rN   c                 C   sN   t tjtf tj| tt| d W d    d S 1 s w   Y  d S Nr   )	r   r   r*   r0   r   rJ   r3   rL   rM   )r   r   r   r   test_linearrings_invalid   s   "rP   c                  C   s.   t jg dtdd} t| tg d d S )N)rE   rE   rE   r&   r   )rE   rE   rE   rE   )r*   rJ   r3   rL   r   r   r7   r   r   r   *test_linearrings_unclosed_all_coords_equal   s   rQ   )r   r   r   r   r   )r   r   r   r   r   )r&   r&   r&   r&   r&   c                 C   rD   )Nr   r   r&   )rE   rF   rG   )r   r   rE   r)   )r3   r;   r<   r   r*   rJ   r   r=   r   r   r   test_linearrings_out   rI   rR   dimorderCFc           	      C   s   t jdd| }t j|d| |d}t tdd}tj||d}t 	||d d dgd d f f}t j|d| |d}t tdd}tj||d}t
|| d S )	N
   r   (   )rT   r   r   2      )r3   randomrandnasarrayreshaperepeatranger*   rJ   hstackr   )	rS   rT   coordscoords1indices1result1coords2indices2result2r   r   r   test_linearrings_buffer   s   "ri   ))r"   r"   )r"   r(   )r(   r(   ))333333?rj   )rj   皙?)rk   rk   )holeszrings,indices,expected)r   r   r   )r   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   c                 C   r@   rA   )r*   polygonsr3   r4   r<   r6   r   )ringsr   r>   r8   r   r   r   test_polygons   s   .ro   c                 C   sD   t jdtd}t|d< tjttg| |d}t|| ||u s J d S )Nr   r   r   r)   )r3   r;   r<   r   r*   rm   r   r   r=   r   r   r   test_polygons_out.  s
   	
rp   c                 C   sB   t ttf | tg|d W d    d S 1 sw   Y  d S rO   )r   r   r   r   r   r$   r   r   r    test_invalid_indices_collections>  s   "rq   zgeometries,indices,expected)r   r   r   c                 C   s&   t jtj| td|d}t|| d S rA   )r*   geometrycollectionsr3   r4   r<   r   )r   r   r>   r8   r   r   r   test_geometrycollectionsN  s   rs   c                   C   sP   t t tjtjttgt	dddgd W d    d S 1 s!w   Y  d S )Nr   r   r   r   )
r   r   r   r*   rr   r3   r4   r   r   r<   r   r   r   r   (test_geometrycollections_no_index_raises`  s
   "rt   c                 C   sD   t jdtd}t|d< tjttg| |d}t|| ||u s J d S )Nr   r   r&   r)   )	r3   r;   r<   r   r*   rr   r   r   r   r=   r   r   r   test_geometrycollections_outg  s
   
ru   c                  C   <   t jtjtgtdtjdtjdd} t| t tg d S Nr   r   r   )	r*   multipointsr3   r4   r   r<   rL   r6   r   r7   r   r   r   test_multipointsv     ry   c                  C   rv   rw   )	r*   multilinestringsr3   r4   r   r<   rL   r6   r   r7   r   r   r   test_multilinestrings}  rz   r|   c                  C   rv   rw   )	r*   r{   r3   r4   r   r<   rL   r6   r   r7   r   r   r   test_multilinearrings  rz   r}   c                  C   rv   rw   )	r*   multipolygonsr3   r4   r	   r<   rL   r6   r   r7   r   r   r   test_multipolygons  rz   r   zgeometries,funcc                 C   s>   t t || dgd W d    d S 1 sw   Y  d S )Nr   r   )r   r   r   )r   r
   r   r   r   test_incompatible_types  s   "r   )Fnumpyr3   r   r*   r   r   shapely.testingr   shapely.tests.commonr   r   r   r   r	   r+   pntsr,   lstrsrr   	geom_collmarkparametrizerJ   r;   fullr<   r   rx   r{   r~   r4   r6   r    r%   non_writeableflags	writeabler.   r1   r9   r:   r?   rB   rC   rH   rN   nanrP   rQ   rR   ri   hole_1hole_2rm   poly
poly_emptypoly_hole_1poly_hole_2poly_hole_1_2ro   rp   rq   rs   rt   ru   ry   r|   r}   r   r   r   r   r   r   <module>   s   
	&
**&

2







-
"
 "










