#!/usr/bin/python2.7
# -*- coding: iso-8859-15 -*-
import wrpylib.wrmwmarkup
import formencode
def test_rodelbahnbox_to_sledrun():
wikitext = u'''== Allgemeines ==
{{Rodelbahnbox
| Position = 47.309820 N 9.986508 E
| Position oben =
| Höhe oben = 1244
| Position unten =
| Höhe unten = 806
| Länge = 5045
| Schwierigkeit =
| Lawinen = gelegentlich
| Betreiber =
| Öffentliche Anreise = Ja
| Gehzeit = 105
| Aufstieg getrennt = Nein
| Aufstiegshilfe = Nein
| Beleuchtungsanlage = Nein
| Beleuchtungstage =
| Rodelverleih = Ja
| Gütesiegel =
| Webauskunft =
| Telefonauskunft = +43-664-1808482 (Bergkristallhütte)
| Bild = Rodelbahn Bergkristallhütte 2009-03-03.jpg
| In Übersichtskarte = Ja
| Forumid = 72
}}
Die Rodelbahn zur Bergkristallhütte ist durchaus abwechslungsreich.'''
start, end, sledrun = wrpylib.wrmwmarkup.rodelbahnbox_to_sledrun(wikitext)
wrpylib.wrmwmarkup.sledrun_to_rodelbahnbox(sledrun, '1.3')
def test_gasthausbox_to_inn():
wikitext = u'''{{Gasthausbox
| Position = 47.295549 N 9.986970 E
| Höhe = 1250
| Betreiber =
| Sitzplätze =
| Übernachtung =
| Rauchfrei = Nein
| Rodelverleih =
| Handyempfang = A1; T-Mobile/Telering
| Homepage = http://www.bergkristallhuette.com/
| E-Mail = bergkristallhuette@gmx.at
| Telefon = +43-664-1808482
| Bild = Bergkritsallhütte 2009-02-07.JPG
| Rodelbahnen = [[Bergkristallhütte]]
}}
Die Bergkristallhütte ist Teil des Boden-Vorsäß.'''
start, end, inn = wrpylib.wrmwmarkup.gasthausbox_to_inn(wikitext)
wrpylib.wrmwmarkup.inn_to_gasthausbox(inn)
def test_parse_googlemap():
wikitext = u'''
(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
'''
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'
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']['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]['geometry']['coordinates'] == [
[11.266262, 47.114715],
[11.268381, 47.114135],
[11.269322, 47.113421],
[11.269979, 47.11277],
[11.271119, 47.112408]]
def test_parse_wrmap():
wikitext = u'''
47.240689 11.190454
47.245789 11.238971
47.245711 11.238283
47.238587 11.203360
47.244951 11.230868
47.245470 11.237853
'''
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'
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]['geometry']['coordinates'] == [11.238971, 47.245789]
assert json['features'][2]['properties']['type'] == 'busstop'
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]['geometry']['coordinates'] == [
[47.238587, 11.203360],
[47.244951, 11.230868],
[47.245470, 11.237853]]
def test_create_wrmap():
pass