Skip to content

Commit 3acae8d

Browse files
jdmcbrjorisvandenbossche
authored andcommitted
TST: Add CRS mismatch warning to cython branch (geopandas#584)
1 parent 720194c commit 3acae8d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

geopandas/tools/sjoin.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import, division, print_function
2+
from warnings import warn
23

34
from warnings import warn
45

geopandas/tools/tests/test_sjoin.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
for i in range(3)])
1919
for _ in range(10)]
2020

21-
2221
points = [Point(random.random(), random.random())
2322
for _ in range(20)]
2423

@@ -87,6 +86,20 @@ def test_sjoin(op, lsuffix, rsuffix, how, missing):
8786
assert any(p.equals(p2) for p2 in L)
8887

8988

89+
def test_crs_mismatch():
90+
left = gpd.GeoDataFrame({'geometry': triangles,
91+
'x': np.random.random(len(triangles)),
92+
'y': np.random.random(len(triangles))},
93+
crs={'init': 'epsg:4326'})
94+
95+
right = gpd.GeoDataFrame({'geometry': points,
96+
'x': np.random.random(len(points)),
97+
'z': np.random.random(len(points))})
98+
99+
with pytest.warns(UserWarning):
100+
sjoin(left, right)
101+
102+
90103
def test_errors():
91104
left = gpd.GeoDataFrame({'geometry': triangles,
92105
'x': np.random.random(len(triangles)),

0 commit comments

Comments
 (0)