plotting_test.py 1.27 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 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
class TestPlottingOSM(unittest.TestCase):
    def setUp(self):
        complete_dataset = pd.read_csv("tests/example_files/gps_test/gps.csv", index_col=0)

        gps_series = complete_dataset[['Lon.', 'Lat.']].values

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

    def test_basic(self):
        #Check if no exception comes up
        series = self._gps_series.set_crs("EPSG:4326")
        mpc.plotting.plot_series_osm(series, show=False)

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

30 31 32 33 34 35 36 37 38 39
    def test_kwargs_basic(self):
        series = self._gps_series.set_crs("EPSG:4326")
        mpc.plotting.plot_series_osm(series, show=False, color="red")

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

40 41
if __name__ == '__main__':
    unittest.main()