Beispiel #1
0
 def test_no_sindex_active(self):
     """Checks that an error is given when rtree is not installed
     and compat.USE_PYGEOS is False.
     """
     state = compat.USE_PYGEOS  # try to save state
     compat.set_use_pygeos(False)
     with pytest.raises(ImportError):
         sindex.get_sindex_class()
     compat.set_use_pygeos(state)  # try to restore state
Beispiel #2
0
 def test_is_empty(self):
     # create empty tree
     cls_ = sindex.get_sindex_class()
     empty = geopandas.GeoSeries([])
     tree = cls_(empty)
     assert tree.is_empty
     # create a non-empty tree
     non_empty = geopandas.GeoSeries([Point(0, 0)])
     tree = cls_(non_empty)
     assert not tree.is_empty
Beispiel #3
0
 def test_is_empty(self):
     """Tests the `is_empty` property."""
     # create empty tree
     cls_ = sindex.get_sindex_class()
     empty = geopandas.GeoSeries(dtype=object)
     tree = cls_(empty)
     assert tree.is_empty
     # create a non-empty tree
     non_empty = geopandas.GeoSeries([Point(0, 0)])
     tree = cls_(non_empty)
     assert not tree.is_empty
Beispiel #4
0
 def test_no_sindex(self):
     """Checks that a warning is given when no spatial index is present."""
     with pytest.warns():
         sindex.get_sindex_class()
Beispiel #5
0
 def test_no_sindex_installed(self):
     """Checks that an error is raised when no spatial index is present."""
     with pytest.raises(ImportError):
         sindex.get_sindex_class()