Work on parsing wikicode (currently Rodelbahnbox).
[philipp/winterrodeln/wrpylib.git] / tests / test_wrdem.py
index ebdc8bcf9337f10edbc0d44770a14f748d19f5ce..fb6f0f69fa3dc70c2279e1feb6e562d07ec02388 100644 (file)
@@ -1,9 +1,10 @@
 import unittest
 
 import owslib.wms
-import rasterio
+import rasterio  # pip install rasterio
 
-from wrpylib.wrdem import get_ele_from_raster, get_ele_from_wms, MultiDem, transform_lon_lat, DemSwitzerland, DemBasemap
+from wrpylib.wrdem import get_ele_from_raster, get_ele_from_wms, MultiDem, transform_lon_lat, DemSwitzerland, \
+    DemBasemap, DemBavaria
 from wrpylib.wrvalidators import LonLat
 
 
@@ -92,6 +93,30 @@ class TestDemSwitzerland(unittest.TestCase):
         self.assertIsNone(ele)
 
 
+class TestDemBavaria(unittest.TestCase):
+    def setUp(self):
+        self.dem = DemBavaria()
+
+    def tearDown(self):
+        self.dem.close()
+
+    def test_get_ele_inside_valid(self):
+        ele = self.dem.get_ele(LonLat(11.5396, 47.6809))
+        self.assertAlmostEqual(ele, 863, delta=0.5)
+        # ele = self.dem.get_ele(LonLat(11.010041, 47.618947))
+        # self.assertAlmostEqual(ele, 998, delta=0.5)
+        # ele = self.dem.get_ele(LonLat(11.019577, 47.620695))
+        # self.assertAlmostEqual(ele, 833, delta=0.5)
+
+    def test_get_ele_inside_invalid(self):
+        ele = self.dem.get_ele(LonLat(9.91, 48.97))
+        self.assertIsNone(ele)
+
+    def test_get_ele_outside(self):
+        ele = self.dem.get_ele(LonLat(5.182008, 46.799233))
+        self.assertIsNone(ele)
+
+
 class TestWrDemMultiDem(unittest.TestCase):
     def setUp(self):
         self.dem = MultiDem()