
    ph@+                         S r SSKrSSKrSSKJrJr  SSKJr  S r	S r
S rS rS	 r       SS
 jrS rS r         SS jrg)z,Testing functionality for geopandas objects.    N)GeoDataFrame	GeoSeries)GeometryDtypec                 n   [         R                  " 5          [         R                  " SS[        5        [	        U S5      (       a  U R                  5       sSSS5        $ [	        U S5      (       a  U R                  5       sSSS5        $ [        R                  " U 5      sSSS5        $ ! , (       d  f       g= f)z<Version of isna that works for both scalars and (Geo)Series.ignorez&GeoSeries.isna\(\) previously returnedisnaNisnull)warningscatch_warningsfilterwarningsUserWarninghasattrr   r	   pd)thiss    iC:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\geopandas/testing.py_isnar      s    		 	 	"
 	?	
 4  99; 
#	" T8$$;;= 
#	" 99T? 
#	"	"s   =B& B&B&&
B4c                     U R                  U5      U R                  UR                  -  -  [        U 5      [        U5      -  -  $ )a'  
Test for geometric equality. Empty or missing geometries are considered
equal.

Parameters
----------
this, that : arrays of Geo objects (or anything that has an `is_empty`
             attribute)

Returns
-------
Series
    boolean Series, True if geometries in left equal geometries in right
)geom_equalsis_emptyr   r   thats     r   _geom_equals_maskr      sA      	==4==(	*;t$	&    c                 4    [        X5      R                  5       $ )a  
Test for geometric equality. Empty or missing geometries are considered
equal.

Parameters
----------
this, that : arrays of Geo objects (or anything that has an `is_empty`
             attribute)

Returns
-------
bool
    True if all geometries in left equal geometries in right
)r   allr   s     r   r   r   3   s     T(,,..r   c                     U R                  USS9U R                  UR                  -  -  [        U 5      [        U5      -  -  $ )a  
Test for 'almost' geometric equality. Empty or missing geometries
considered equal.

This method allows small difference in the coordinates, but this
requires coordinates be in the same order for all components of a geometry.

Parameters
----------
this, that : arrays of Geo objects

Returns
-------
Series
    boolean Series, True if geometries in left almost equal geometries in right
gƠ>)	tolerance)geom_equals_exactr   r   r   s     r   _geom_almost_equals_maskr   E   sG    $ 	t/?@==4==(	*;t$	&r   c                     [        U [        5      (       a-  [        U[        5      (       a  U R                  n UR                  n[        X5      R	                  5       $ )a  
Test for 'almost' geometric equality. Empty or missing geometries
considered equal.

This method allows small difference in the coordinates, but this
requires coordinates be in the same order for all components of a geometry.

Parameters
----------
this, that : arrays of Geo objects (or anything that has an `is_empty`
             property)

Returns
-------
bool
    True if all geometries in left almost equal geometries in right
)
isinstancer   geometryr   r   r   s     r   geom_almost_equalsr#   ]   sC    $ $%%*T<*H*H}}}}#D/3355r   c	                    [        U 5      [        U5      :X  d   [        U 5       S[        U5       35       eU(       a  Sn	[        U R                  [        5      (       d    U	R	                  U R                  5      5       e[        UR                  [        5      (       d    U	R	                  U R                  5      5       eU(       a0  [        U R
                  [        UR
                  5      5      (       d   eU(       aW  [        U [        5      (       d   e[        U [        U5      5      (       d   eU(       a  U R                  UR                  :X  d   eOH[        U [        5      (       d  [        U 5      n [        U[        5      (       d  [        XR
                  S9nU R
                  R                  UR
                  5      (       d!   SU R
                   SUR
                   35       eU(       aM  U R                  UR                  :H  R                  5       (       d!   SU R                   SUR                   35       eU(       aF  [        U R                  R                  5       5      n [        UR                  R                  5       5      nU(       dG  [        R                  " 5          [        R                   " SS["        5        [%        XU5        SSS5        g[%        XU5        g! , (       d  f       g= f)	a  
Test util for checking that two GeoSeries are equal.

Parameters
----------
left, right : two GeoSeries
check_dtype : bool, default False
    If True, check geo dtype [only included so it's a drop-in replacement
    for assert_series_equal].
check_index_type : bool, default False
    Check that index types are equal.
check_series_type : bool, default True
    Check that both are same type (*and* are GeoSeries). If False,
    will attempt to convert both into GeoSeries.
check_less_precise : bool, default False
    If True, use geom_equals_exact with relative error of 0.5e-6.
    If False, use geom_equals.
check_geom_type : bool, default False
    If True, check that all the geom types are equal.
check_crs: bool, default True
    If `check_series_type` is True, then also check that the
    crs matches.
normalize: bool, default False
    If True, normalize the geometries before comparing equality.
    Typically useful with ``check_less_precise=True``, which uses
    ``geom_equals_exact`` and requires exact coordinate order.
z != z(dtype should be a GeometryDtype, got {0})indexzindex: ztype: r   zCRS mismatchN)lenr!   dtyper   formatr%   typer   crsequals	geom_typer   array	normalizer
   r   r   r   _check_equality)
leftrightcheck_dtypecheck_index_typecheck_series_typecheck_less_precisecheck_geom_type	check_crsr.   msgs
             r   assert_geoseries_equalr9   v   s$   L t9E
"Bs4ykc%j\$BB"8$**m44Lcjj6LL4%++}55Mszz$**7MM5$**d5;;&78888$	****$U,,,,88uyy((($	**T?D%++e::6E::U[[))RWTZZLU[[M+RR)%//16688 	
T^^$D(9:	
8 --/0%++//12$$&##HnkJD);< '& 	%78	 '&s   #)K""
K0c                 J    [        U 5      n[        U5      S:  a  USS S-   $ U$ )zTruncate WKT repr of geom.d   Nz...)strr&   )geomss     r   _truncated_stringr?      s+    D	A
1v|#wr   c                 t   SnU(       a  Sn[        X5      nOSn[        X5      nUR                  5       (       d  X)    nX)    n[        UR	                  [        U5      [        U 5      UR                  R                  5       U[        UR                  S   5      [        UR                  S   5      5      5      eg )Nz{0} out of {1} geometries are not {3}equal.
Indices where geometries are not {3}equal: {2} 
The first not {3}equal geometry:
Left: {4}
Right: {5}
zalmost  r   )
r   r   r   AssertionErrorr(   r&   r%   to_listr?   iloc)r0   r1   r5   assert_error_messagepreciseequalunequal_left_geomsunequal_right_geomss           r   r/   r/      s    	  (5!$.99;;!&\#Fm ''&'D	"((002!"4"9"9!"<=!"5":":1"=>	
 		
 r   c                     SSK JnJn  U(       a  [        U [        5      (       d   e[        U [        U5      5      (       d   eU	(       a  U R                  c  UR                  c  OU R                  U R                  ;  a  UR                  UR                  ;  a  OU R                  (       d  UR                  (       d  O]U R                  UR                  :X  d   eO@[        U [        5      (       d  [        U 5      n [        U[        5      (       d  [        U5      nU R                  UR                  :X  d?   SU R                  < SUR                  < SU R                  < SUR                  < 35       eU(       a  U R                  U5      n U" U R                  UR                  USS	9  U R                  R                  5        H/  u  p[        U[        5      (       d  M  [!        X   X   U
UUUU	S
9  M1     U R                  UR                  :X  d   eU R#                  SS9nUR#                  SS9nU" UUUUUSS9  g! [         a    SSKJnJn   GNGf = f)a  Check that two GeoDataFrames are equal.

Parameters
----------
left, right : two GeoDataFrames
check_dtype : bool, default True
    Whether to check the DataFrame dtype is identical.
check_index_type, check_column_type : bool, default 'equiv'
    Check that index types are equal.
check_frame_type : bool, default True
    Check that both are same type (*and* are GeoDataFrames). If False,
    will attempt to convert both into GeoDataFrame.
check_like : bool, default False
    If true, ignore the order of rows & columns
check_less_precise : bool, default False
    If True, use geom_equals_exact. if False, use geom_equals.
check_geom_type : bool, default False
    If True, check that all the geom types are equal.
check_crs: bool, default True
    If `check_frame_type` is True, then also check that the
    crs matches.
normalize: bool, default False
    If True, normalize the geometries before comparing equality.
    Typically useful with ``check_less_precise=True``, which uses
    ``geom_equals_exact`` and requires exact coordinate order.
r   )assert_frame_equalassert_index_equalNz#GeoDataFrame shape mismatch, left: z	, right: z.
Left columns: z, right columns: zGeoDataFrame.columns)exactobj)r.   r2   r5   r6   r7   r"   )excluder   )r2   r3   check_column_typerN   )pandas.testingrK   rL   ImportErrorpandas.util.testingr!   r   r)   _geometry_column_namecolumnsr*   shapereindex_likedtypesitemsr   r9   select_dtypes)r0   r1   r2   r3   rP   check_frame_type
check_liker5   r6   r7   r.   rK   rL   colr'   left2right2s                    r   assert_geodataframe_equalr`      s    NOI
 $----$U,,,, **2//7**$,,>//u}}DXXeiixx599,,,$--%D%.. 'E ::$ 
-djj^9U[[O T((9%--9J	L$
   ' emm+<BX
 kk'')
e]++"	
#'#5 /# * %%)D)DDDD z2E   4F)+A  ONNOs   H< <II)TFTFFTF)	Tequivra   TFFFTF)__doc__r
   pandasr   	geopandasr   r   geopandas.arrayr   r   r   r   r   r#   r9   r?   r/   r`    r   r   <module>rg      sy    2   - )#$,/$068 L9^
B qr   