X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/blobdiff_plain/faea2fed53ac884983852a6ed1d971c6671784c2..f71116f2cd846d18c7a120ca1ed640b2e68012fc:/tests/test_wrmwmarkup.py diff --git a/tests/test_wrmwmarkup.py b/tests/test_wrmwmarkup.py index 6523643..77005db 100644 --- a/tests/test_wrmwmarkup.py +++ b/tests/test_wrmwmarkup.py @@ -72,17 +72,17 @@ def test_parse_googlemap(): 47.112408,11.271119 ''' - attributes, json = wrpylib.wrmwmarkup.parse_googlemap(wikitext) - assert attributes['lon'] == 11.272337 - assert attributes['lat'] == 47.113291 - assert attributes['zoom'] == 15 - assert json['features'][0]['properties']['type'] == 'carpark' + json = wrpylib.wrmwmarkup.parse_googlemap(wikitext) + assert json['properties']['lon'] == 11.272337 + assert json['properties']['lat'] == 47.113291 + assert json['properties']['zoom'] == 15 + assert json['features'][0]['properties']['type'] == 'parkplatz' assert json['features'][0]['properties']['name'] == 'Erster Parkplatz' assert json['features'][0]['geometry']['coordinates'] == [11.266026, 47.114958] - assert json['features'][1]['properties']['type'] == 'inn' + assert json['features'][1]['properties']['type'] == 'gasthaus' assert json['features'][1]['properties']['name'] == u'Alt Bärnbad (Gasthaus)' assert json['features'][1]['geometry']['coordinates'] == [11.266262, 47.114715] - assert json['features'][2]['properties']['type'] == 'sledrun' + assert json['features'][2]['properties']['type'] == 'rodelbahn' assert json['features'][2]['geometry']['coordinates'] == [ [11.266262, 47.114715], [11.268381, 47.114135], @@ -104,22 +104,22 @@ def test_parse_wrmap(): ''' - attributes, json = wrpylib.wrmwmarkup.parse_wrmap(wikitext) - assert attributes['lon'] == 11.21408895 - assert attributes['lat'] == 47.2417134 - assert attributes['zoom'] == 14 - assert attributes['width'] == 700 - assert attributes['height'] == 400 - assert json['features'][0]['properties']['type'] == 'inn' + json = wrpylib.wrmwmarkup.parse_wrmap(wikitext) + assert json['properties']['lon'] == 11.21408895 + assert json['properties']['lat'] == 47.2417134 + assert json['properties']['zoom'] == 14 + assert json['properties']['width'] == 700 + assert json['properties']['height'] == 400 + assert json['features'][0]['properties']['type'] == 'gasthaus' assert json['features'][0]['properties']['name'] == u'Rosskogelhütte' assert json['features'][0]['properties']['wiki'] == u'Rosskogelhütte' assert json['features'][0]['geometry']['coordinates'] == [11.190454, 47.240689] - assert json['features'][1]['properties']['type'] == 'carpark' + assert json['features'][1]['properties']['type'] == 'parkplatz' assert json['features'][1]['geometry']['coordinates'] == [11.238971, 47.245789] - assert json['features'][2]['properties']['type'] == 'busstop' + assert json['features'][2]['properties']['type'] == 'haltestelle' assert json['features'][2]['properties']['name'] == u'Oberperfuss Rangger Köpfl Lift' assert json['features'][2]['geometry']['coordinates'] == [11.238283, 47.245711] - assert json['features'][3]['properties']['type'] == 'sledrun' + assert json['features'][3]['properties']['type'] == 'rodelbahn' assert json['features'][3]['geometry']['coordinates'] == [ [11.203360, 47.238587], [11.230868, 47.244951], @@ -127,41 +127,46 @@ def test_parse_wrmap(): def test_create_wrmap(): - attributes = {'lon': 11.21408895, 'lat': 47.2417134, 'zoom': 14, 'width': 700, 'height': 400} geojson = { 'type': 'FeatureCollection', 'features': [{ - 'type': 'feature', + 'type': 'Feature', 'geometry': { 'type': 'Point', 'coordinates': [11.190454, 47.240689]}, 'properties': {'type': 'inn', 'name': u'Rosskogelhütte', 'wiki': u'Rosskogelhütte'} }, { - 'type': 'feature', + 'type': 'Feature', 'geometry': { 'type': 'Point', 'coordinates': [11.238971, 47.245789]}, 'properties': {'type': 'carpark'} }, { - 'type': 'feature', + 'type': 'Feature', 'geometry': { 'type': 'Point', 'coordinates': [11.238283, 47.245711]}, 'properties': {'type': 'busstop', 'name': u'Oberperfuss Rangger Köpfl Lift'} }, { - 'type': 'feature', + 'type': 'Feature', 'geometry': { 'type': 'LineString', 'coordinates': [ [11.203360, 47.238587], [11.230868, 47.244951], [11.237853, 47.245470]]}, - 'properties': {} - }] + 'properties': {'type': 'sledrun'} + }], + 'properties': { + 'lon': 11.21408895, + 'lat': 47.2417134, + 'zoom': 14, + 'width': 700, + 'height': 400} } - wikitext = wrpylib.wrmwmarkup.create_wrmap(attributes, geojson) + wikitext = wrpylib.wrmwmarkup.create_wrmap(geojson) assert wikitext == u''' 47.240689 11.190454