From 77f804fd9258496ae4983b527f601fb0a468d937 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:05:42 -0700 Subject: [PATCH 01/17] Switch test_geodataframe.py to use public cudf testing APIs. --- .../cuspatial/tests/test_geodataframe.py | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_geodataframe.py b/python/cuspatial/cuspatial/tests/test_geodataframe.py index 7accca35c..b51c49725 100644 --- a/python/cuspatial/cuspatial/tests/test_geodataframe.py +++ b/python/cuspatial/cuspatial/tests/test_geodataframe.py @@ -14,7 +14,8 @@ Polygon, ) -from cudf.testing._utils import assert_eq +import cudf +from cudf.testing import assert_series_equal import cuspatial @@ -80,18 +81,6 @@ def assert_eq_multipoint(p1, p2): assert_eq_point(p1[i], p2[i]) -def assert_eq_linestring(p1, p2): - assert type(p1) == type(p2) - assert len(p1.coords) == len(p2.coords) - for i in range(len(p1.coords)): - assert_eq(p1.coords[i], p2.coords[i]) - - -def assert_eq_multilinestring(p1, p2): - for i in range(len(p1)): - assert_eq_linestring(p1[i], p2[i]) - - def assert_eq_polygon(p1, p2): if not p1.equals(p2): raise ValueError @@ -112,21 +101,21 @@ def assert_eq_geo_df(geo1, geo2): def test_select_multiple_columns(gpdf): cugpdf = cuspatial.from_geopandas(gpdf) - assert_eq(cugpdf[["geometry", "key"]], gpdf[["geometry", "key"]]) + pd.testing.assert_frame_equal(cugpdf[["geometry", "key"]].to_pandas(), gpdf[["geometry", "key"]]) def test_sort_values(gpdf): cugpdf = cuspatial.from_geopandas(gpdf) sort_gpdf = gpdf.sort_values("random") - sort_cugpdf = cugpdf.sort_values("random") - assert_eq(sort_gpdf, sort_cugpdf) + sort_cugpdf = cugpdf.sort_values("random").to_pandas() + pd.testing.assert_frame_equal(sort_gpdf, sort_cugpdf) def test_groupby(gpdf): cugpdf = cuspatial.from_geopandas(gpdf) - assert_eq( + pd.testing.assert_frame_equal( gpdf.groupby("key").min().sort_index(), - cugpdf.groupby("key").min().sort_index(), + cugpdf.groupby("key").min().sort_index().to_pandas(), ) @@ -139,34 +128,34 @@ def test_interleaved_point(gpdf, polys): cugpdf = cuspatial.from_geopandas(gpdf) cugs = cugpdf["geometry"] gs = gpdf["geometry"] - assert_eq(cugs.points.x, gs[gs.type == "Point"].x.reset_index(drop=True)) - assert_eq(cugs.points.y, gs[gs.type == "Point"].y.reset_index(drop=True)) - assert_eq( + pd.testing.assert_series_equal(cugs.points.x.to_pandas(), gs[gs.type == "Point"].x.reset_index(drop=True)) + pd.testing.assert_series_equal(cugs.points.y.to_pandas(), gs[gs.type == "Point"].y.reset_index(drop=True)) + assert_series_equal( cugs.multipoints.x, - pd.Series( + cudf.Series( np.array( [np.array(p)[:, 0] for p in gs[gs.type == "MultiPoint"]] ).flatten() ), ) - assert_eq( + assert_series_equal( cugs.multipoints.y, - pd.Series( + cudf.Series( np.array( [np.array(p)[:, 1] for p in gs[gs.type == "MultiPoint"]] ).flatten() ), ) - assert_eq( + assert_series_equal( cugs.lines.x, - pd.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), + cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), ) - assert_eq( + assert_series_equal( cugs.lines.y, - pd.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), + cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), ) - assert_eq(cugs.polygons.x, pd.Series(polys[:, 0], dtype="float64")) - assert_eq(cugs.polygons.y, pd.Series(polys[:, 1], dtype="float64")) + assert_series_equal(cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64")) + assert_series_equal(cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64")) def test_to_shapely_random(): From 03221c074d7d423585e8f222ff8691149fd6578f Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:14:16 -0700 Subject: [PATCH 02/17] Update geoseries tests. --- .../cuspatial/tests/test_geodataframe.py | 13 ++++----- .../cuspatial/tests/test_geoseries.py | 28 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_geodataframe.py b/python/cuspatial/cuspatial/tests/test_geodataframe.py index b51c49725..86262c2b9 100644 --- a/python/cuspatial/cuspatial/tests/test_geodataframe.py +++ b/python/cuspatial/cuspatial/tests/test_geodataframe.py @@ -15,7 +15,6 @@ ) import cudf -from cudf.testing import assert_series_equal import cuspatial @@ -130,7 +129,7 @@ def test_interleaved_point(gpdf, polys): gs = gpdf["geometry"] pd.testing.assert_series_equal(cugs.points.x.to_pandas(), gs[gs.type == "Point"].x.reset_index(drop=True)) pd.testing.assert_series_equal(cugs.points.y.to_pandas(), gs[gs.type == "Point"].y.reset_index(drop=True)) - assert_series_equal( + cudf.testing.assert_series_equal( cugs.multipoints.x, cudf.Series( np.array( @@ -138,7 +137,7 @@ def test_interleaved_point(gpdf, polys): ).flatten() ), ) - assert_series_equal( + cudf.testing.assert_series_equal( cugs.multipoints.y, cudf.Series( np.array( @@ -146,16 +145,16 @@ def test_interleaved_point(gpdf, polys): ).flatten() ), ) - assert_series_equal( + cudf.testing.assert_series_equal( cugs.lines.x, cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), ) - assert_series_equal( + cudf.testing.assert_series_equal( cugs.lines.y, cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), ) - assert_series_equal(cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64")) - assert_series_equal(cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64")) + cudf.testing.assert_series_equal(cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64")) + cudf.testing.assert_series_equal(cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64")) def test_to_shapely_random(): diff --git a/python/cuspatial/cuspatial/tests/test_geoseries.py b/python/cuspatial/cuspatial/tests/test_geoseries.py index e08c35744..1e1576d43 100644 --- a/python/cuspatial/cuspatial/tests/test_geoseries.py +++ b/python/cuspatial/cuspatial/tests/test_geoseries.py @@ -14,7 +14,7 @@ Polygon, ) -from cudf.testing._utils import assert_eq +import cudf import cuspatial @@ -84,7 +84,7 @@ def assert_eq_linestring(p1, p2): assert type(p1) == type(p2) assert len(p1.coords) == len(p2.coords) for i in range(len(p1.coords)): - assert_eq(p1.coords[i], p2.coords[i]) + assert p1.coords[i] == p2.coords[i] def assert_eq_multilinestring(p1, p2): @@ -114,34 +114,34 @@ def assert_eq_geo(geo1, geo2): def test_interleaved_point(gs, polys): cugs = cuspatial.from_geopandas(gs) - assert_eq(cugs.points.x, gs[gs.type == "Point"].x.reset_index(drop=True)) - assert_eq(cugs.points.y, gs[gs.type == "Point"].y.reset_index(drop=True)) - assert_eq( + pd.testing.assert_series_equal(cugs.points.x.to_pandas(), gs[gs.type == "Point"].x.reset_index(drop=True)) + pd.testing.assert_series_equal(cugs.points.y.to_pandas(), gs[gs.type == "Point"].y.reset_index(drop=True)) + cudf.testing.assert_series_equal( cugs.multipoints.x, - pd.Series( + cudf.Series( np.array( [np.array(p)[:, 0] for p in gs[gs.type == "MultiPoint"]] ).flatten() ), ) - assert_eq( + cudf.testing.assert_series_equal( cugs.multipoints.y, - pd.Series( + cudf.Series( np.array( [np.array(p)[:, 1] for p in gs[gs.type == "MultiPoint"]] ).flatten() ), ) - assert_eq( + cudf.testing.assert_series_equal( cugs.lines.x, - pd.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), + cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), ) - assert_eq( + cudf.testing.assert_series_equal( cugs.lines.y, - pd.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), + cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), ) - assert_eq(cugs.polygons.x, pd.Series(polys[:, 0], dtype="float64")) - assert_eq(cugs.polygons.y, pd.Series(polys[:, 1], dtype="float64")) + cudf.testing.assert_series_equal(cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64")) + cudf.testing.assert_series_equal(cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64")) def test_to_shapely_random(): From 6660a512cecc950129d26615803192a0512c010f Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:20:27 -0700 Subject: [PATCH 03/17] Fix formatting of geodataframe and geoseries tests and remove assert_eq from test_from_geopandas. --- .../cuspatial/tests/test_from_geopandas.py | 65 ++++++++++++------- .../cuspatial/tests/test_geodataframe.py | 33 +++++++--- .../cuspatial/tests/test_geoseries.py | 29 +++++++-- 3 files changed, 89 insertions(+), 38 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_from_geopandas.py b/python/cuspatial/cuspatial/tests/test_from_geopandas.py index 4383bb448..f4c6b9edb 100644 --- a/python/cuspatial/cuspatial/tests/test_from_geopandas.py +++ b/python/cuspatial/cuspatial/tests/test_from_geopandas.py @@ -1,6 +1,6 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. - import geopandas as gpd +import pandas as pd from shapely.geometry import ( LineString, MultiLineString, @@ -11,7 +11,6 @@ ) import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -24,9 +23,9 @@ def test_geobuffer_len(gs): def test_mixed_dataframe(gs): gpdf = gpd.GeoDataFrame({"a": list(range(100, 100 + len(gs))), "b": gs}) cgdf = cuspatial.from_geopandas(gpdf) - assert_eq(gpdf["a"], cgdf["a"].to_pandas()) + pd.testing.assert_frame_equal(gpdf["a"], cgdf["a"].to_pandas()) assert gpdf["b"].equals(cgdf["b"].to_pandas()) - assert_eq(gpdf, cgdf) + pd.testing.assert_frame_equal(gpdf, cgdf) def test_dataframe_column_access(gs): @@ -48,45 +47,61 @@ def test_from_geoseries_complex(gs): def test_from_geopandas_point(): gs = gpd.GeoSeries(Point(1.0, 2.0)) cugs = cuspatial.from_geopandas(gs) - assert_eq(cugs.points.xy, cudf.Series([1.0, 2.0])) + cudf.testing.assert_series_equal(cugs.points.xy, cudf.Series([1.0, 2.0])) def test_from_geopandas_multipoint(): gs = gpd.GeoSeries(MultiPoint([(1.0, 2.0), (3.0, 4.0)])) cugs = cuspatial.from_geopandas(gs) - assert_eq(cugs.multipoints.xy, cudf.Series([1.0, 2.0, 3.0, 4.0])) - assert_eq(cugs.multipoints.offsets, cudf.Series([0, 4])) + cudf.testing.assert_series_equal( + cugs.multipoints.xy, cudf.Series([1.0, 2.0, 3.0, 4.0]) + ) + cudf.testing.assert_series_equal( + cugs.multipoints.offsets, cudf.Series([0, 4]) + ) def test_from_geopandas_linestring(): gs = gpd.GeoSeries(LineString(((4.0, 3.0), (2.0, 1.0)))) cugs = cuspatial.from_geopandas(gs) - assert_eq(cugs.lines.xy, cudf.Series([4.0, 3.0, 2.0, 1.0])) - assert_eq(cugs.lines.offsets, cudf.Series([0, 4])) + cudf.testing.assert_series_equal( + cugs.lines.xy, cudf.Series([4.0, 3.0, 2.0, 1.0]) + ) + cudf.testing.assert_series_equal(cugs.lines.offsets, cudf.Series([0, 4])) def test_from_geopandas_multilinestring(): gs = gpd.GeoSeries( - MultiLineString((((1.0, 2.0), (3.0, 4.0)), ((5.0, 6.0), (7.0, 8.0)),)) + MultiLineString( + ( + ((1.0, 2.0), (3.0, 4.0)), + ((5.0, 6.0), (7.0, 8.0)), + ) + ) ) cugs = cuspatial.from_geopandas(gs) - assert_eq( - cugs.lines.xy, cudf.Series([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), + cudf.testing.assert_series_equal( + cugs.lines.xy, + cudf.Series([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), + ) + cudf.testing.assert_series_equal( + cugs.lines.offsets, cudf.Series([0, 4, 8]) ) - assert_eq(cugs.lines.offsets, cudf.Series([0, 4, 8])) def test_from_geopandas_polygon(): gs = gpd.GeoSeries( - Polygon(((0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.0)),) + Polygon( + ((0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.0)), + ) ) cugs = cuspatial.from_geopandas(gs) - assert_eq( + cudf.testing.assert_series_equal( cugs.polygons.xy, cudf.Series([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0]), ) - assert_eq(cugs.polygons.polys, cudf.Series([0, 1])) - assert_eq(cugs.polygons.rings, cudf.Series([0, 8])) + cudf.testing.assert_series_equal(cugs.polygons.polys, cudf.Series([0, 1])) + cudf.testing.assert_series_equal(cugs.polygons.rings, cudf.Series([0, 8])) def test_from_geopandas_polygon_hole(): @@ -97,7 +112,7 @@ def test_from_geopandas_polygon_hole(): ) ) cugs = cuspatial.from_geopandas(gs) - assert_eq( + cudf.testing.assert_series_equal( cugs.polygons.xy, cudf.Series( [ @@ -120,8 +135,10 @@ def test_from_geopandas_polygon_hole(): ] ), ) - assert_eq(cugs.polygons.polys, cudf.Series([0, 2])) - assert_eq(cugs.polygons.rings, cudf.Series([0, 8, 16])) + cudf.testing.assert_series_equal(cugs.polygons.polys, cudf.Series([0, 2])) + cudf.testing.assert_series_equal( + cugs.polygons.rings, cudf.Series([0, 8, 16]) + ) def test_from_geopandas_multipolygon(): @@ -136,7 +153,7 @@ def test_from_geopandas_multipolygon(): ) ) cugs = cuspatial.from_geopandas(gs) - assert_eq( + cudf.testing.assert_series_equal( cugs.polygons.xy, cudf.Series( [ @@ -159,5 +176,7 @@ def test_from_geopandas_multipolygon(): ] ), ) - assert_eq(cugs.polygons.polys, cudf.Series([0, 2])) - assert_eq(cugs.polygons.rings, cudf.Series([0, 8, 16])) + cudf.testing.assert_series_equal(cugs.polygons.polys, cudf.Series([0, 2])) + cudf.testing.assert_series_equal( + cugs.polygons.rings, cudf.Series([0, 8, 16]) + ) diff --git a/python/cuspatial/cuspatial/tests/test_geodataframe.py b/python/cuspatial/cuspatial/tests/test_geodataframe.py index 86262c2b9..c53336a19 100644 --- a/python/cuspatial/cuspatial/tests/test_geodataframe.py +++ b/python/cuspatial/cuspatial/tests/test_geodataframe.py @@ -1,5 +1,4 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. - import geopandas as gpd import numpy as np import pandas as pd @@ -100,7 +99,9 @@ def assert_eq_geo_df(geo1, geo2): def test_select_multiple_columns(gpdf): cugpdf = cuspatial.from_geopandas(gpdf) - pd.testing.assert_frame_equal(cugpdf[["geometry", "key"]].to_pandas(), gpdf[["geometry", "key"]]) + pd.testing.assert_frame_equal( + cugpdf[["geometry", "key"]].to_pandas(), gpdf[["geometry", "key"]] + ) def test_sort_values(gpdf): @@ -127,8 +128,14 @@ def test_interleaved_point(gpdf, polys): cugpdf = cuspatial.from_geopandas(gpdf) cugs = cugpdf["geometry"] gs = gpdf["geometry"] - pd.testing.assert_series_equal(cugs.points.x.to_pandas(), gs[gs.type == "Point"].x.reset_index(drop=True)) - pd.testing.assert_series_equal(cugs.points.y.to_pandas(), gs[gs.type == "Point"].y.reset_index(drop=True)) + pd.testing.assert_series_equal( + cugs.points.x.to_pandas(), + gs[gs.type == "Point"].x.reset_index(drop=True), + ) + pd.testing.assert_series_equal( + cugs.points.y.to_pandas(), + gs[gs.type == "Point"].y.reset_index(drop=True), + ) cudf.testing.assert_series_equal( cugs.multipoints.x, cudf.Series( @@ -147,14 +154,24 @@ def test_interleaved_point(gpdf, polys): ) cudf.testing.assert_series_equal( cugs.lines.x, - cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), + cudf.Series( + np.array([range(11, 34, 2)]).flatten(), + dtype="float64", + ), ) cudf.testing.assert_series_equal( cugs.lines.y, - cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), + cudf.Series( + np.array([range(12, 35, 2)]).flatten(), + dtype="float64", + ), + ) + cudf.testing.assert_series_equal( + cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64") + ) + cudf.testing.assert_series_equal( + cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64") ) - cudf.testing.assert_series_equal(cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64")) - cudf.testing.assert_series_equal(cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64")) def test_to_shapely_random(): diff --git a/python/cuspatial/cuspatial/tests/test_geoseries.py b/python/cuspatial/cuspatial/tests/test_geoseries.py index 1e1576d43..8b7c5900d 100644 --- a/python/cuspatial/cuspatial/tests/test_geoseries.py +++ b/python/cuspatial/cuspatial/tests/test_geoseries.py @@ -1,5 +1,4 @@ # Copyright (c) 2020-2021, NVIDIA CORPORATION. - import geopandas as gpd import numpy as np import pandas as pd @@ -114,8 +113,14 @@ def assert_eq_geo(geo1, geo2): def test_interleaved_point(gs, polys): cugs = cuspatial.from_geopandas(gs) - pd.testing.assert_series_equal(cugs.points.x.to_pandas(), gs[gs.type == "Point"].x.reset_index(drop=True)) - pd.testing.assert_series_equal(cugs.points.y.to_pandas(), gs[gs.type == "Point"].y.reset_index(drop=True)) + pd.testing.assert_series_equal( + cugs.points.x.to_pandas(), + gs[gs.type == "Point"].x.reset_index(drop=True), + ) + pd.testing.assert_series_equal( + cugs.points.y.to_pandas(), + gs[gs.type == "Point"].y.reset_index(drop=True), + ) cudf.testing.assert_series_equal( cugs.multipoints.x, cudf.Series( @@ -134,14 +139,24 @@ def test_interleaved_point(gs, polys): ) cudf.testing.assert_series_equal( cugs.lines.x, - cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), + cudf.Series( + np.array([range(11, 34, 2)]).flatten(), + dtype="float64", + ), ) cudf.testing.assert_series_equal( cugs.lines.y, - cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), + cudf.Series( + np.array([range(12, 35, 2)]).flatten(), + dtype="float64", + ), + ) + cudf.testing.assert_series_equal( + cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64") + ) + cudf.testing.assert_series_equal( + cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64") ) - cudf.testing.assert_series_equal(cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64")) - cudf.testing.assert_series_equal(cugs.polygons.y, cudf.Series(polys[:, 1], dtype="float64")) def test_to_shapely_random(): From 0c00dda6d41bb8cb522f2fdc606bede42796a2d5 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:25:48 -0700 Subject: [PATCH 04/17] Remove assert_eq from test_geoarrowbuffers.py. --- .../cuspatial/tests/test_from_geopandas.py | 4 +- .../cuspatial/tests/test_geoarrowbuffers.py | 47 +++++++++++-------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_from_geopandas.py b/python/cuspatial/cuspatial/tests/test_from_geopandas.py index f4c6b9edb..352cad9d2 100644 --- a/python/cuspatial/cuspatial/tests/test_from_geopandas.py +++ b/python/cuspatial/cuspatial/tests/test_from_geopandas.py @@ -23,9 +23,9 @@ def test_geobuffer_len(gs): def test_mixed_dataframe(gs): gpdf = gpd.GeoDataFrame({"a": list(range(100, 100 + len(gs))), "b": gs}) cgdf = cuspatial.from_geopandas(gpdf) - pd.testing.assert_frame_equal(gpdf["a"], cgdf["a"].to_pandas()) + pd.testing.assert_series_equal(gpdf["a"], cgdf["a"].to_pandas()) assert gpdf["b"].equals(cgdf["b"].to_pandas()) - pd.testing.assert_frame_equal(gpdf, cgdf) + pd.testing.assert_frame_equal(gpdf, cgdf.to_pandas()) def test_dataframe_column_access(gs): diff --git a/python/cuspatial/cuspatial/tests/test_geoarrowbuffers.py b/python/cuspatial/cuspatial/tests/test_geoarrowbuffers.py index 3abfcd381..339216f69 100644 --- a/python/cuspatial/cuspatial/tests/test_geoarrowbuffers.py +++ b/python/cuspatial/cuspatial/tests/test_geoarrowbuffers.py @@ -1,6 +1,6 @@ # Copyright (c) 2021, NVIDIA CORPORATION. - import numpy as np +import pandas as pd from geopandas import GeoSeries as gpGeoSeries from shapely.geometry import ( LineString, @@ -12,7 +12,6 @@ ) import cudf -from cudf.testing._utils import assert_eq from cuspatial import GeoArrowBuffers, GeoSeries from cuspatial.geometry.geocolumn import GeoColumn @@ -20,21 +19,27 @@ def test_points(): buffers = GeoArrowBuffers({"points_xy": [0, 1, 2, 3]}) - assert_eq(cudf.Series([0, 1, 2, 3]), buffers.points.xy) + cudf.testing.assert_series_equal( + cudf.Series([0, 1, 2, 3]), buffers.points.xy + ) assert len(buffers.points) == 2 column = GeoColumn(buffers) - assert_eq(GeoSeries(column), gpGeoSeries([Point(0, 1), Point(2, 3)])) + pd.testing.assert_series_equal( + GeoSeries(column).to_pandas(), gpGeoSeries([Point(0, 1), Point(2, 3)]) + ) def test_multipoints(): buffers = GeoArrowBuffers( {"mpoints_xy": np.arange(0, 16), "mpoints_offsets": [0, 4, 8, 12, 16]} ) - assert_eq(cudf.Series(np.arange(0, 16)), buffers.multipoints.xy) + cudf.testing.assert_series_equal( + cudf.Series(np.arange(0, 16)), buffers.multipoints.xy + ) assert len(buffers.multipoints) == 4 column = GeoColumn(buffers) - assert_eq( - GeoSeries(column), + pd.testing.assert_series_equal( + GeoSeries(column).to_pandas(), gpGeoSeries( [ MultiPoint([Point([0, 1]), Point([2, 3])]), @@ -50,11 +55,11 @@ def test_homogeneous_lines(): buffers = GeoArrowBuffers( {"lines_xy": range(24), "lines_offsets": np.array(range(5)) * 6} ) - assert_eq(cudf.Series(range(24)), buffers.lines.xy) + cudf.testing.assert_series_equal(cudf.Series(range(24)), buffers.lines.xy) assert len(buffers.lines) == 4 column = GeoColumn(buffers) - assert_eq( - GeoSeries(column), + pd.testing.assert_series_equal( + GeoSeries(column).to_pandas(), gpGeoSeries( [ LineString([[0, 1], [2, 3], [4, 5]]), @@ -74,11 +79,11 @@ def test_mixed_lines(): "mlines": [1, 3], } ) - assert_eq(cudf.Series(range(24)), buffers.lines.xy) + cudf.testing.assert_series_equal(cudf.Series(range(24)), buffers.lines.xy) assert len(buffers.lines) == 3 column = GeoColumn(buffers) - assert_eq( - GeoSeries(column), + pd.testing.assert_series_equal( + GeoSeries(column).to_pandas(), gpGeoSeries( [ LineString([[0, 1], [2, 3], [4, 5]]), @@ -108,11 +113,13 @@ def test_homogeneous_polygons(): "polygons_rings": np.arange(11) * 8, } ) - assert_eq(cudf.Series(polygons_xy.flatten()), buffers.polygons.xy) + cudf.testing.assert_series_equal( + cudf.Series(polygons_xy.flatten()), buffers.polygons.xy + ) assert len(buffers.polygons) == 6 column = GeoColumn(buffers) - assert_eq( - GeoSeries(column), + pd.testing.assert_series_equal( + GeoSeries(column).to_pandas(), gpGeoSeries( [ Polygon(((0, 1), (2, 3), (4, 5))), @@ -153,11 +160,13 @@ def test_polygons(): "mpolygons": [2, 4], } ) - assert_eq(cudf.Series(polygons_xy.flatten()), buffers.polygons.xy) + cudf.testing.assert_series_equal( + cudf.Series(polygons_xy.flatten()), buffers.polygons.xy + ) assert len(buffers.polygons) == 5 column = GeoColumn(buffers) - assert_eq( - GeoSeries(column), + pd.testing.assert_series_equal( + GeoSeries(column).to_pandas(), gpGeoSeries( [ Polygon(((0, 1), (2, 3), (4, 5))), From 8dd8a43c7966e8980645b6c80c177e69cd67cc9e Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:29:52 -0700 Subject: [PATCH 05/17] Remove assert_eq from test_hausdorff_distance.py. --- .../tests/test_hausdorff_distance.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py b/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py index e9013de11..0d6815181 100644 --- a/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py +++ b/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py @@ -1,10 +1,8 @@ # Copyright (c) 2019, NVIDIA CORPORATION. - import numpy as np import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -24,7 +22,7 @@ def test_empty(): expected = cudf.DataFrame([]) - assert_eq(expected, actual) + cudf.testing.assert_frame_equal(expected, actual) def test_zeros(): @@ -32,20 +30,24 @@ def test_zeros(): expected = cudf.DataFrame([0.0]) - assert_eq(expected, actual) + cudf.testing.assert_frame_equal(expected, actual) def test_empty_x(): with pytest.raises(RuntimeError): cuspatial.directed_hausdorff_distance( - [], [0.0], [0], + [], + [0.0], + [0], ) def test_empty_y(): with pytest.raises(RuntimeError): cuspatial.directed_hausdorff_distance( - [0.0], [], [0], + [0.0], + [], + [0], ) @@ -56,7 +58,7 @@ def test_large(): expected = cudf.DataFrame({0: [0.0, 1.0], 1: [1.0, 0.0]}) - assert_eq(expected, actual) + cudf.testing.assert_frame_equal(expected, actual) def test_count_one(): @@ -64,7 +66,7 @@ def test_count_one(): expected = cudf.DataFrame({0: [0.0, 1.0], 1: [1.0, 0.0]}) - assert_eq(expected, actual) + cudf.testing.assert_frame_equal(expected, actual) def test_count_two(): @@ -76,7 +78,7 @@ def test_count_two(): {0: [0.0, 1.4142135623730951], 1: [1.0, 0.0000000000000000]} ) - assert_eq(expected, actual) + cudf.testing.assert_frame_equal(expected, actual) def test_values(): @@ -96,4 +98,4 @@ def test_values(): } ) - assert_eq(expected, actual) + cudf.testing.assert_frame_equal(expected, actual) From 09b44fcff56d689cb92057b8b0a1a74f9bb3315b Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:34:57 -0700 Subject: [PATCH 06/17] Remove assert_eq from test_indexing.py. --- python/cuspatial/cuspatial/tests/test_indexing.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_indexing.py b/python/cuspatial/cuspatial/tests/test_indexing.py index 85a1c1e09..f114378e5 100644 --- a/python/cuspatial/cuspatial/tests/test_indexing.py +++ b/python/cuspatial/cuspatial/tests/test_indexing.py @@ -1,10 +1,8 @@ # Copyright (c) 2020, NVIDIA CORPORATION. - import numpy as np import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -22,7 +20,7 @@ def test_empty(): 1, # max_depth 1, # min_size ) - assert_eq( + cudf.testing.assert_frame_equal( quadtree, cudf.DataFrame( { @@ -46,7 +44,7 @@ def test_one_point(dtype): 1, # max_depth 1, # min_size ) - assert_eq( + cudf.testing.assert_frame_equal( quadtree, cudf.DataFrame( { @@ -70,7 +68,7 @@ def test_two_points(dtype): 1, # max_depth 1, # min_size ) - assert_eq( + cudf.testing.assert_frame_equal( quadtree, cudf.DataFrame( { @@ -249,7 +247,7 @@ def test_small_number_of_points(dtype): 3, # max_depth 12, # min_size ) - assert_eq( + cudf.testing.assert_frame_equal( quadtree, cudf.DataFrame( { From 9adf3fc316207f7ef5ab76ec73b6185fcdda594f Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:36:15 -0700 Subject: [PATCH 07/17] Remove assert_eq from test_lonlat_to_cartesian.py. --- .../cuspatial/tests/test_lonlat_to_cartesian.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_lonlat_to_cartesian.py b/python/cuspatial/cuspatial/tests/test_lonlat_to_cartesian.py index 5502fb142..23405bdad 100644 --- a/python/cuspatial/cuspatial/tests/test_lonlat_to_cartesian.py +++ b/python/cuspatial/cuspatial/tests/test_lonlat_to_cartesian.py @@ -3,7 +3,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -43,21 +42,25 @@ def test_camera_corners(corner): result = cuspatial.lonlat_to_cartesian( x[corner], y[corner], cudf.Series(x[corner]), cudf.Series(y[corner]) ) - assert_eq(result, cudf.DataFrame({"x": [0.0], "y": [0.0]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [0.0], "y": [0.0]}) + ) def test_longest_distance(): result = cuspatial.lonlat_to_cartesian( -180, -90, cudf.Series([180.0]), cudf.Series([90.0]) ) - assert_eq(result, cudf.DataFrame({"x": [-40000.0], "y": [-20000.0]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [-40000.0], "y": [-20000.0]}) + ) def test_half_distance(): result = cuspatial.lonlat_to_cartesian( -180.0, -90.0, cudf.Series([0.0]), cudf.Series([0.0]) ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame({"x": [-14142.135623730952], "y": [-10000.0]}) ) @@ -73,7 +76,9 @@ def test_zeros(): result = cuspatial.lonlat_to_cartesian( 0.0, 0.0, cudf.Series([0.0]), cudf.Series([0.0]) ) - assert_eq(result, cudf.DataFrame({"x": [0.0], "y": [0.0]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [0.0], "y": [0.0]}) + ) def test_values(): @@ -85,7 +90,7 @@ def test_values(): # note: x/y coordinates in killometers -km result = cuspatial.lonlat_to_cartesian(cam_lon, cam_lat, py_lon, py_lat) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { From a033d33c35ef379405482b0bc73bec1e6bc4aad8 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:37:33 -0700 Subject: [PATCH 08/17] Remove assert_eq from test_pip.py --- python/cuspatial/cuspatial/tests/test_pip.py | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_pip.py b/python/cuspatial/cuspatial/tests/test_pip.py index 44739208f..d787c685a 100644 --- a/python/cuspatial/cuspatial/tests/test_pip.py +++ b/python/cuspatial/cuspatial/tests/test_pip.py @@ -4,7 +4,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial from cuspatial.utils import gis_utils @@ -45,7 +44,7 @@ def test_missing_2(): ) expected = cudf.DataFrame() - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_missing_3(): @@ -106,7 +105,7 @@ def test_one_point_in(): cudf.Series([-1, 1, -1, -1]), ) expected = cudf.DataFrame({0: True}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_out(): @@ -119,7 +118,7 @@ def test_one_point_out(): cudf.Series([-1, 1, -1, -1]), ) expected = cudf.DataFrame({0: False}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_in_two_rings(): @@ -132,7 +131,7 @@ def test_one_point_in_two_rings(): cudf.Series([-1, 1, -1, -1, 3, 5, 3, 3]), ) expected = cudf.DataFrame({0: True}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_in_two_rings_no_repeat(): @@ -145,7 +144,7 @@ def test_one_point_in_two_rings_no_repeat(): cudf.Series([-1, 1, -1, 3, 5, 3]), ) expected = cudf.DataFrame({0: True}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_out_two_rings(): @@ -158,7 +157,7 @@ def test_one_point_out_two_rings(): cudf.Series([-1, 1, -1, -1, 3, 5, 3, 3]), ) expected = cudf.DataFrame({0: False}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_out_two_rings_no_repeat(): @@ -171,7 +170,7 @@ def test_one_point_out_two_rings_no_repeat(): cudf.Series([-1, 1, -1, 3, 5, 3]), ) expected = cudf.DataFrame({0: False}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_in_one_out_two_rings(): @@ -184,7 +183,7 @@ def test_one_point_in_one_out_two_rings(): cudf.Series([-1, 1, -1, -1, 3, 5, 3, 3]), ) expected = cudf.DataFrame({0: [True, False]}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_one_point_out_one_in_two_rings(): @@ -197,7 +196,7 @@ def test_one_point_out_one_in_two_rings(): cudf.Series([-1, 1, -1, -1, 3, 5, 3, 3]), ) expected = cudf.DataFrame({0: [False, True]}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_two_points_out_two_rings(): @@ -210,7 +209,7 @@ def test_two_points_out_two_rings(): cudf.Series([-1, 1, -1, -1, 3, 5, 3, 3]), ) expected = cudf.DataFrame({0: [False, False]}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_two_points_in_two_rings(): @@ -223,7 +222,7 @@ def test_two_points_in_two_rings(): cudf.Series([-1, 1, -1, -1, 3, 5, 3, 3]), ) expected = cudf.DataFrame({0: [True, True]}) - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_three_points_two_features(): @@ -238,7 +237,7 @@ def test_three_points_two_features(): expected = cudf.DataFrame() expected[0] = [True, True, False] expected[1] = [True, False, True] - assert_eq(expected, result) + cudf.testing.assert_frame_equal(expected, result) def test_pip_bitmap_column_to_binary_array(): From 33066b4080087e01d1d4da02b358964f0caed68f Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:38:44 -0700 Subject: [PATCH 09/17] Remove assert_eq from test_points_in_spatial_window.py. --- .../tests/test_points_in_spatial_window.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_points_in_spatial_window.py b/python/cuspatial/cuspatial/tests/test_points_in_spatial_window.py index 92e68d27c..becbcbd65 100644 --- a/python/cuspatial/cuspatial/tests/test_points_in_spatial_window.py +++ b/python/cuspatial/cuspatial/tests/test_points_in_spatial_window.py @@ -3,7 +3,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -19,7 +18,9 @@ def test_centered(): result = cuspatial.points_in_spatial_window( -1, 1, -1, 1, cudf.Series([0.0]), cudf.Series([0.0]) ) - assert_eq(result, cudf.DataFrame({"x": [0.0], "y": [0.0]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [0.0], "y": [0.0]}) + ) @pytest.mark.parametrize( @@ -30,21 +31,25 @@ def test_corners(coords): result = cuspatial.points_in_spatial_window( -1.1, 1.1, -1.1, 1.1, cudf.Series([x]), cudf.Series([y]) ) - assert_eq(result, cudf.DataFrame({"x": [x], "y": [y]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [x], "y": [y]}) + ) def test_pair(): result = cuspatial.points_in_spatial_window( -1.1, 1.1, -1.1, 1.1, cudf.Series([0.0, 1.0]), cudf.Series([1.0, 0.0]) ) - assert_eq(result, cudf.DataFrame({"x": [0.0, 1.0], "y": [1.0, 0.0]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [0.0, 1.0], "y": [1.0, 0.0]}) + ) def test_oob(): result = cuspatial.points_in_spatial_window( -1, 1, -1, 1, cudf.Series([-2.0, 2.0]), cudf.Series([2.0, -2.0]) ) - assert_eq(result, cudf.DataFrame({"x": [], "y": []})) + cudf.testing.assert_frame_equal(result, cudf.DataFrame({"x": [], "y": []})) def test_half(): @@ -57,4 +62,6 @@ def test_half(): cudf.Series([1.0, -1.0, 3.0, -3.0]), ) print(result) - assert_eq(result, cudf.DataFrame({"x": [-1.0, 1.0], "y": [1.0, -1.0]})) + cudf.testing.assert_frame_equal( + result, cudf.DataFrame({"x": [-1.0, 1.0], "y": [1.0, -1.0]}) + ) From d8634cecd668997d5a1b4c7cc29f562d83443d5d Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:39:28 -0700 Subject: [PATCH 10/17] Remove assert_eq from test_polygon_bounding_boxes.py. --- .../cuspatial/tests/test_polygon_bounding_boxes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_polygon_bounding_boxes.py b/python/cuspatial/cuspatial/tests/test_polygon_bounding_boxes.py index 9e1f2b517..385317219 100644 --- a/python/cuspatial/cuspatial/tests/test_polygon_bounding_boxes.py +++ b/python/cuspatial/cuspatial/tests/test_polygon_bounding_boxes.py @@ -4,7 +4,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -17,7 +16,7 @@ def test_polygon_bounding_boxes_empty(dtype): cudf.Series([], dtype=dtype), cudf.Series([], dtype=dtype), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -38,7 +37,7 @@ def test_polygon_bounding_boxes_one(dtype): cudf.Series([2.488450, 1.333584, 3.460720], dtype=dtype), cudf.Series([5.856625, 5.008840, 4.586599], dtype=dtype), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -109,7 +108,7 @@ def test_polygon_bounding_boxes_small(dtype): dtype=dtype, ), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { From 5ad7bfefa674b5441611acf5cfa296ec22cdb1c4 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:40:34 -0700 Subject: [PATCH 11/17] Remove assert_eq from test_shapefile_reader.py. --- .../cuspatial/tests/test_shapefile_reader.py | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_shapefile_reader.py b/python/cuspatial/cuspatial/tests/test_shapefile_reader.py index a290bf415..bc6bb3d00 100644 --- a/python/cuspatial/cuspatial/tests/test_shapefile_reader.py +++ b/python/cuspatial/cuspatial/tests/test_shapefile_reader.py @@ -6,7 +6,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -26,9 +25,13 @@ def test_zero_polygons(): f_pos, r_pos, points = cuspatial.read_polygon_shapefile( os.path.join(shapefiles_path, "empty_poly.shp") ) - assert_eq(f_pos, cudf.Series(dtype=np.int32, name="f_pos")) - assert_eq(r_pos, cudf.Series(dtype=np.int32, name="r_pos")) - assert_eq( + cudf.testing.assert_series_equal( + f_pos, cudf.Series(dtype=np.int32, name="f_pos") + ) + cudf.testing.assert_series_equal( + r_pos, cudf.Series(dtype=np.int32, name="r_pos") + ) + cudf.testing.assert_frame_equal( points, cudf.DataFrame( { @@ -43,9 +46,13 @@ def test_one_polygon(): f_pos, r_pos, points = cuspatial.read_polygon_shapefile( os.path.join(shapefiles_path, "one_poly.shp") ) - assert_eq(f_pos, cudf.Series([0], dtype=np.int32, name="f_pos")) - assert_eq(r_pos, cudf.Series([0], dtype=np.int32, name="r_pos")) - assert_eq( + cudf.testing.assert_series_equal( + f_pos, cudf.Series([0], dtype=np.int32, name="f_pos") + ) + cudf.testing.assert_series_equal( + r_pos, cudf.Series([0], dtype=np.int32, name="r_pos") + ) + cudf.testing.assert_frame_equal( points, cudf.DataFrame( { @@ -60,9 +67,13 @@ def test_two_polygons(): f_pos, r_pos, points = cuspatial.read_polygon_shapefile( os.path.join(shapefiles_path, "two_polys.shp") ) - assert_eq(f_pos, cudf.Series([0, 1], dtype=np.int32, name="f_pos")) - assert_eq(r_pos, cudf.Series([0, 5], dtype=np.int32, name="r_pos")) - assert_eq( + cudf.testing.assert_series_equal( + f_pos, cudf.Series([0, 1], dtype=np.int32, name="f_pos") + ) + cudf.testing.assert_series_equal( + r_pos, cudf.Series([0, 5], dtype=np.int32, name="r_pos") + ) + cudf.testing.assert_frame_equal( points, cudf.DataFrame( { From b4b15f11c286add0ad6fa50f5586b25b8e427b6d Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:41:20 -0700 Subject: [PATCH 12/17] Remove assert_eq from test_spatial_join.py. --- .../cuspatial/tests/test_spatial_join.py | 73 +++++++++++++++---- 1 file changed, 58 insertions(+), 15 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_spatial_join.py b/python/cuspatial/cuspatial/tests/test_spatial_join.py index 69aaf6759..976a55273 100644 --- a/python/cuspatial/cuspatial/tests/test_spatial_join.py +++ b/python/cuspatial/cuspatial/tests/test_spatial_join.py @@ -4,7 +4,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -227,9 +226,13 @@ def test_empty(dtype): ) # empty should not throw intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, poly_bboxes, *bbox_1, 1, 1, # bbox # scale # max_depth + quadtree, + poly_bboxes, + *bbox_1, + 1, + 1, # bbox # scale # max_depth ) - assert_eq( + cudf.testing.assert_frame_equal( intersections, cudf.DataFrame( { @@ -265,12 +268,22 @@ def test_polygon_join_small(dtype): min_size, ) poly_bboxes = cuspatial.polygon_bounding_boxes( - small_poly_offsets, small_ring_offsets, poly_points_x, poly_points_y, + small_poly_offsets, + small_ring_offsets, + poly_points_x, + poly_points_y, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, + quadtree, + poly_bboxes, + x_min, + x_max, + y_min, + y_max, + scale, + max_depth, ) - assert_eq( + cudf.testing.assert_frame_equal( intersections, cudf.DataFrame( { @@ -311,12 +324,22 @@ def test_polyline_join_small(dtype): min_size, ) poly_bboxes = cuspatial.polyline_bounding_boxes( - small_ring_offsets, poly_points_x, poly_points_y, expansion_radius, + small_ring_offsets, + poly_points_x, + poly_points_y, + expansion_radius, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, + quadtree, + poly_bboxes, + x_min, + x_max, + y_min, + y_max, + scale, + max_depth, ) - assert_eq( + cudf.testing.assert_frame_equal( intersections, cudf.DataFrame( { @@ -402,10 +425,20 @@ def test_quadtree_point_in_polygon_small(dtype): min_size, ) poly_bboxes = cuspatial.polygon_bounding_boxes( - small_poly_offsets, small_ring_offsets, poly_points_x, poly_points_y, + small_poly_offsets, + small_ring_offsets, + poly_points_x, + poly_points_y, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, + quadtree, + poly_bboxes, + x_min, + x_max, + y_min, + y_max, + scale, + max_depth, ) polygons_and_points = cuspatial.quadtree_point_in_polygon( intersections, @@ -418,7 +451,7 @@ def test_quadtree_point_in_polygon_small(dtype): poly_points_x, poly_points_y, ) - assert_eq( + cudf.testing.assert_frame_equal( polygons_and_points, cudf.DataFrame( { @@ -482,10 +515,20 @@ def run_test_quadtree_point_to_nearest_polyline_small( min_size, ) poly_bboxes = cuspatial.polyline_bounding_boxes( - small_ring_offsets, poly_points_x, poly_points_y, expansion_radius, + small_ring_offsets, + poly_points_x, + poly_points_y, + expansion_radius, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, + quadtree, + poly_bboxes, + x_min, + x_max, + y_min, + y_max, + scale, + max_depth, ) p2np_result = cuspatial.quadtree_point_to_nearest_polyline( intersections, @@ -497,7 +540,7 @@ def run_test_quadtree_point_to_nearest_polyline_small( poly_points_x, poly_points_y, ) - assert_eq( + cudf.testing.assert_frame_equal( p2np_result, cudf.DataFrame( { From e5f5c374da5116c561263e58e041f888917b4014 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:42:40 -0700 Subject: [PATCH 13/17] Remove assert_eq from test_spline_fit.py. --- .../cuspatial/tests/test_spline_fit.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_spline_fit.py b/python/cuspatial/cuspatial/tests/test_spline_fit.py index 92a646640..e52781ec8 100644 --- a/python/cuspatial/cuspatial/tests/test_spline_fit.py +++ b/python/cuspatial/cuspatial/tests/test_spline_fit.py @@ -5,7 +5,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -41,7 +40,7 @@ def test_class_coefs(): t = cudf.Series([0, 1, 2, 3, 4]).astype("float32") x = cudf.Series([3, 2, 3, 4, 3]).astype("float32") g = cuspatial.interpolate.CubicSpline(t, x) - assert_eq( + cudf.testing.assert_frame_equal( g.c, cudf.DataFrame( { @@ -61,7 +60,7 @@ def test_min(): cudf.Series([3, 2, 3, 4, 3]).astype("float32"), cudf.Series([0, 5]).astype("int32"), ) - assert_eq( + cudf.testing.assert_frame_equal( result.c, cudf.DataFrame( { @@ -85,7 +84,7 @@ def test_cusparse(): ), prefixes=cudf.Series([0, 5, 10, 15]).astype("int32"), ) - assert_eq( + cudf.testing.assert_frame_equal( result.c, cudf.DataFrame( { @@ -129,14 +128,14 @@ def test_class_interpolation_length_five(): t = cudf.Series([0, 1, 2, 3, 4]).astype("float32") x = cudf.Series([3, 2, 3, 4, 3]).astype("float32") g = cuspatial.interpolate.CubicSpline(t, x) - assert_eq(g(t), x) + cudf.testing.assert_series_equal(g(t), x) def test_class_interpolation_length_six(): t = cudf.Series([0, 1, 2, 3, 4, 5]).astype("float32") x = cudf.Series([3, 2, 3, 4, 3, 4]).astype("float32") g = cuspatial.interpolate.CubicSpline(t, x) - assert_eq(g(t), x) + cudf.testing.assert_series_equal(g(t), x) def test_class_interpolation_length_six_splits(): @@ -144,7 +143,9 @@ def test_class_interpolation_length_six_splits(): x = cudf.Series([3, 2, 3, 4, 3, 4]).astype("float32") g = cuspatial.interpolate.CubicSpline(t, x) split_t = cudf.Series(np.linspace(0, 5, 11), dtype="float32") - assert_eq(g(split_t)[t * 2].reset_index(drop=True), x) + cudf.testing.assert_series_equal( + g(split_t)[t * 2].reset_index(drop=True), x + ) def test_class_triple(): @@ -159,7 +160,7 @@ def test_class_triple(): groups = cudf.Series( np.ravel(np.array([np.repeat(0, 5), np.repeat(1, 5), np.repeat(2, 5)])) ) - assert_eq(g(t, groups=groups), x) + cudf.testing.assert_series_equal(g(t, groups=groups), x) def test_class_triple_six(): @@ -174,7 +175,7 @@ def test_class_triple_six(): groups = cudf.Series( np.ravel(np.array([np.repeat(0, 6), np.repeat(1, 6), np.repeat(2, 6)])) ) - assert_eq(g(t, groups=groups), x) + cudf.testing.assert_series_equal(g(t, groups=groups), x) def test_class_triple_six_splits(): @@ -221,7 +222,9 @@ def test_class_triple_six_splits(): 30, 32, ] - assert_eq(g(split_t, groups=groups)[split_t_ind].reset_index(drop=True), x) + cudf.testing.assert_series_equal( + g(split_t, groups=groups)[split_t_ind].reset_index(drop=True), x + ) def test_class_new_interpolation(): @@ -244,4 +247,4 @@ def test_class_new_interpolation(): new_points_at_control_points.index = cudf.RangeIndex( 0, len(new_points_at_control_points) ) - assert_eq(new_points_at_control_points, old_points) + cudf.testing.assert_series_equal(new_points_at_control_points, old_points) From 9869553043c0a15120b8082f649464ecd11d7152 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:45:01 -0700 Subject: [PATCH 14/17] Remove assert_eq from test_trajectory.py. --- .../cuspatial/tests/test_trajectory.py | 103 ++++++++++++------ 1 file changed, 68 insertions(+), 35 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_trajectory.py b/python/cuspatial/cuspatial/tests/test_trajectory.py index f3be51ebe..022d413bc 100644 --- a/python/cuspatial/cuspatial/tests/test_trajectory.py +++ b/python/cuspatial/cuspatial/tests/test_trajectory.py @@ -3,9 +3,6 @@ import numpy as np import pytest -import cudf -from cudf.testing._utils import assert_eq - import cuspatial @@ -16,7 +13,7 @@ def test_trajectory_bounding_boxes_empty_float32(): cudf.Series([], dtype=np.float32), cudf.Series([], dtype=np.float32), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -36,7 +33,7 @@ def test_trajectory_bounding_boxes_empty_float64(): cudf.Series([], dtype=np.float64), cudf.Series([], dtype=np.float64), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -53,7 +50,7 @@ def test_trajectory_bounding_boxes_zeros(): result = cuspatial.trajectory_bounding_boxes( 1, cudf.Series([0]), cudf.Series([0]), cudf.Series([0]) ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( {"x_min": [0.0], "y_min": [0.0], "x_max": [0.0], "y_max": [0.0]} @@ -65,7 +62,7 @@ def test_trajectory_bounding_boxes_ones(): result = cuspatial.trajectory_bounding_boxes( 1, cudf.Series([1]), cudf.Series([1]), cudf.Series([1]) ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( {"x_min": [1.0], "y_min": [1.0], "x_max": [1.0], "y_max": [1.0]} @@ -75,9 +72,12 @@ def test_trajectory_bounding_boxes_ones(): def test_trajectory_bounding_boxes_zero_to_one(): result = cuspatial.trajectory_bounding_boxes( - 1, cudf.Series([0, 0]), cudf.Series([0, 0]), cudf.Series([0, 1]), + 1, + cudf.Series([0, 0]), + cudf.Series([0, 0]), + cudf.Series([0, 1]), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( {"x_min": [0.0], "y_min": [0.0], "x_max": [0.0], "y_max": [1.0]} @@ -87,9 +87,12 @@ def test_trajectory_bounding_boxes_zero_to_one(): def test_trajectory_bounding_boxes_zero_to_one_xy(): result = cuspatial.trajectory_bounding_boxes( - 1, cudf.Series([0, 0]), cudf.Series([0, 1]), cudf.Series([0, 1]), + 1, + cudf.Series([0, 0]), + cudf.Series([0, 1]), + cudf.Series([0, 1]), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( {"x_min": [0.0], "y_min": [0.0], "x_max": [1.0], "y_max": [1.0]} @@ -104,7 +107,7 @@ def test_trajectory_bounding_boxes_subsetted(): cudf.Series([0, 1, -1, 2]), cudf.Series([0, 1, -1, 2]), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -124,7 +127,7 @@ def test_trajectory_bounding_boxes_intersected(): cudf.Series([0, 2, 1, 3]), cudf.Series([0, 2, 1, 3]), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -144,7 +147,7 @@ def test_trajectory_bounding_boxes_two_and_three(): cudf.Series([0, 2, 1, 3, 2]), cudf.Series([0, 2, 1, 3, 2]), ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -164,8 +167,10 @@ def test_derive_trajectories_zeros(): cudf.Series([0]), # y cudf.Series([0]), # timestamp ) - assert_eq(traj_offsets, cudf.Series([0], dtype="int32")) - assert_eq( + cudf.testing.assert_series_equal( + traj_offsets, cudf.Series([0], dtype="int32") + ) + cudf.testing.assert_frame_equal( objects, cudf.DataFrame( { @@ -185,8 +190,10 @@ def test_derive_trajectories_ones(): cudf.Series([1]), # y cudf.Series([1]), # timestamp ) - assert_eq(traj_offsets, cudf.Series([0], dtype="int32")) - assert_eq( + cudf.testing.assert_series_equal( + traj_offsets, cudf.Series([0], dtype="int32") + ) + cudf.testing.assert_frame_equal( objects, cudf.DataFrame( { @@ -206,8 +213,10 @@ def test_derive_trajectories_two(): cudf.Series([0, 1]), # y cudf.Series([0, 1]), # timestamp ) - assert_eq(traj_offsets, cudf.Series([0, 1], dtype="int32")) - assert_eq( + cudf.testing.assert_series_equal( + traj_offsets, cudf.Series([0, 1], dtype="int32") + ) + cudf.testing.assert_frame_equal( objects, cudf.DataFrame( { @@ -231,9 +240,11 @@ def test_derive_trajectories_many(): ) sorted_idxs = cudf.DataFrame({"id": object_id, "ts": timestamp}).argsort() - assert_eq(traj_offsets, cudf.Series([0, 1, 2, 5, 6, 8, 9], dtype="int32")) + cudf.testing.assert_series_equal( + traj_offsets, cudf.Series([0, 1, 2, 5, 6, 8, 9], dtype="int32") + ) print(objects) - assert_eq( + cudf.testing.assert_frame_equal( objects, cudf.DataFrame( { @@ -255,7 +266,10 @@ def test_derive_trajectories_many(): def test_trajectory_distances_and_speeds_zeros(): objects, traj_offsets = cuspatial.derive_trajectories( - [0], [0], [0], [0], # object_id # xs # ys # timestamp + [0], + [0], + [0], + [0], # object_id # xs # ys # timestamp ) result = cuspatial.trajectory_distances_and_speeds( len(traj_offsets), @@ -264,13 +278,20 @@ def test_trajectory_distances_and_speeds_zeros(): objects["y"], objects["timestamp"], ) - assert_eq(result["distance"], cudf.Series([0.0]), check_names=False) - assert_eq(result["speed"], cudf.Series([0.0]), check_names=False) + cudf.testing.assert_series_equal( + result["distance"], cudf.Series([0.0]), check_names=False + ) + cudf.testing.assert_series_equal( + result["speed"], cudf.Series([0.0]), check_names=False + ) def test_trajectory_distances_and_speeds_ones(): objects, traj_offsets = cuspatial.derive_trajectories( - [1], [1], [1], [1], # object_id # xs # ys # timestamp + [1], + [1], + [1], + [1], # object_id # xs # ys # timestamp ) result = cuspatial.trajectory_distances_and_speeds( len(traj_offsets), @@ -279,8 +300,12 @@ def test_trajectory_distances_and_speeds_ones(): objects["y"], objects["timestamp"], ) - assert_eq(result["distance"], cudf.Series([0.0]), check_names=False) - assert_eq(result["speed"], cudf.Series([0.0]), check_names=False) + cudf.testing.assert_series_equal( + result["distance"], cudf.Series([0.0]), check_names=False + ) + cudf.testing.assert_series_equal( + result["speed"], cudf.Series([0.0]), check_names=False + ) def test_derive_one_trajectory_one_meter_one_second(): @@ -297,8 +322,12 @@ def test_derive_one_trajectory_one_meter_one_second(): objects["y"], objects["timestamp"], ) - assert_eq(result["distance"], cudf.Series([1.0]), check_names=False) - assert_eq(result["speed"], cudf.Series([1.0]), check_names=False) + cudf.testing.assert_series_equal( + result["distance"], cudf.Series([1.0]), check_names=False + ) + cudf.testing.assert_series_equal( + result["speed"], cudf.Series([1.0]), check_names=False + ) def test_derive_two_trajectories_one_meter_one_second(): @@ -315,8 +344,12 @@ def test_derive_two_trajectories_one_meter_one_second(): objects["y"], objects["timestamp"], ) - assert_eq(result["distance"], cudf.Series([1.0, 1.0]), check_names=False) - assert_eq(result["speed"], cudf.Series([1.0, 1.0]), check_names=False) + cudf.testing.assert_series_equal( + result["distance"], cudf.Series([1.0, 1.0]), check_names=False + ) + cudf.testing.assert_series_equal( + result["speed"], cudf.Series([1.0, 1.0]), check_names=False + ) def test_trajectory_distances_and_speeds_single_trajectory(): @@ -333,12 +366,12 @@ def test_trajectory_distances_and_speeds_single_trajectory(): objects["y"], objects["timestamp"], ) - assert_eq( + cudf.testing.assert_series_equal( result["distance"], cudf.Series([7892.922363, 6812.55908203125, 8485.28125]), check_names=False, ) - assert_eq( + cudf.testing.assert_series_equal( result["speed"], cudf.Series([1973230.625, 2270853.0, 4242640.5]), check_names=False, @@ -384,7 +417,7 @@ def test_trajectory_distances_and_speeds_timestamp_types(timestamp_type): objects["y"], objects["timestamp"], ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame({"distance": [1.0, 1.0], "speed": [1.0, 1.0]}), check_names=False, From efc221783386fceefbfa9f0baf5661b2e5e82214 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 1 Jul 2021 17:46:36 -0700 Subject: [PATCH 15/17] Fix outstanding assert_eq. --- .../cuspatial/tests/test_polyline_bounding_boxes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_polyline_bounding_boxes.py b/python/cuspatial/cuspatial/tests/test_polyline_bounding_boxes.py index 55f89bd6d..045d9d5ae 100644 --- a/python/cuspatial/cuspatial/tests/test_polyline_bounding_boxes.py +++ b/python/cuspatial/cuspatial/tests/test_polyline_bounding_boxes.py @@ -4,7 +4,6 @@ import pytest import cudf -from cudf.testing._utils import assert_eq import cuspatial @@ -17,7 +16,7 @@ def test_polyline_bounding_boxes_empty(dtype): cudf.Series([], dtype=dtype), 0, # expansion_radius ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -38,7 +37,7 @@ def test_polyline_bounding_boxes_one(dtype): cudf.Series([5.856625, 5.008840, 4.586599], dtype=dtype), 0, # expansion_radius ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { @@ -109,7 +108,7 @@ def test_polyline_bounding_boxes_small(dtype): ), 0.5, # expansion_radius ) - assert_eq( + cudf.testing.assert_frame_equal( result, cudf.DataFrame( { From 024f81909109b3f60d877af2f98f95bb28ecc30e Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 20 Jul 2021 19:10:27 -0700 Subject: [PATCH 16/17] Fix missing import introduced in rebase. --- .../cuspatial/tests/test_trajectory.py | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_trajectory.py b/python/cuspatial/cuspatial/tests/test_trajectory.py index 022d413bc..9bec09661 100644 --- a/python/cuspatial/cuspatial/tests/test_trajectory.py +++ b/python/cuspatial/cuspatial/tests/test_trajectory.py @@ -3,6 +3,8 @@ import numpy as np import pytest +import cudf + import cuspatial @@ -72,10 +74,7 @@ def test_trajectory_bounding_boxes_ones(): def test_trajectory_bounding_boxes_zero_to_one(): result = cuspatial.trajectory_bounding_boxes( - 1, - cudf.Series([0, 0]), - cudf.Series([0, 0]), - cudf.Series([0, 1]), + 1, cudf.Series([0, 0]), cudf.Series([0, 0]), cudf.Series([0, 1]), ) cudf.testing.assert_frame_equal( result, @@ -87,10 +86,7 @@ def test_trajectory_bounding_boxes_zero_to_one(): def test_trajectory_bounding_boxes_zero_to_one_xy(): result = cuspatial.trajectory_bounding_boxes( - 1, - cudf.Series([0, 0]), - cudf.Series([0, 1]), - cudf.Series([0, 1]), + 1, cudf.Series([0, 0]), cudf.Series([0, 1]), cudf.Series([0, 1]), ) cudf.testing.assert_frame_equal( result, @@ -266,10 +262,7 @@ def test_derive_trajectories_many(): def test_trajectory_distances_and_speeds_zeros(): objects, traj_offsets = cuspatial.derive_trajectories( - [0], - [0], - [0], - [0], # object_id # xs # ys # timestamp + [0], [0], [0], [0], # object_id # xs # ys # timestamp ) result = cuspatial.trajectory_distances_and_speeds( len(traj_offsets), @@ -288,10 +281,7 @@ def test_trajectory_distances_and_speeds_zeros(): def test_trajectory_distances_and_speeds_ones(): objects, traj_offsets = cuspatial.derive_trajectories( - [1], - [1], - [1], - [1], # object_id # xs # ys # timestamp + [1], [1], [1], [1], # object_id # xs # ys # timestamp ) result = cuspatial.trajectory_distances_and_speeds( len(traj_offsets), From 7ce19d19afb42fe648e0ab6708bee055145c8968 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 20 Jul 2021 19:12:15 -0700 Subject: [PATCH 17/17] Fix style. --- .../cuspatial/tests/test_from_geopandas.py | 14 +---- .../cuspatial/tests/test_geodataframe.py | 10 +-- .../cuspatial/tests/test_geoseries.py | 10 +-- .../tests/test_hausdorff_distance.py | 8 +-- .../cuspatial/tests/test_spatial_join.py | 62 +++---------------- 5 files changed, 18 insertions(+), 86 deletions(-) diff --git a/python/cuspatial/cuspatial/tests/test_from_geopandas.py b/python/cuspatial/cuspatial/tests/test_from_geopandas.py index 352cad9d2..1ec2241a7 100644 --- a/python/cuspatial/cuspatial/tests/test_from_geopandas.py +++ b/python/cuspatial/cuspatial/tests/test_from_geopandas.py @@ -72,17 +72,11 @@ def test_from_geopandas_linestring(): def test_from_geopandas_multilinestring(): gs = gpd.GeoSeries( - MultiLineString( - ( - ((1.0, 2.0), (3.0, 4.0)), - ((5.0, 6.0), (7.0, 8.0)), - ) - ) + MultiLineString((((1.0, 2.0), (3.0, 4.0)), ((5.0, 6.0), (7.0, 8.0)),)) ) cugs = cuspatial.from_geopandas(gs) cudf.testing.assert_series_equal( - cugs.lines.xy, - cudf.Series([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), + cugs.lines.xy, cudf.Series([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), ) cudf.testing.assert_series_equal( cugs.lines.offsets, cudf.Series([0, 4, 8]) @@ -91,9 +85,7 @@ def test_from_geopandas_multilinestring(): def test_from_geopandas_polygon(): gs = gpd.GeoSeries( - Polygon( - ((0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.0)), - ) + Polygon(((0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.0)),) ) cugs = cuspatial.from_geopandas(gs) cudf.testing.assert_series_equal( diff --git a/python/cuspatial/cuspatial/tests/test_geodataframe.py b/python/cuspatial/cuspatial/tests/test_geodataframe.py index c53336a19..2a2b0cf5c 100644 --- a/python/cuspatial/cuspatial/tests/test_geodataframe.py +++ b/python/cuspatial/cuspatial/tests/test_geodataframe.py @@ -154,17 +154,11 @@ def test_interleaved_point(gpdf, polys): ) cudf.testing.assert_series_equal( cugs.lines.x, - cudf.Series( - np.array([range(11, 34, 2)]).flatten(), - dtype="float64", - ), + cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), ) cudf.testing.assert_series_equal( cugs.lines.y, - cudf.Series( - np.array([range(12, 35, 2)]).flatten(), - dtype="float64", - ), + cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), ) cudf.testing.assert_series_equal( cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64") diff --git a/python/cuspatial/cuspatial/tests/test_geoseries.py b/python/cuspatial/cuspatial/tests/test_geoseries.py index 8b7c5900d..e0721c033 100644 --- a/python/cuspatial/cuspatial/tests/test_geoseries.py +++ b/python/cuspatial/cuspatial/tests/test_geoseries.py @@ -139,17 +139,11 @@ def test_interleaved_point(gs, polys): ) cudf.testing.assert_series_equal( cugs.lines.x, - cudf.Series( - np.array([range(11, 34, 2)]).flatten(), - dtype="float64", - ), + cudf.Series(np.array([range(11, 34, 2)]).flatten(), dtype="float64",), ) cudf.testing.assert_series_equal( cugs.lines.y, - cudf.Series( - np.array([range(12, 35, 2)]).flatten(), - dtype="float64", - ), + cudf.Series(np.array([range(12, 35, 2)]).flatten(), dtype="float64",), ) cudf.testing.assert_series_equal( cugs.polygons.x, cudf.Series(polys[:, 0], dtype="float64") diff --git a/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py b/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py index 0d6815181..c32a10b6f 100644 --- a/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py +++ b/python/cuspatial/cuspatial/tests/test_hausdorff_distance.py @@ -36,18 +36,14 @@ def test_zeros(): def test_empty_x(): with pytest.raises(RuntimeError): cuspatial.directed_hausdorff_distance( - [], - [0.0], - [0], + [], [0.0], [0], ) def test_empty_y(): with pytest.raises(RuntimeError): cuspatial.directed_hausdorff_distance( - [0.0], - [], - [0], + [0.0], [], [0], ) diff --git a/python/cuspatial/cuspatial/tests/test_spatial_join.py b/python/cuspatial/cuspatial/tests/test_spatial_join.py index 976a55273..e8fe9603f 100644 --- a/python/cuspatial/cuspatial/tests/test_spatial_join.py +++ b/python/cuspatial/cuspatial/tests/test_spatial_join.py @@ -226,11 +226,7 @@ def test_empty(dtype): ) # empty should not throw intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, - poly_bboxes, - *bbox_1, - 1, - 1, # bbox # scale # max_depth + quadtree, poly_bboxes, *bbox_1, 1, 1, # bbox # scale # max_depth ) cudf.testing.assert_frame_equal( intersections, @@ -268,20 +264,10 @@ def test_polygon_join_small(dtype): min_size, ) poly_bboxes = cuspatial.polygon_bounding_boxes( - small_poly_offsets, - small_ring_offsets, - poly_points_x, - poly_points_y, + small_poly_offsets, small_ring_offsets, poly_points_x, poly_points_y, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, - poly_bboxes, - x_min, - x_max, - y_min, - y_max, - scale, - max_depth, + quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, ) cudf.testing.assert_frame_equal( intersections, @@ -324,20 +310,10 @@ def test_polyline_join_small(dtype): min_size, ) poly_bboxes = cuspatial.polyline_bounding_boxes( - small_ring_offsets, - poly_points_x, - poly_points_y, - expansion_radius, + small_ring_offsets, poly_points_x, poly_points_y, expansion_radius, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, - poly_bboxes, - x_min, - x_max, - y_min, - y_max, - scale, - max_depth, + quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, ) cudf.testing.assert_frame_equal( intersections, @@ -425,20 +401,10 @@ def test_quadtree_point_in_polygon_small(dtype): min_size, ) poly_bboxes = cuspatial.polygon_bounding_boxes( - small_poly_offsets, - small_ring_offsets, - poly_points_x, - poly_points_y, + small_poly_offsets, small_ring_offsets, poly_points_x, poly_points_y, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, - poly_bboxes, - x_min, - x_max, - y_min, - y_max, - scale, - max_depth, + quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, ) polygons_and_points = cuspatial.quadtree_point_in_polygon( intersections, @@ -515,20 +481,10 @@ def run_test_quadtree_point_to_nearest_polyline_small( min_size, ) poly_bboxes = cuspatial.polyline_bounding_boxes( - small_ring_offsets, - poly_points_x, - poly_points_y, - expansion_radius, + small_ring_offsets, poly_points_x, poly_points_y, expansion_radius, ) intersections = cuspatial.join_quadtree_and_bounding_boxes( - quadtree, - poly_bboxes, - x_min, - x_max, - y_min, - y_max, - scale, - max_depth, + quadtree, poly_bboxes, x_min, x_max, y_min, y_max, scale, max_depth, ) p2np_result = cuspatial.quadtree_point_to_nearest_polyline( intersections,