o
    h)                     @   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   d/var/www/html/scripts/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shapely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
   geometryType	geom_typer   r.   r   r   r   test_GeometryType_deprecatedF   s
   

r0   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
   
r2   )   
   r   zGEOS < 3.10c                  C   s2   t ddg} | jdd}|t g dsJ d S )Nr   r   r4      )max_segment_length)r   )r   r6   r5   )r   
segmentizeequals)lineresultr   r   r   test_segmentizeX   s   r<   c                  C   s<   ddg} t | }| }|jd d  | d d d ksJ d S )Nr   )r      )r   reversecoords)r@   r:   r;   r   r   r   test_reverse_   s   $rA   op)unionintersection
differencesymmetric_difference	grid_size)r   r   r=   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      @r=   r3   )rG   )r(   boxgetattr)rB   rG   geom1geom2r;   expectedr   r   r   test_binary_op_grid_sizef   s
   rM   c                  C   sB   t dd} tddg}| |ddu sJ | |ddu sJ d S )Nr   r   r5         ?Fg      ?T)r   r   dwithin)pointr:   r   r   r   test_dwithins   s   
rQ   c                  C   s@   t g d} tddg}| |du sJ | |du sJ d S )N)r   r4   r4   )r4   ir   )r4   r   FT)r	   r   contains_properlycontains)polygonr:   r   r   r   test_contains_properly{   s   rV   )convex_hullenvelopeoriented_envelopeminimum_rotated_rectanglec                 C   s4   t g d}t|| }tt| |}||ksJ d S )N)r   r5   rR   )r   rI   r(   )rB   r   r;   rL   r   r   r   test_constructive_properties   s   
r[   )crossesrT   rS   
covered_bycoversdisjointr9   
intersectsoverlapstouches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   )rN   rN   r   c                       g | ]	}t  |qS r   rI   .0prB   rU   r   r   
<listcomp>       z9test_array_argument_binary_predicates.<locals>.<listcomp>dtyper   r	   r(   pointsrI   
isinstancenpndarrayarrayr   testingassert_array_equalr1   rB   rq   r;   rL   r   rk   r   %test_array_argument_binary_predicates   s   ry   z
op, kwargsrO   rN   )distance)marksequals_exactg{Gz?)	tolerance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 )Nrd   re   c                    s"   g | ]}t |fi  qS r   rg   rh   kwargsrB   rU   r   r   rl      s   " z:test_array_argument_binary_predicates2.<locals>.<listcomp>rn   r   rp   )rB   r   rq   r;   rL   r   r   r   &test_array_argument_binary_predicates2   s    r   )rE   rD   rF   rC   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 )Nrd   re   rN   c                    s   g | ]	}t  |qS r   rg   )ri   grH   rB   r   r   rl      rm   z2test_array_argument_binary_geo.<locals>.<listcomp>rn   r   )r	   r(   bufferrq   rI   rr   rs   rt   ru   objectr   r   )rB   polygonsr;   rL   r   r   r   test_array_argument_binary_geo   s   

r   rz   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 )Nrd   re   c                    rf   r   rg   rh   rk   r   r   rl      rm   z-test_array_argument_float.<locals>.<listcomp>float64rn   r   )r	   r(   rq   rI   rr   rs   rt   ru   rv   rw   r1   floatrx   r   rk   r   test_array_argument_float   s   r   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   rN   r   c                       g | ]}  |qS r   )r   ri   dr:   r   r   rl          z4test_array_argument_linear_point.<locals>.<listcomp>rn   r   )	r   rs   ru   rI   rr   rt   r   r   r   )rB   	distancesr;   rL   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 )Nr   re   c                    r   r   )r   rh   r   r   r   rl     r   z4test_array_argument_linear_float.<locals>.<listcomp>r   rn   r   )r   r(   rq   rI   rr   rs   rt   ru   rv   rw   r1   r   rx   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   r   c                    r   r   )r   r   rP   r   r   rl     r   z.test_array_argument_buffer.<locals>.<listcomp>rn   r   )	r   rs   ru   r   rr   rt   r   r   r	   )r   r;   rL   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_callr   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)
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   rE   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   rD   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   rF   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   rC   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   r   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   r   r   r   r   r   %test_interpolate_deprecate_positionall  r   r   ):platformr#   numpyrs   r   r(   r   r   r   r   r   r   r   r	   shapely.errorsr
   shapely.testingr   r   r   r   r   geometries_all_typesmarkskipifpython_implementationparametrizer"   r&   r*   r0   r2   geos_versionr<   rA   rM   rQ   rV   r[   ry   paramdictr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   s    (





		
	





	


	