Skip to content

Commit 1b5dc5c

Browse files
authored
cleanup: silence non-relevant system test warnings (#1068)
1 parent 3a681e0 commit 1b5dc5c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/system/test_pandas.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import json
2121
import io
2222
import operator
23+
import warnings
2324

2425
import google.api_core.retry
2526
import pkg_resources
@@ -976,9 +977,17 @@ def test_to_geodataframe(bigquery_client, dataset_id):
976977
assert df["geog"][2] == wkt.loads("point(0 0)")
977978
assert isinstance(df, geopandas.GeoDataFrame)
978979
assert isinstance(df["geog"], geopandas.GeoSeries)
979-
assert df.area[0] == 0.5
980-
assert pandas.isna(df.area[1])
981-
assert df.area[2] == 0.0
980+
981+
with warnings.catch_warnings():
982+
# Computing the area on a GeoDataFrame that uses a geographic Coordinate
983+
# Reference System (CRS) produces a warning that we are not interested in.
984+
# We do not mind if the computed area is incorrect with respect to the
985+
# GeoDataFrame data, as long as it matches the expected "incorrect" value.
986+
warnings.filterwarnings("ignore", category=UserWarning)
987+
assert df.area[0] == 0.5
988+
assert pandas.isna(df.area[1])
989+
assert df.area[2] == 0.0
990+
982991
assert df.crs.srs == "EPSG:4326"
983992
assert df.crs.name == "WGS 84"
984993
assert df.geog.crs.srs == "EPSG:4326"

0 commit comments

Comments
 (0)