
    (&hH                     h    d Z ddlmZ ddlZddlZdgZd Zd Zd Z	d Z
	 	 	 	 	 	 ddZ	 	 	 	 ddZdS )z.Utilities for testing with shapely geometries.    )partialNassert_geometries_equalc                     t          j        |           t          j        |          k    }t          j        d          5  t          j        | ||          }d d d            n# 1 swxY w Y   ||z  S )Nignore)invalid	tolerance)shapelyget_coordinate_dimensionnperrstateequals_exact)xyr	   dimension_equalsgeometry_equalss        J/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/testing.py_equals_exact_with_ndimr      s    7	 		)!	,	,- 
X	&	&	& J J!.q!yIIIJ J J J J J J J J J J J J J J o--s    A$$A(+A(c                 R    t          j        t          j        |           d|           S )Ng        )r   whereisnan)arrs    r   _replace_nanr      s    8BHSMM3,,,    c                    t          j        | |          \  } }t          j        | d          }t          j        |d          }|j        |j        k    rdS t          j        |          }t          j        |          }||k                                    s&t          | |g|dz   |          }	t          |	          t          j	        | t          d          }
t          j	        |t          d          }t          |
||          S )NT)	include_zFz*
x and y nan coordinate location mismatch:verboser   )r   broadcast_arraysr
   get_coordinatesshaper   allbuild_err_msgAssertionError	transformr   r   )r   r   r	   err_msgr   x_coordsy_coordsx_idy_idmsgx_no_nany_no_nans               r   _assert_nan_coords_samer.      s   q!$$DAq&qD999H&qD999H ~''u 8HD8HDDL "FCC
 
 

 S!!!  LDAAAH LDAAAH"8XKKKKr   c                 :   t          j        |           }t          j        |          }||k                                    s&t          | |g|dz   |          }t	          |          | j        dk    rt          |          S |j        dk    rt          |          S |S )Nz 
x and y None location mismatch:r   r   )r
   
is_missingr"   r#   r$   ndimbool)r   r   r&   r   r)   r*   r+   s          r   _assert_none_samer3   5   s    a  Da  DDL "F99
 
 

 S!!! 	v{{Dzz	
1Dzzr   Hz>TF c           	         d}|r(t          j        |           } t          j        |          }t          j        |           } t          j        |          }| j        dk    p
|j        dk    }	|	sG| j        |j        k    s7t          | |g|d| j         d|j         dz   |          }
t          |
          d}|rt          | |||          }t          j	        |          s | |          ||          }} | j
        dk    rdS n|rdS t          | ||	          }|	r)t          j	        |          st          |d                   }t          j        |          rdS |s*t          | |g|d
|dz   |          }
t          |
          t          j	        |          s | |          ||          }} | j
        dk    rdS n|rdS t          | ||||          }t          j        |          s*t          | |g|d
|dz   |          }
t          |
          dS )aK  Raise an AssertionError if two geometry array_like objects are not equal.

    Given two array_like objects, check that the shape is equal and all elements
    of these objects are equal. An exception is raised at shape mismatch or
    conflicting values. In contrast to the standard usage in shapely, no
    assertion is raised if both objects have NaNs/Nones in the same positions.

    Parameters
    ----------
    x, y : Geometry or array_like
        Geometry or geometries to compare.
    tolerance: float, default 1e-7
        The tolerance to use when comparing geometries.
    equal_none : bool, default True
        Whether to consider None elements equal to other None elements.
    equal_nan : bool, default True
        Whether to consider nan coordinates as equal to other nan coordinates.
    normalize : bool, default False
        Whether to normalize geometries prior to comparison.
    err_msg : str, optional
        The error message to be printed in case of failure.
    verbose : bool, optional
        If True, the conflicting values are appended to the error message.

    Tr   z	
(shapes z, z
 mismatch)r   FNr   z
Not equal to tolerance g)r
   	normalizer   asarrayr1   r!   r#   r$   r3   isscalarsizer   r2   r"   r.   )r   r   r	   
equal_none	equal_nanr8   r&   r   __tracebackhide__	is_scalarr+   flaggedis_equals                r   r   r   K   s   F  !a  a  

1A

1A!*qv{I  "AG++FA17AAagAAAA
 
 

 S!!!G <#Aq'7;;;w '{AwhK16Q;;F 	 &q!yAAAH %X.. %$$	vh " "F?)????
 
 

 S!!! ;x   (|Qy\16Q;;F 	 &q!YIIH6( "F?)????
 
 

 S!!!" "r   Geometries are not equal:r   r      c                     d|z   g}|ra|                     d          dk    r3t          |          dt          |          z
  k     r|d         dz   |z   g}n|                    |           |rt          |           D ]\  }}t	          |t
          j                  rt          t
          j        |          }	nt          }		  |	|          }
n2# t          $ r%}dt          |          j         d| d	}
Y d }~nd }~ww xY w|
                    d          d
k    r4d                    |
                                d d
                   }
|
dz  }
|                    d||          d|
            d                    |          S )N
O   r    )	precisionz[repr failed for <z>: ]   z...z: )findlenappend	enumerate
isinstancer   ndarrayr   
array_reprrepr	Exceptiontype__name__countjoin
splitlines)arraysr&   headerr   namesrJ   r+   iar_funcrexcs               r   r#   r#      s    &=/C  <<##GrCKK7G(G(Gq6C<')*CCJJw ,f%% 	, 	,DAq!RZ((  )DDDEF1II E E EDa)9DDcDDDEwwt}}q  IIallnnRaR011U
JJ*58**q**++++99S>>s   >C


C9C44C9)r4   TTFr5   T)rB   TrC   rD   )__doc__	functoolsr   numpyr   r
   __all__r   r   r.   r3   r   r#    r   r   <module>rh      s    4 4           $
%. . .- - -L L L6  2 a" a" a" a"T '
     r   