
    (&h                     >   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          Z G d d          Z G d d	          Zej                            d
eeee	g          d             Zej                            edk     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                       e Zd ZdZd Z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                     t          j        ddgddggt           j                  }t          j        t          |          j                  }|                                |                                k    sJ d S )N   "   8   N   dtypenparrayfloat32r   coordstolistselfr   processed_coordss      ]/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/tests/geometry/test_coords.pytest_data_promotionzTestCoords.test_data_promotion   sl    B8b"X.bjAAA8Jv$6$6$=>>}}"2"9"9";";;;;;;;    c                    t          j        ddgddggt           j                  }t          j        t          |d d d                   j                  }|d d d                                         |                                k    sJ d S )Nr   r   r   r   r   r   r   s      r   test_data_destridingzTestCoords.test_data_destriding   s    B8b"X.bjAAA 8Jvddd|$<$<$CDDddd|""$$(8(?(?(A(AAAAAAAr!   N)__name__
__module____qualname____doc__r    r$    r!   r   r   r      sA         < < <B B B B Br!   r   c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )TestCoordsGetItemc                    d t          d          D             }t          |          }t          dd          D ]}|j        |         ||         k    sJ t          j        t
                    5  |j        d          d d d            n# 1 swxY w Y   t          j        t
                    5  |j        d          d d d            d S # 1 swxY w Y   d S )Nc                 L    g | ]!}t          |          t          |           f"S r)   float.0xs     r   
<listcomp>z7TestCoordsGetItem.test_index_coords.<locals>.<listcomp>)   +    555qeAhhqb		"555r!      ranger   r   pytestraises
IndexErrorr   cgis       r   test_index_coordsz#TestCoordsGetItem.test_index_coords(   sJ   55E!HH555qMMr1 	' 	'A8A;!A$&&&&&]:&& 	 	HQKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:&& 	 	HRLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	$   .BBB,CCCc                    d t          d          D             }t          |          }t          dd          D ]}|j        |         ||         k    sJ t          j        t
                    5  |j        d          d d d            n# 1 swxY w Y   t          j        t
                    5  |j        d          d d d            d S # 1 swxY w Y   d S )Nc                 n    g | ]2}t          |          t          |           t          |d z            f3S    r.   r0   s     r   r3   z9TestCoordsGetItem.test_index_coords_z.<locals>.<listcomp>3   7    CCCQeAhhqb		5Q<<0CCCr!   r5   r6   r7   r8   r=   s       r   test_index_coords_zz%TestCoordsGetItem.test_index_coords_z2   sJ   CC%((CCCqMMr1 	' 	'A8A;!A$&&&&&]:&& 	 	HQKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:&& 	 	HRLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rB   c                    t                      }t          j        t                    5  |j        d          d d d            n# 1 swxY w Y   t          j        t
                    5  |j        d          d d d            d S # 1 swxY w Y   d S )Nr           )r   r:   r;   r<   r   	TypeError)r   r?   s     r   test_index_coords_miscz(TestCoordsGetItem.test_index_coords_misc<   s    LL]:&& 	 	HQKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]9%% 	 	HSMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AA	A&BBBc                    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    sJ |j        d d         |d d         k    sJ |j        dd          |dd          cxk    rg k    sn J d S )Nc                 L    g | ]!}t          |          t          |           f"S r)   r.   r0   s     r   r3   z7TestCoordsGetItem.test_slice_coords.<locals>.<listcomp>D   r4   r!   r5      r#   rF   r9   r   r   r   r>   r?   s      r   test_slice_coordsz#TestCoordsGetItem.test_slice_coordsC   s   55E!HH555qMMx|qu$$$$x}#2#&&&&x"~44R4((((x!}##A#&&&&x|q!u$$$$x|qu************r!   c                    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    sJ |j        d d         |d d         k    sJ |j        dd          |dd          cxk    rg k    sn J d S )Nc                 n    g | ]2}t          |          t          |           t          |d z            f3S rE   r.   r0   s     r   r3   z9TestCoordsGetItem.test_slice_coords_z.<locals>.<listcomp>N   rG   r!   r5   rO   r#   rF   rP   rQ   s      r   test_slice_coords_zz%TestCoordsGetItem.test_slice_coords_zM   s   CC%((CCCqMMx|qu$$$$x}#2#&&&&x"~44R4((((x!}##A#&&&&x|q!u$$$$x|qu************r!   N)r%   r&   r'   rA   rH   rL   rR   rU   r)   r!   r   r+   r+   '   s_              + + ++ + + + +r!   r+   c                       e Zd ZdZd ZdS )TestXYz<New geometry/coordseq method 'xy' makes numpy interop easierc                     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   )rO   rO   rF   rJ         ?)r   xylenlist)r   r2   ys      r   test_arrayszTestXY.test_arrays[   s}    66*++.11vv{{{{Aww3*$$$$1vv{{{{Aww3*$$$$$$r!   N)r%   r&   r'   r(   r^   r)   r!   r   rW   rW   X   s)        FF% % % % %r!   rW   geomc                 0   | j         }t          j        |          t          j        |          usJ t          j        |d          t          j        |d          usJ t          t          j        j                            dd          d                   dk    rLt          j        t          d          5  t          j        |d	           d
d
d
           d
S # 1 swxY w Y   d
S t          j        |d	          t          j        |d	          u sJ d
S )z)Test CoordinateSequence.__array__ method.T)copy.rO   r   rF   zA copy is always created)matchFN)
r   r   r   intversionshort_versionsplitr:   r;   
ValueError)r_   	coord_seqs     r   test_coords_array_copyrj   c   sT    I8Ibhy&9&999998ID))))$1O1O1OOOOO 2:#))#q11!455::]:-GHHH 	, 	,HYU++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, x	..."(952Q2Q2QQQQQQQs   7CC"C)   r   r   zGEOS < 3.12)reasonc                      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    sJ d S )N)       @      @      @)rn   ro         @rp   ))rJ   rJ   rY   )rY   rJ   rn   )rY   rY   ro   ))rJ   rJ   rq   rY   )rY   rJ   rq   rn   )rY   rY   rq   ro   )r
   r   r   r   r   r)   r!   r   test_coords_with_mrr   r   s    >!!! 11111?111"6!77777" ' ' '    
  # ( ( (      r!   )numpyr   r:   shapelyr   r   shapely.tests.commonr   r   r   r   r	   r
   r   r   r   r+   rW   markparametrizerj   skipifrr   r)   r!   r   <module>ry      s        , , , , , , , ,	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	B B B B B B B B,.+ .+ .+ .+ .+ .+ .+ .+b% % % % % % % % %+}!MNNR R ONR L:-mDD  ED  r!   