plotting_test.py 893 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import unittest
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point

from context import measprocess as mpc

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)

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