vibespatial.api.testing

Testing functionality for geopandas objects.

Functions

geom_equals(this, that)

Test for geometric equality. Empty or missing geometries are considered

geom_almost_equals(this, that)

Test for 'almost' geometric equality. Empty or missing geometries

assert_geoseries_equal(left, right[, check_dtype, ...])

Test util for checking that two GeoSeries are equal.

assert_geodataframe_equal(left, right[, check_dtype, ...])

Check that two GeoDataFrames are equal.

Module Contents

vibespatial.api.testing.geom_equals(this, that)

Test for geometric equality. Empty or missing geometries are considered equal.

Parameters

this, thatarrays of Geo objects (or anything that has an is_empty

attribute)

Returns

bool

True if all geometries in left equal geometries in right

vibespatial.api.testing.geom_almost_equals(this, that)

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, thatarrays of Geo objects (or anything that has an is_empty

property)

Returns

bool

True if all geometries in left almost equal geometries in right

vibespatial.api.testing.assert_geoseries_equal(left, right, check_dtype=True, check_index_type=False, check_series_type=True, check_less_precise=False, check_geom_type=False, check_crs=True, normalize=False)

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_typebool, default False

Check that index types are equal.

check_series_typebool, default True

Check that both are same type (and are GeoSeries). If False, will attempt to convert both into GeoSeries.

check_less_precisebool, default False

If True, use geom_equals_exact with relative error of 0.5e-6. If False, use geom_equals.

check_geom_typebool, 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.

vibespatial.api.testing.assert_geodataframe_equal(left, right, check_dtype=True, check_index_type='equiv', check_column_type='equiv', check_frame_type=True, check_like=False, check_less_precise=False, check_geom_type=False, check_crs=True, normalize=False)

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_typebool, default ‘equiv’

Check that index types are equal.

check_frame_typebool, default True

Check that both are same type (and are GeoDataFrames). If False, will attempt to convert both into GeoDataFrame.

check_likebool, default False

If true, ignore the order of rows & columns

check_less_precisebool, default False

If True, use geom_equals_exact. if False, use geom_equals.

check_geom_typebool, 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.