Skip to content

Commit d280035

Browse files
authored
Merge pull request #313 from GispoCoding/311-update-code-to-silence-deprecationfuture-warnings
Update code to silence some deprecation/future warnings
2 parents 73ef340 + 040f44d commit d280035

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tests/transformations/one_hot_encode_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_encode_dataframe_sparse_all_columns(sample_dataframe):
2222
"""Test that encoding DataFrame with sparse output works as expected."""
2323
encoded_df = one_hot_encode(sample_dataframe)
2424
assert all(item in encoded_df.columns for item in ["A_cat", "A_dog", "A_fish", "B_apple", "B_banana", "B_orange"])
25-
assert encoded_df.dtypes.apply(pd.api.types.is_sparse).all()
25+
assert encoded_df.dtypes.apply(lambda x: isinstance(x, pd.SparseDtype)).all()
2626

2727

2828
def test_encode_dataframe_sparse_selected_columns(sample_dataframe):
@@ -31,14 +31,14 @@ def test_encode_dataframe_sparse_selected_columns(sample_dataframe):
3131
encoded_df_without_column_C = encoded_df.drop(["C"], axis=1)
3232
assert "C" in encoded_df.columns
3333
assert "A_fish" in encoded_df.columns
34-
assert encoded_df_without_column_C.dtypes.apply(pd.api.types.is_sparse).all()
34+
assert encoded_df_without_column_C.dtypes.apply(lambda x: isinstance(x, pd.SparseDtype)).all()
3535
assert encoded_df["C"].dtype in (int, np.dtype("int64"))
3636

3737

3838
def test_encode_dataframe_dense(sample_dataframe):
3939
"""Test that encoding DataFrame with dense output works as expected."""
4040
encoded_df = one_hot_encode(sample_dataframe, sparse_output=False)
41-
assert not encoded_df.dtypes.apply(pd.api.types.is_sparse).any()
41+
assert not encoded_df.dtypes.apply(lambda x: isinstance(x, pd.SparseDtype)).any()
4242

4343

4444
def test_encode_numpy_array_sparse(sample_numpy_array):

tests/vector_processing/extract_shared_lines_test.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ def test_validated_extracted_shared_lines(example_polygons):
2323
result = extract_shared_lines(example_polygons)
2424
expected_lines = [LineString([(1, 1), (1, 0)]), LineString([(2, 1), (2, 0)])]
2525

26-
result = extract_shared_lines(example_polygons)
27-
2826
assert len(result) == len(expected_lines), "Unexpected amount of lines"
2927

30-
assert result["geometry"].equals(gpd.GeoSeries(expected_lines))
28+
result_geometries = result["geometry"].to_list()
29+
expected_geometries = gpd.GeoSeries(expected_lines).to_list()
30+
31+
assert result_geometries == expected_geometries
3132

3233

3334
@pytest.fixture

0 commit comments

Comments
 (0)