예제 #1
0
class TestCRS:
    def setup_method(self):
        self.crs = "epsg:3854"
        self.s = GeoSeries([make_point(x, x) for x in range(5)], crs=self.crs)

    def test_constrctor(self):
        assert self.crs.upper() == self.s.crs

    def test_series_method(self):
        assert self.s.head().crs == self.crs.upper()
        assert self.s[:4].crs == self.crs.upper()
        assert self.s.take([1, 3, 4]).crs == self.crs.upper()
        assert self.s[[True, False, True, True, True]].crs == self.crs.upper()

    # test methods in GeoSeries will produce GeoSeries as result
    def test_geom_method(self):
        assert self.s.buffer(0.2).crs == self.crs.upper()
        assert self.s.intersection(self.s).crs == self.crs.upper()
        assert self.s.centroid.crs == self.crs.upper()
예제 #2
0
class TestType:
    def setup_method(self):
        self.s = GeoSeries([make_point(x, x) for x in range(5)])

    def test_head_tail(self):
        assert_is_geoseries(self.s.head())
        assert_is_geoseries(self.s.tail())

    def test_slice(self):
        assert_is_geoseries(self.s[2::5])
        assert_is_geoseries(self.s[::-1])

    def test_loc_iloc(self):
        assert_is_geoseries(self.s.loc[1:])
        assert_is_geoseries(self.s.iloc[:4])

    def test_take(self):
        assert_is_geoseries(self.s.take([0, 2, 4]))

    def test_geom_method(self):
        assert_is_geoseries(self.s.buffer(0.2))
        assert_is_geoseries(self.s.intersection(self.s))
        assert_is_geoseries(self.s.centroid)