o
    j                     @   s   d dl Zd dlZd dlmZmZ d dlmZmZm	Z	m
Z
mZmZmZmZ G dd dZG dd dZG dd	 d	Zejd
eeee	gdd Zejjedk dddd ZdS )    N)
LineStringgeos_version)line_stringline_string_mline_string_zline_string_zmpointpoint_mpoint_zpoint_zmc                   @   s    e Zd ZdZdd Zdd ZdS )
TestCoordsz
    Shapely assumes contiguous C-order float64 data for internal ops.
    Data should be converted to contiguous float64 if numpy exists.
    c9a0707 broke this a little bit.
    c                 C   sD   t jddgddggt jd}t t|j}| | ks J d S )N   "   8   N   ZdtypenparrayZfloat32r   coordstolistselfr   Zprocessed_coords r   c/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/shapely/tests/geometry/test_coords.pytest_data_promotion   s   zTestCoords.test_data_promotionc                 C   sX   t jddgddggt jd}t t|d d d j}|d d d  | ks*J d S )Nr   r   r   r   r   r   r   r   r   r   test_data_destriding   s   "zTestCoords.test_data_destridingN)__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    r   c                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )TestCoordsGetItemc                 C      dd t dD }t|}t ddD ]}|j| || ksJ qtt |jd  W d    n1 s5w   Y  tt |jd  W d    d S 1 sPw   Y  d S )Nc                 S      g | ]}t |t | fqS r   float.0xr   r   r   
<listcomp>)       z7TestCoordsGetItem.test_index_coords.<locals>.<listcomp>   ranger   r   pytestraises
IndexErrorr   cgir   r   r   test_index_coords(      "z#TestCoordsGetItem.test_index_coordsc                 C   r#   )Nc                 S   (   g | ]}t |t | t |d  fqS    r%   r'   r   r   r   r*   3      ( z9TestCoordsGetItem.test_index_coords_z.<locals>.<listcomp>r,   r-   r.   r/   r4   r   r   r   test_index_coords_z2   r9   z%TestCoordsGetItem.test_index_coords_zc                 C   st   t  }tt |jd  W d    n1 sw   Y  tt |jd  W d    d S 1 s3w   Y  d S )Nr           )r   r1   r2   r3   r   	TypeError)r   r6   r   r   r   test_index_coords_misc<   s   "z(TestCoordsGetItem.test_index_coords_miscc                 C      dd t dD }t|}|jdd  |dd  ksJ |jd d |d d ks+J |jd d d |d d d ks<J |jd d d |d d d ksMJ |jd d |d d ks\J |jdd  |dd    krpg kssJ  J d S )Nc                 S   r$   r   r%   r'   r   r   r   r*   D   r+   z7TestCoordsGetItem.test_slice_coords.<locals>.<listcomp>r,      r   r<   r0   r   r   r   r5   r6   r   r   r   test_slice_coordsC      ""2z#TestCoordsGetItem.test_slice_coordsc                 C   rB   )Nc                 S   r:   r;   r%   r'   r   r   r   r*   N   r=   z9TestCoordsGetItem.test_slice_coords_z.<locals>.<listcomp>r,   rC   r   r<   rD   rE   r   r   r   test_slice_coords_zM   rG   z%TestCoordsGetItem.test_slice_coords_zN)r   r   r    r8   r>   rA   rF   rH   r   r   r   r   r"   '   s    


r"   c                   @   s   e Zd ZdZdd ZdS )TestXYz<New geometry/coordseq method 'xy' makes numpy interop easierc                 C   s^   t ddgj\}}t|dksJ t|ddgksJ t|dks#J t|ddgks-J d S )N)r   r   )rC   rC   r<   r?         ?)r   Zxylenlist)r   r)   yr   r   r   test_arrays[   s
   zTestXY.test_arraysN)r   r   r    r!   rN   r   r   r   r   rI   X   s    rI   geomc                 C   s   | j }t|t|usJ tj|ddtj|ddusJ ttjjddd dkrNtjt	dd tj|d	d W d
   d
S 1 sGw   Y  d
S tj|d	dtj|d	du s^J d
S )z)Test CoordinateSequence.__array__ method.T)copy.rC   r   r<   zA copy is always created)matchFN)
r   r   r   intversionZshort_versionsplitr1   r2   
ValueError)rO   Z	coord_seqr   r   r   test_coords_array_copyc   s    "$rW   )   r   r   zGEOS < 3.12)reasonc                   C   sh   t jd d  dgksJ tjd d  dgksJ tjd d  g dks%J tjd d  g dks2J d S )N)       @      @      @)rZ   r[         @r\   ))r?   r?   rJ   )rJ   r?   rZ   )rJ   rJ   r[   ))r?   r?   r]   rJ   )rJ   r?   r]   rZ   )rJ   rJ   r]   r[   )r	   r   r   r   r   r   r   r   r   test_coords_with_mr   s   r^   )numpyr   r1   Zshapelyr   r   Zshapely.tests.commonr   r   r   r   r   r	   r
   r   r   r"   rI   markZparametrizerW   Zskipifr^   r   r   r   r   <module>   s    (1
