o
    j)                     @   s  d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZ dd Zdd Zd	d
 Zdd Zeddeg deg deg de
dge	g dgeeg dgeeddggZejje  dkddejdedd Zejdedd Zdd Zdd Zdd Zejjej dk ddd d! Z!d"d# Z"ejd$g d%ejd&g d'd(d) Z#ejjej dk ddd*d+ Z$d,d- Z%ejd$g d.d/d0 Z&ejd$g d1d2d3 Z'ejd4ej(d5e)d6d7ejjej dk ddd8d9e)d:d;fd<e)d=d>fgd?d@ Z*ejd$g dAdBdC Z+ejd$dDdEgdFdG Z,ejd$dHdIgdJdK Z-ejd$dLdMgdNdO Z.dPdQ Z/dRdS Z0dTdU Z1dVdW Z2dXdY Z3dZd[ Z4d\d] Z5d^d_ Z6d`da Z7dbdc Z8ddde Z9dS )f    N)GeometryCollection
LinearRing
LineStringMultiLineString
MultiPointMultiPolygonPointPolygon)ShapelyDeprecationWarning)assert_geometries_equalc                   C      t t du s	J d S NF)boolr	    r   r   j/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/shapely/tests/geometry/test_geometry_base.pytest_polygon      r   c                   C   r   r   )r   r   r   r   r   r   test_linestring   r   r   c                   C   r   r   )r   r   r   r   r   r   
test_point   r   r   c                   C   r   r   )r   r   r   r   r   r   test_geometry_collection"   r   r      )r   r   r   r   r   r   r   r   PyPyz.Setting custom attributes doesn't fail on PyPy)reasongeomc                 C   s6   t t d| _W d    d S 1 sw   Y  d S )Ntest)pytestraisesAttributeErrorname)r   r   r   r   test_setattr_disallowed2   s   "r"   c                 C   s   t | }d S )N)weakrefref)r   _r   r   r   test_weakrefable<   s   r&   c                   C   s:   t t td W d    d S 1 sw   Y  d S )NzPOINT (1 1))r   r   	TypeErrorshapelyZGeometryr   r   r   r   test_base_class_not_callableA   s   "r)   c                  C   sN   t dd} tt |  }W d    n1 sw   Y  || jks%J d S Nr   )r   r   warnsr
   ZgeometryType	geom_typer   r,   r   r   r   test_GeometryType_deprecatedF   s
   

r.   c                  C   sL   t dd} tt | j}W d    n1 sw   Y  || jks$J d S r*   )r   r   r+   r
   typer,   r-   r   r   r   test_type_deprecatedO   s
   
r0   )   
   r   zGEOS < 3.10c                  C   s2   t ddg} | jdd}|t g dsJ d S )Nr   r   r2      )Zmax_segment_length)r   )r   r4   r3   )r   Z
segmentizeequals)lineresultr   r   r   test_segmentizeX   s   r8   c                  C   s<   ddg} t | }| }|jd d  | d d d ksJ d S )Nr   )r      )r   reversecoords)r<   r6   r7   r   r   r   test_reverse_   s   $r=   op)unionintersection
differencesymmetric_difference	grid_size)r   r   r9   c                 C   sV   t dddd}t dddd}t|| ||d}tt | |||d}||ks)J d S )Nr   g      @r9   r1   )rC   )r(   boxgetattr)r>   rC   Zgeom1Zgeom2r7   expectedr   r   r   test_binary_op_grid_sizef   s
   rG   c                  C   sB   t dd} tddg}| |ddu sJ | |ddu sJ d S )Nr   r   r3         ?Fg      ?T)r   r   dwithin)pointr6   r   r   r   test_dwithins   s   
rK   c                  C   s@   t g d} tddg}| |du sJ | |du sJ d S )N)r   r2   r2   )r2   ir   )r2   r   FT)r	   r   contains_properlycontains)polygonr6   r   r   r   test_contains_properly{   s   rP   )Zconvex_hullenvelopeZoriented_envelopeZminimum_rotated_rectanglec                 C   s4   t g d}t|| }tt| |}||ksJ d S )N)r   r3   rL   )r   rE   r(   )r>   r   r7   rF   r   r   r   test_constructive_properties   s   
rR   )ZcrossesrN   rM   Z
covered_byZcoversZdisjointr5   Z
intersectsoverlapsZtouchesZwithinc                    s   t g dtg d}t |}t|tjsJ tj fdd|D td}tj	
|| t |d }t|tu sCJ d S )Nr   r   r   )r   r   r   r   )rH   rH   r   c                       g | ]	}t  |qS r   rE   .0pr>   rO   r   r   
<listcomp>       z9test_array_argument_binary_predicates.<locals>.<listcomp>Zdtyper   r	   r(   pointsrE   
isinstancenpndarrayarrayr   testingassert_array_equalr/   r>   r`   r7   rF   r   r[   r   %test_array_argument_binary_predicates   s   rh   z
op, kwargsrI   rH   )distance)ZmarksZequals_exactg{Gz?)Z	toleranceZrelate_patternz	T*F**F***)patternc                    s   t g dtg d}t|fi  }t|tjs J tj fdd|D td}tj	
|| t|d fi  }t|tu sLJ d S )NrT   rU   c                    s"   g | ]}t |fi  qS r   rW   rX   kwargsr>   rO   r   r   r\      s   " z:test_array_argument_binary_predicates2.<locals>.<listcomp>r^   r   r_   )r>   rl   r`   r7   rF   r   rk   r   &test_array_argument_binary_predicates2   s    rm   )rA   r@   rB   r?   c                    s   t g d ttg dd}t |}t|tjs J tj fdd|D t	d}t
|| t |d }t|t tfsFJ d S )NrT   rU   rH   c                    s   g | ]	}t  |qS r   rW   )rY   grD   r>   r   r   r\      r]   z2test_array_argument_binary_geo.<locals>.<listcomp>r^   r   )r	   r(   bufferr`   rE   ra   rb   rc   rd   objectr   r   )r>   Zpolygonsr7   rF   r   ro   r   test_array_argument_binary_geo   s   

rr   ri   Zhausdorff_distancec                    s   t g dtg d}t |}t|tjsJ tj fdd|D dd}tj	|| t |d }t
|tu sCJ d S )NrT   rU   c                    rV   r   rW   rX   r[   r   r   r\      r]   z-test_array_argument_float.<locals>.<listcomp>float64r^   r   )r	   r(   r`   rE   ra   rb   rc   rd   re   rf   r/   floatrg   r   r[   r   test_array_argument_float   s   ru   line_interpolate_pointinterpolatec                    s   t g d tg d}t | |}t|tjsJ tj fdd|D td}t|| t | |d }t|ts?J d S )Nr   r   r   r   rH   r   c                       g | ]}  |qS r   )rv   rY   dr6   r   r   r\          z4test_array_argument_linear_point.<locals>.<listcomp>r^   r   )	r   rb   rd   rE   ra   rc   rq   r   r   )r>   	distancesr7   rF   r   r}   r    test_array_argument_linear_point   s   
r   line_locate_pointprojectc                    s   t g d tg d}t | |}t|tjsJ tj fdd|D dd}tj	|| t | |d }t
|tu sBJ d S )Nrx   rU   c                    rz   r   )r   rX   r}   r   r   r\     r~   z4test_array_argument_linear_float.<locals>.<listcomp>rs   r^   r   )r   r(   r`   rE   ra   rb   rc   rd   re   rf   r/   rt   rg   r   r}   r    test_array_argument_linear_float   s   r   c                     sx   t dd tg d}  | }t|tjsJ tj fdd| D td}t||  | d }t|ts:J d S )Nr   ry   c                    rz   r   )rp   r{   rJ   r   r   r\     r~   z.test_array_argument_buffer.<locals>.<listcomp>r^   r   )	r   rb   rd   rp   ra   rc   rq   r   r	   )r   r7   rF   r   r   r   test_array_argument_buffer  s   


r   c               	   C   s   t dd} tjdd | ddd W d    n1 sw   Y  tjdd | dddd W d    n1 s;w   Y  t  | ddddd W d    n1 sXw   Y  t  | dddddd	 W d    d S 1 sww   Y  d S )
Nr   z:positional argument `cap_style` for `buffer` is deprecatedmatch      ?   roundzMpositional arguments `cap_style` and `join_style` for `buffer` are deprecatedg      @F)r   r   deprecated_callrp   r   r   r   r    test_buffer_deprecate_positional  s"   


"r   c                  C   J   t ddg} tjdd | dd W d    d S 1 sw   Y  d S )Nr   r   zDpositional argument `preserve_topology` for `simplify` is deprecatedr   r   T)r   r   r   simplify)Z
linestringr   r   r   "test_simplify_deprecate_positional+     "r   c                  C   H   t dd} tjdd | | d  W d    d S 1 sw   Y  d S )Nr   z>positional argument `grid_size` for `difference` is deprecatedr   )r   r   r   rA   r   r   r   r   $test_difference_deprecate_positional3     
"r   c                  C   r   )Nr   z@positional argument `grid_size` for `intersection` is deprecatedr   )r   r   r   r@   r   r   r   r   &test_intersection_deprecate_positional;  r   r   c                  C   r   )Nr   zHpositional argument `grid_size` for `symmetric_difference` is deprecatedr   )r   r   r   rB   r   r   r   r   .test_symmetric_difference_deprecate_positionalC  r   r   c                  C   r   )Nr   z9positional argument `grid_size` for `union` is deprecatedr   )r   r   r   r?   r   r   r   r   test_union_deprecate_positionalK  r   r   c                  C   P   t ddg} tjdd | tddd W d    d S 1 s!w   Y  d S )Nr   g       @g      @g      @zFpositional argument `normalized` for `line_locate_point` is deprecatedr   r   F)r   r   r   r   r   line_stringr   r   r   +test_line_locate_point_deprecate_positionalS     "r   c                  C   r   )Nr   r   z<positional argument `normalized` for `project` is deprecatedr   r   F)r   r   r   r   r   r   r   r   r   !test_project_deprecate_positional[  r   r   c                  C   r   )Nr   r   zKpositional argument `normalized` for `line_interpolate_point` is deprecatedr   r   F)r   r   r   rv   r   r   r   r   0test_line_interpolate_point_deprecate_positionalc  s   "r   c                  C   r   )Nr   r   z@positional argument `normalized` for `interpolate` is deprecatedr   r   F)r   r   r   rw   r   r   r   r   %test_interpolate_deprecate_positionall  r   r   ):platformr#   numpyrb   r   r(   r   r   r   r   r   r   r   r	   Zshapely.errorsr
   Zshapely.testingr   r   r   r   r   Zgeometries_all_typesmarkZskipifpython_implementationZparametrizer"   r&   r)   r.   r0   Zgeos_versionr8   r=   rG   rK   rP   rR   rh   paramdictrm   rr   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   s    (





		
	





	


	