plotting_test.py 1.29 KB
Newer Older
1
import unittest
2

3
import geopandas as gpd
4
import pandas as pd
5 6 7 8
from shapely.geometry import Point

from context import measprocess as mpc

9

10 11
class TestPlottingOSM(unittest.TestCase):
    def setUp(self):
12 13 14
        complete_dataset = pd.read_csv(
            "tests/example_files/gps_test/gps.csv", index_col=0
        )
15

16
        gps_series = complete_dataset[["Lon.", "Lat."]].values
17

18
        self._gps_series = gpd.GeoSeries((Point(lon, lat) for lon, lat in gps_series))
19 20

    def test_basic(self):
21
        # Check if no exception comes up
22
        series = self._gps_series.set_crs("EPSG:4326")
23
        mpc.plotting.plot_locations_osm(series, show=False)
24 25 26

    def test_exception_epsg(self):
        with self.assertRaises(ValueError):
27
            series = self._gps_series  # .set_crs("EPSG:4326")
28
            mpc.plotting.plot_locations_osm(series, show=False)
29

30 31
    def test_kwargs_basic(self):
        series = self._gps_series.set_crs("EPSG:4326")
32
        mpc.plotting.plot_locations_osm(series, show=False, color="red")
33 34

    def test_kwargs_double(self):
35
        # s is based twice here
36 37
        with self.assertRaises(TypeError):
            series = self._gps_series.set_crs("EPSG:4326")
38
            mpc.plotting.plot_locations_osm(series, show=False, s=100, color="red")
39

40 41

if __name__ == "__main__":
42
    unittest.main()