Fixed test test_create_wrmap (an attribute in the test-json was missing).
[philipp/winterrodeln/wrpylib.git] / tests / test_mwmarkup.py
index 7f85ea9d82223ba930609e5be02adbefebeae54f..b8a12a2d7bf39082c2c5e75c861e2d08c9ab4aa8 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!/usr/bin/python2.7
 # -*- coding: iso-8859-15 -*-
 import wrpylib.mwmarkup
 
@@ -82,3 +82,31 @@ def test_create_template():
     assert wikitext_generated == wikitext
 
 
+def test_parse_googlemap():
+    wikitext = u'''
+    <googlemap version="0.9" lat="47.113291" lon="11.272337" zoom="15">
+    (Parkplatz)47.114958,11.266026
+    Erster Parkplatz
+    
+    (Gasthaus) 47.114715, 11.266262, Alt Bärnbad (Gasthaus)
+    6#FF014E9A
+    47.114715,11.266262
+    47.114135,11.268381
+    47.113421,11.269322
+    47.11277,11.269979
+    47.112408,11.271119
+    </googlemap>
+    '''
+    center, zoom, coords, paths = wrpylib.mwmarkup.parse_googlemap(wikitext)
+    assert center == (11.272337, 47.113291)
+    assert zoom == 15
+    assert coords == [
+        (11.266026, 47.114958, 'Parkplatz', 'Erster Parkplatz'),
+        (11.266262, 47.114715, 'Gasthaus', u'Alt Bärnbad (Gasthaus)')]
+    assert paths == [
+        ('6#FF014E9A', [
+            (11.266262, 47.114715, None, None),
+            (11.268381, 47.114135, None, None),
+            (11.269322, 47.113421, None, None),
+            (11.269979, 47.11277, None, None),
+            (11.271119, 47.112408, None, None)])]