From: philipp Date: Tue, 31 Mar 2015 20:28:19 +0000 (+0000) Subject: Now the tests are using the unittest module. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/commitdiff_plain/3bfa52e935cb33d4a6231b0d0328facbc6299254?ds=sidebyside Now the tests are using the unittest module. git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2172 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- diff --git a/tests/test_mwdb.py b/tests/test_mwdb.py index dbb2ced..6edbfce 100644 --- a/tests/test_mwdb.py +++ b/tests/test_mwdb.py @@ -1,25 +1,27 @@ #!/usr/bin/python2.7 # -*- coding: iso-8859-15 -*- +import unittest import wrpylib.mwdb import sqlalchemy -def test_page_table(): - metadata = sqlalchemy.MetaData() - page_table = wrpylib.mwdb.page_table(metadata) +class TestMwDb(unittest.TestCase): + def test_page_table(self): + metadata = sqlalchemy.MetaData() + page_table = wrpylib.mwdb.page_table(metadata) -def test_revision_table(): - metadata = sqlalchemy.MetaData() - revision_table = wrpylib.mwdb.revision_table(metadata) + def test_revision_table(self): + metadata = sqlalchemy.MetaData() + revision_table = wrpylib.mwdb.revision_table(metadata) -def test_text_table(): - metadata = sqlalchemy.MetaData() - text_table = wrpylib.mwdb.text_table(metadata) + def test_text_table(self): + metadata = sqlalchemy.MetaData() + text_table = wrpylib.mwdb.text_table(metadata) -def test_categorylinks_table(): - metadata = sqlalchemy.MetaData() - categorylinks_table = wrpylib.mwdb.categorylinks_table(metadata) + def test_categorylinks_table(self): + metadata = sqlalchemy.MetaData() + categorylinks_table = wrpylib.mwdb.categorylinks_table(metadata) diff --git a/tests/test_mwmarkup.py b/tests/test_mwmarkup.py index db93586..120e80e 100644 --- a/tests/test_mwmarkup.py +++ b/tests/test_mwmarkup.py @@ -1,159 +1,159 @@ #!/usr/bin/python2.7 # -*- coding: iso-8859-15 -*- import wrpylib.mwmarkup +import unittest -def test_find_template(): - 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 = wrpylib.mwmarkup.find_template(wikitext, u'Rodelbahnbox') - assert start == wikitext.find(u'{{') - assert end == wikitext.find(u'}}')+2 +class TestMwMarkup(unittest.TestCase): + def test_find_template(self): + 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 = wrpylib.mwmarkup.find_template(wikitext, u'Rodelbahnbox') + assert start == wikitext.find(u'{{') + assert end == wikitext.find(u'}}')+2 -def test_TemplateValidator(): - v = wrpylib.mwmarkup.TemplateValidator() - value = u'{{Rodelbahnbox | Unbenannt | Position = 47.309820 N 9.986508 E | Aufstieg möglich = Ja }}' - title, anonym_params, named_params = v.to_python(value) - assert title == u'Rodelbahnbox' - assert anonym_params == [u'Unbenannt'] - assert named_params.keys() == [u'Position', u'Aufstieg möglich'] - assert named_params.values() == ['47.309820 N 9.986508 E', 'Ja'] - value2 = v.from_python((title, anonym_params, named_params)) - assert value2 == u'{{Rodelbahnbox|Unbenannt|Position=47.309820 N 9.986508 E|Aufstieg möglich=Ja}}' - v = wrpylib.mwmarkup.TemplateValidator(as_table=True) - value3 = v.from_python((title, anonym_params, named_params)) - print value3 - assert value3 == \ - u'{{Rodelbahnbox\n' + \ - u'| Unbenannt\n' + \ - u'| Position = 47.309820 N 9.986508 E\n' + \ - u'| Aufstieg möglich = Ja\n' + \ - u'}}' - v = wrpylib.mwmarkup.TemplateValidator(strip=False) - title, anonym_params, named_params = v.to_python(value) - assert title == u'Rodelbahnbox ' - assert anonym_params == [u' Unbenannt '] - assert named_params.keys() == [u' Position ', u' Aufstieg möglich '] - assert named_params.values() == [' 47.309820 N 9.986508 E ', ' Ja '] + def test_TemplateValidator(self): + v = wrpylib.mwmarkup.TemplateValidator() + value = u'{{Rodelbahnbox | Unbenannt | Position = 47.309820 N 9.986508 E | Aufstieg möglich = Ja }}' + title, anonym_params, named_params = v.to_python(value) + assert title == u'Rodelbahnbox' + assert anonym_params == [u'Unbenannt'] + assert named_params.keys() == [u'Position', u'Aufstieg möglich'] + assert named_params.values() == ['47.309820 N 9.986508 E', 'Ja'] + value2 = v.from_python((title, anonym_params, named_params)) + assert value2 == u'{{Rodelbahnbox|Unbenannt|Position=47.309820 N 9.986508 E|Aufstieg möglich=Ja}}' + v = wrpylib.mwmarkup.TemplateValidator(as_table=True) + value3 = v.from_python((title, anonym_params, named_params)) + assert value3 == \ + u'{{Rodelbahnbox\n' + \ + u'| Unbenannt\n' + \ + u'| Position = 47.309820 N 9.986508 E\n' + \ + u'| Aufstieg möglich = Ja\n' + \ + u'}}' + v = wrpylib.mwmarkup.TemplateValidator(strip=False) + title, anonym_params, named_params = v.to_python(value) + assert title == u'Rodelbahnbox ' + assert anonym_params == [u' Unbenannt '] + assert named_params.keys() == [u' Position ', u' Aufstieg möglich '] + assert named_params.values() == [' 47.309820 N 9.986508 E ', ' Ja '] -def test_split_template(): - 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 = wrpylib.mwmarkup.find_template(wikitext, u'Rodelbahnbox') - template_title, parameters = wrpylib.mwmarkup.split_template(wikitext[start:end]) - assert template_title == u'Rodelbahnbox' - assert len(parameters) == 22 - assert parameters['Position'] == u'47.309820 N 9.986508 E' - assert parameters['Telefonauskunft'] == u'+43-664-1808482 (Bergkristallhütte)' - assert parameters['Schwierigkeit'] == u'' + def test_split_template(self): + 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 = wrpylib.mwmarkup.find_template(wikitext, u'Rodelbahnbox') + template_title, parameters = wrpylib.mwmarkup.split_template(wikitext[start:end]) + assert template_title == u'Rodelbahnbox' + assert len(parameters) == 22 + assert parameters['Position'] == u'47.309820 N 9.986508 E' + assert parameters['Telefonauskunft'] == u'+43-664-1808482 (Bergkristallhütte)' + assert parameters['Schwierigkeit'] == u'' -def test_create_template(): - wikitext = u'''{{Nicetemplate|Red|Bold|Position=Top|Alignment=Right}}''' - template_title, parameters = wrpylib.mwmarkup.split_template(wikitext) - print parameters - keys = [u'1', u'2', u'Position', u'Alignment'] - values = [parameters[k] for k in keys] - wikitext_generated = wrpylib.mwmarkup.create_template(template_title, values[:2], keys[2:], values[2:]) - wikitext_table = wrpylib.mwmarkup.create_template(template_title, values[:2], keys[2:], values[2:], True) - assert wikitext_generated == wikitext + def test_create_template(self): + wikitext = u'''{{Nicetemplate|Red|Bold|Position=Top|Alignment=Right}}''' + template_title, parameters = wrpylib.mwmarkup.split_template(wikitext) + keys = [u'1', u'2', u'Position', u'Alignment'] + values = [parameters[k] for k in keys] + wikitext_generated = wrpylib.mwmarkup.create_template(template_title, values[:2], keys[2:], values[2:]) + wikitext_table = wrpylib.mwmarkup.create_template(template_title, values[:2], keys[2:], values[2:], True) + assert wikitext_generated == wikitext -def test_find_tag(): - wikitext = u'This is my first tag and my second tag.' - start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tags') - assert (start, content, endtag, end) == (None, None, None, None) - start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag') - assert (start, content, endtag, end) == (8, 13, 25, 31) - start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag', end) - assert (start, content, endtag, end) == (36, 41, 54, 60) - wikitext = u'This is .' - start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag') - assert (start, content, endtag, end) == (8, None, None, 27) + def test_find_tag(self): + wikitext = u'This is my first tag and my second tag.' + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tags') + assert (start, content, endtag, end) == (None, None, None, None) + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag') + assert (start, content, endtag, end) == (8, 13, 25, 31) + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag', end) + assert (start, content, endtag, end) == (36, 41, 54, 60) + wikitext = u'This is .' + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag') + assert (start, content, endtag, end) == (8, None, None, 27) -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, coords, paths = wrpylib.mwmarkup.parse_googlemap(wikitext) - assert attributes['lon'] == 11.272337 - assert attributes['lat'] == 47.113291 - assert attributes['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)])] - try: - result = wrpylib.mwmarkup.parse_googlemap(wikitext.replace(' + (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, coords, paths = wrpylib.mwmarkup.parse_googlemap(wikitext) + assert attributes['lon'] == 11.272337 + assert attributes['lat'] == 47.113291 + assert attributes['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)])] + try: + result = wrpylib.mwmarkup.parse_googlemap(wikitext.replace(' + (Parkplatz)47.114958,11.266026 + Erster Parkplatz -def test_googlemap_to_wrmap(): - 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, coords, paths = wrpylib.mwmarkup.parse_googlemap(wikitext) - json = wrpylib.wrmwmarkup.googlemap_to_wrmap(attributes, coords, paths) - assert json['properties']['lon'] == 11.272337 - assert json['properties']['lat'] == 47.113291 - assert json['properties']['zoom'] == 15 - assert json['properties']['height'] == 450 - 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'] == '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'] == 'rodelbahn' - 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]] + (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, coords, paths = wrpylib.mwmarkup.parse_googlemap(wikitext) + json = wrpylib.wrmwmarkup.googlemap_to_wrmap(attributes, coords, paths) + assert json['properties']['lon'] == 11.272337 + assert json['properties']['lat'] == 47.113291 + assert json['properties']['zoom'] == 15 + assert json['properties']['height'] == 450 + 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'] == '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'] == 'rodelbahn' + 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 - - - ''' - 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'] == 'parkplatz' - assert json['features'][1]['geometry']['coordinates'] == [11.238971, 47.245789] - 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'] == 'rodelbahn' - assert json['features'][3]['geometry']['coordinates'] == [ - [11.203360, 47.238587], - [11.230868, 47.244951], - [11.237853, 47.245470]] + def test_parse_wrmap(self): + 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 + + + ''' + 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'] == 'parkplatz' + assert json['features'][1]['geometry']['coordinates'] == [11.238971, 47.245789] + 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'] == 'rodelbahn' + assert json['features'][3]['geometry']['coordinates'] == [ + [11.203360, 47.238587], + [11.230868, 47.244951], + [11.237853, 47.245470]] -def test_create_wrmap(): - geojson = { - 'type': 'FeatureCollection', - 'features': - [{ - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [11.190454, 47.240689]}, - 'properties': {'type': 'gasthaus', 'name': u'Rosskogelhütte', 'wiki': u'Rosskogelhütte'} - }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [11.238971, 47.245789]}, - 'properties': {'type': 'parkplatz'} - }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [11.238283, 47.245711]}, - 'properties': {'type': 'haltestelle', 'name': u'Oberperfuss Rangger Köpfl Lift'} - }, { - 'type': 'Feature', - 'geometry': { - 'type': 'LineString', - 'coordinates': [ - [11.203360, 47.238587], - [11.230868, 47.244951], - [11.237853, 47.245470]]}, - 'properties': {'type': 'rodelbahn'} - }], - 'properties': { - 'lon': 11.21408895, - 'lat': 47.2417134, - 'zoom': 14, - 'width': 700, - 'height': 400} - } + def test_create_wrmap(self): + geojson = { + 'type': 'FeatureCollection', + 'features': + [{ + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [11.190454, 47.240689]}, + 'properties': {'type': 'gasthaus', 'name': u'Rosskogelhütte', 'wiki': u'Rosskogelhütte'} + }, { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [11.238971, 47.245789]}, + 'properties': {'type': 'parkplatz'} + }, { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [11.238283, 47.245711]}, + 'properties': {'type': 'haltestelle', 'name': u'Oberperfuss Rangger Köpfl Lift'} + }, { + 'type': 'Feature', + 'geometry': { + 'type': 'LineString', + 'coordinates': [ + [11.203360, 47.238587], + [11.230868, 47.244951], + [11.237853, 47.245470]]}, + 'properties': {'type': 'rodelbahn'} + }], + 'properties': { + 'lon': 11.21408895, + 'lat': 47.2417134, + 'zoom': 14, + 'width': 700, + 'height': 400} + } - wikitext = wrpylib.wrmwmarkup.create_wrmap(geojson) - assert wikitext == textwrap.dedent(u'''\ - + wikitext = wrpylib.wrmwmarkup.create_wrmap(geojson) + assert wikitext == textwrap.dedent(u'''\ + - 47.240689 N 11.190454 E - 47.245789 N 11.238971 E - 47.245711 N 11.238283 E + 47.240689 N 11.190454 E + 47.245789 N 11.238971 E + 47.245711 N 11.238283 E - - 47.238587 N 11.203360 E - 47.244951 N 11.230868 E - 47.245470 N 11.237853 E - + + 47.238587 N 11.203360 E + 47.244951 N 11.230868 E + 47.245470 N 11.237853 E + - ''') + ''') diff --git a/tests/test_wrvalidators.py b/tests/test_wrvalidators.py index ae21f2b..eeb4a1c 100644 --- a/tests/test_wrvalidators.py +++ b/tests/test_wrvalidators.py @@ -3,346 +3,347 @@ import collections import wrpylib.wrvalidators import formencode +import unittest -def test_OrderedSchema(): - v = wrpylib.wrvalidators.OrderedSchema() - v.pre_validators = [formencode.Validator()] - v.chained_validators = [formencode.Validator()] - v.add_field(u'c', formencode.Validator()) - v.add_field(u'b', formencode.Validator()) - v.add_field(u'a', formencode.Validator()) - v.add_field(u'd', formencode.Validator()) - other = collections.OrderedDict([('d', 'd'), ('b', 'b'), ('a', 'a'), ('c', 'c')]) - python = v.to_python(other) - assert python.keys() == other.keys() - assert python.values() == other.values() - other2 = v.from_python(python) - assert other.keys() == other2.keys() - assert other.values() == other2.values() +class TestWrValidators(unittest.TestCase): + def test_OrderedSchema(self): + v = wrpylib.wrvalidators.OrderedSchema() + v.pre_validators = [formencode.Validator()] + v.chained_validators = [formencode.Validator()] + v.add_field(u'c', formencode.Validator()) + v.add_field(u'b', formencode.Validator()) + v.add_field(u'a', formencode.Validator()) + v.add_field(u'd', formencode.Validator()) + other = collections.OrderedDict([('d', 'd'), ('b', 'b'), ('a', 'a'), ('c', 'c')]) + python = v.to_python(other) + assert python.keys() == other.keys() + assert python.values() == other.values() + other2 = v.from_python(python) + assert other.keys() == other2.keys() + assert other.values() == other2.values() -def test_NoneValidator(): - v = wrpylib.wrvalidators.NoneValidator(wrpylib.wrvalidators.Unicode()) - assert v.to_python(u'') == None - assert v.from_python(None) == u'' + def test_NoneValidator(self): + v = wrpylib.wrvalidators.NoneValidator(wrpylib.wrvalidators.Unicode()) + assert v.to_python(u'') == None + assert v.from_python(None) == u'' -# test_NeinValidator + # test_NeinValidator -# test_Unicode + # test_Unicode -# test_UnicodeNone + # test_UnicodeNone -# test_Unsigned + # test_Unsigned -def test_UnsignedNone(): - v = wrpylib.wrvalidators.UnsignedNone() - assert v.to_python(u'42') == 42 - assert v.to_python(u'') == None - assert v.from_python(42) == u'42' - assert v.from_python(None) == u'' + def test_UnsignedNone(self): + v = wrpylib.wrvalidators.UnsignedNone() + assert v.to_python(u'42') == 42 + assert v.to_python(u'') == None + assert v.from_python(42) == u'42' + assert v.from_python(None) == u'' -# test_UnsignedNeinNone + # test_UnsignedNeinNone -# test_Loop + # test_Loop -# test_DictValidator + # test_DictValidator -# test_GermanBoolNone + # test_GermanBoolNone -def test_GermanTristateTuple(): - v = wrpylib.wrvalidators.GermanTristateTuple() - assert v.to_python(u'') == (None, None) - assert v.to_python(u'Ja') == (True, False) - assert v.to_python(u'Nein') == (False, True) - assert v.to_python(u'Teilweise') == (True, True) - assert v.from_python((None, None)) == u'' - assert v.from_python((False, True)) == u'Nein' - assert v.from_python((True, False)) == u'Ja' - assert v.from_python((True, True)) == u'Teilweise' + def test_GermanTristateTuple(self): + v = wrpylib.wrvalidators.GermanTristateTuple() + assert v.to_python(u'') == (None, None) + assert v.to_python(u'Ja') == (True, False) + assert v.to_python(u'Nein') == (False, True) + assert v.to_python(u'Teilweise') == (True, True) + assert v.from_python((None, None)) == u'' + assert v.from_python((False, True)) == u'Nein' + assert v.from_python((True, False)) == u'Ja' + assert v.from_python((True, True)) == u'Teilweise' -def test_GermanTristateFloat(): - v = wrpylib.wrvalidators.GermanTristateFloat() - assert v.to_python(u'') == None - assert v.to_python(u'Ja') == 1.0 - assert v.to_python(u'Nein') == 0.0 - assert v.to_python(u'Teilweise') == 0.5 - assert v.from_python(None) == u'' - assert v.from_python(0.0) == u'Nein' - assert v.from_python(1.0) == u'Ja' - assert v.from_python(0.5) == u'Teilweise' + def test_GermanTristateFloat(self): + v = wrpylib.wrvalidators.GermanTristateFloat() + assert v.to_python(u'') == None + assert v.to_python(u'Ja') == 1.0 + assert v.to_python(u'Nein') == 0.0 + assert v.to_python(u'Teilweise') == 0.5 + assert v.from_python(None) == u'' + assert v.from_python(0.0) == u'Nein' + assert v.from_python(1.0) == u'Ja' + assert v.from_python(0.5) == u'Teilweise' -# test_ValueComment + # test_ValueComment -# test_SemicolonList + # test_SemicolonList -def test_ValueCommentList(): - v = wrpylib.wrvalidators.ValueCommentList() - assert v.to_python(u'abc') == [(u'abc', None)] - assert v.to_python(u'abc def') == [(u'abc def', None)] - assert v.to_python(u'value (comment)') == [(u'value', u'comment')] - assert v.to_python(u'value (comment)') == [(u'value', u'comment')] - assert v.to_python(u'value1 (comment); value2') == [(u'value1', u'comment'), (u'value2', None)] - assert v.to_python(u'value1 (comment1); value2; value3 (comment3)') == [(u'value1', u'comment1'), (u'value2', None), ('value3', 'comment3')] - assert v.to_python(u'value1 (comment1); [[link (linkcomment)]] (not easy)') == [(u'value1', u'comment1'), (u'[[link (linkcomment)]]', u'not easy')] + def test_ValueCommentList(self): + v = wrpylib.wrvalidators.ValueCommentList() + assert v.to_python(u'abc') == [(u'abc', None)] + assert v.to_python(u'abc def') == [(u'abc def', None)] + assert v.to_python(u'value (comment)') == [(u'value', u'comment')] + assert v.to_python(u'value (comment)') == [(u'value', u'comment')] + assert v.to_python(u'value1 (comment); value2') == [(u'value1', u'comment'), (u'value2', None)] + assert v.to_python(u'value1 (comment1); value2; value3 (comment3)') == [(u'value1', u'comment1'), (u'value2', None), ('value3', 'comment3')] + assert v.to_python(u'value1 (comment1); [[link (linkcomment)]] (not easy)') == [(u'value1', u'comment1'), (u'[[link (linkcomment)]]', u'not easy')] -# test_GenericDateTime + # test_GenericDateTime -# test_DateTimeNoSec + # test_DateTimeNoSec -# test_DateNone + # test_DateNone -# test_Geo + # test_Geo -def test_GeoNone(): - coord = u'47.076207 N 11.453553 E' - v = wrpylib.wrvalidators.GeoNone() - (lat, lon) = v.to_python(coord) - assert lat == 47.076207 - assert lon == 11.453553 - assert v.to_python(u'') == (None, None) + def test_GeoNone(self): + coord = u'47.076207 N 11.453553 E' + v = wrpylib.wrvalidators.GeoNone() + (lat, lon) = v.to_python(coord) + assert lat == 47.076207 + assert lon == 11.453553 + assert v.to_python(u'') == (None, None) - assert v.from_python((lat, lon)) == coord - assert v.from_python((None, None)) == u'' + assert v.from_python((lat, lon)) == coord + assert v.from_python((None, None)) == u'' -# test_MultiGeo + # test_MultiGeo -# test_AustrianPhoneNumber + # test_AustrianPhoneNumber -# test_AustrianPhoneNumberNone + # test_AustrianPhoneNumberNone -# test_AustrianPhoneNumberCommentLoop + # test_AustrianPhoneNumberCommentLoop -# test_GermanDifficulty + # test_GermanDifficulty -# test_GermanAvalanches + # test_GermanAvalanches -def test_GermanPublicTransport(): - v = wrpylib.wrvalidators.GermanPublicTransport() - assert v.to_python(u'') is None - assert v.to_python(u'Sehr gut') == 1 - assert v.to_python(u'Gut') == 2 - assert v.to_python(u'Mittelmäßig') == 3 - assert v.to_python(u'Schlecht') == 4 - assert v.to_python(u'Nein') == 5 - assert v.to_python(u'Ja') == 6 + def test_GermanPublicTransport(self): + v = wrpylib.wrvalidators.GermanPublicTransport() + assert v.to_python(u'') is None + assert v.to_python(u'Sehr gut') == 1 + assert v.to_python(u'Gut') == 2 + assert v.to_python(u'Mittelmäßig') == 3 + assert v.to_python(u'Schlecht') == 4 + assert v.to_python(u'Nein') == 5 + assert v.to_python(u'Ja') == 6 - assert v.from_python(None) == u'' - assert v.from_python(1) == u'Sehr gut' - assert v.from_python(2) == u'Gut' - assert v.from_python(3) == u'Mittelmäßig' - assert v.from_python(4) == u'Schlecht' - assert v.from_python(5) == u'Nein' - assert v.from_python(6) == u'Ja' - assert v.from_python(1l) == u'Sehr gut' + assert v.from_python(None) == u'' + assert v.from_python(1) == u'Sehr gut' + assert v.from_python(2) == u'Gut' + assert v.from_python(3) == u'Mittelmäßig' + assert v.from_python(4) == u'Schlecht' + assert v.from_python(5) == u'Nein' + assert v.from_python(6) == u'Ja' + assert v.from_python(1l) == u'Sehr gut' -# test_GermanTristateFloatComment + # test_GermanTristateFloatComment -# test_UnsignedCommentNone + # test_UnsignedCommentNone -# test_GermanCachet + # test_GermanCachet -# test_url + # test_url -def test_UrlNeinNone(): - v = wrpylib.wrvalidators.UrlNeinNone() - assert v.to_python(u'') == None - assert v.to_python(u'Nein') == u'Nein' - assert v.to_python(u'http://www.höttingeralm.at') == u'http://www.höttingeralm.at' - assert v.from_python(None) == u'' - assert v.from_python(u'Nein') == u'Nein' - assert v.from_python(u'http://www.höttingeralm.at') == u'http://www.höttingeralm.at' + def test_UrlNeinNone(self): + v = wrpylib.wrvalidators.UrlNeinNone() + assert v.to_python(u'') == None + assert v.to_python(u'Nein') == u'Nein' + assert v.to_python(u'http://www.höttingeralm.at') == u'http://www.höttingeralm.at' + assert v.from_python(None) == u'' + assert v.from_python(u'Nein') == u'Nein' + assert v.from_python(u'http://www.höttingeralm.at') == u'http://www.höttingeralm.at' -def test_ValueCommentListNeinLoopNone(): - v = wrpylib.wrvalidators.ValueCommentListNeinLoopNone() - assert v.to_python(u'') == None - assert v.to_python(u'Nein') == u'Nein' - assert v.to_python(u'T-Mobile (gut); A1') == u'T-Mobile (gut); A1' - assert v.from_python(None) == u'' - assert v.from_python(u'Nein') == u'Nein' - assert v.from_python(u'T-Mobile (gut); A1') == u'T-Mobile (gut); A1' + def test_ValueCommentListNeinLoopNone(self): + v = wrpylib.wrvalidators.ValueCommentListNeinLoopNone() + assert v.to_python(u'') == None + assert v.to_python(u'Nein') == u'Nein' + assert v.to_python(u'T-Mobile (gut); A1') == u'T-Mobile (gut); A1' + assert v.from_python(None) == u'' + assert v.from_python(u'Nein') == u'Nein' + assert v.from_python(u'T-Mobile (gut); A1') == u'T-Mobile (gut); A1' -# test_PhoneNumber - + # test_PhoneNumber -def test_PhoneCommentListNeinLoopNone(): - v = wrpylib.wrvalidators.PhoneCommentListNeinLoopNone(comments_are_optional=True) - assert v.to_python(u'') == None - assert v.to_python(u'Nein') == u'Nein' - assert v.to_python(u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456') == u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456' - assert v.from_python(None) == u'' - assert v.from_python(u'Nein') == u'Nein' - assert v.from_python(u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456') == u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456' + def test_PhoneCommentListNeinLoopNone(self): + v = wrpylib.wrvalidators.PhoneCommentListNeinLoopNone(comments_are_optional=True) + assert v.to_python(u'') == None + assert v.to_python(u'Nein') == u'Nein' + assert v.to_python(u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456') == u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456' + assert v.from_python(None) == u'' + assert v.from_python(u'Nein') == u'Nein' + assert v.from_python(u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456') == u'+43-699-1234567 (nicht nach 20:00 Uhr); +43-512-123456' -def test_MaskedEmail(): - v = wrpylib.wrvalidators.MaskedEmail() - assert v.to_python(u'') == (None, None) - assert v.to_python(u'abc.def@example.com') == (u'abc.def@example.com', False) - assert v.to_python(u'abc.def(at)example.com') == (u'abc.def@example.com', True) - assert v.from_python((None, None)) == u'' - assert v.from_python((u'abc.def@example.com', False)) == u'abc.def@example.com' - assert v.from_python((u'abc.def@example.com', True)) == u'abc.def(at)example.com' + def test_MaskedEmail(self): + v = wrpylib.wrvalidators.MaskedEmail() + assert v.to_python(u'') == (None, None) + assert v.to_python(u'abc.def@example.com') == (u'abc.def@example.com', False) + assert v.to_python(u'abc.def(at)example.com') == (u'abc.def@example.com', True) + assert v.from_python((None, None)) == u'' + assert v.from_python((u'abc.def@example.com', False)) == u'abc.def@example.com' + assert v.from_python((u'abc.def@example.com', True)) == u'abc.def(at)example.com' -def test_EmailCommentListNeinLoopNone(): - v = wrpylib.wrvalidators.EmailCommentListNeinLoopNone() - assert v.to_python(u'') == None - assert v.to_python(u'Nein') == u'Nein' - assert v.to_python(u'first@example.com') == u'first@example.com' - assert v.to_python(u'first@example.com (Nur Winter); second@example.com') == u'first@example.com (Nur Winter); second@example.com' - assert v.from_python(None) == u'' - assert v.from_python(u'Nein') == u'Nein' - assert v.from_python(u'first@example.com') == u'first@example.com' - assert v.from_python(u'first@example.com (Nur Winter); second@example.com') == u'first@example.com (Nur Winter); second@example.com' - testvalue = u'abc.def(at)example.com (comment)' - try: - v.to_python(testvalue) - assert False - except formencode.Invalid: - pass - try: - v.from_python(testvalue) - assert False - except formencode.Invalid: - pass - v = wrpylib.wrvalidators.EmailCommentListNeinLoopNone(allow_masked_email=True) - assert v.to_python(testvalue) == testvalue - assert v.from_python(testvalue) == testvalue - - -# test_WikiPage - - -# test_WikiPageList - - -def test_WikiPageListLoopNone(): - v = wrpylib.wrvalidators.WikiPageListLoopNone() - assert v.to_python(u'') == None - assert v.to_python(u'[[Birgitzer Alm]]; [[Kemater Alm]]') == u'[[Birgitzer Alm]]; [[Kemater Alm]]' - assert v.from_python(None) == u'' - assert v.from_python(u'[[Birgitzer Alm]]; [[Kemater Alm]]') == u'[[Birgitzer Alm]]; [[Kemater Alm]]' - - -# test_TupleSecondValidator - - -def test_BoolUnicodeTupleValidator(): - v = wrpylib.wrvalidators.BoolUnicodeTupleValidator() - assert v.to_python(u'') == (None, None) - assert v.to_python(u'Nein') == (False, None) - assert v.to_python(u'any text') == (True, u'any text') - assert v.from_python((None, None)) == u'' - assert v.from_python((False, None)) == u'Nein' - assert v.from_python((True, u'any text')) == u'any text' - - - - -def test_GermanLift(): - v = wrpylib.wrvalidators.GermanLift() - assert v.to_python(u'') == (None, None) - assert v.to_python(u'Nein') == (False, None) - assert v.to_python(u'Sessellift (4 Euro)') == (True, u'Sessellift (4 Euro)') - assert v.from_python((None, None)) == u'' - assert v.from_python((False, None)) == u'Nein' - assert v.from_python((True, u'Sessellift (4 Euro)')) == u'Sessellift (4 Euro)' - - -def test_SledRental(): - v = wrpylib.wrvalidators.SledRental() - assert v.to_python(u'') == (None, None) - assert v.to_python(u'Nein') == (False, None) - assert v.to_python(u'Ja') == (True, u'Ja') - assert v.to_python(u'Talstation (nur mit Ticket); Schneealm') == (True, u'Talstation (nur mit Ticket); Schneealm') - assert v.from_python((None, None)) == u'' - assert v.from_python((False, None)) == u'Nein' - assert v.from_python((True, u'Talstation (nur mit Ticket); Schneealm')) == u'Talstation (nur mit Ticket); Schneealm' - assert v.from_python((True, u'Ja')) == u'Ja' - - -def test_RodelbahnboxDictValidator(): - v = wrpylib.wrvalidators.RodelbahnboxDictValidator() - other = collections.OrderedDict([ - (u'Position', u'47.309820 N 9.986508 E'), - (u'Position oben', u''), - (u'Höhe oben', u'1244'), - (u'Position unten', u''), - (u'Höhe unten', u'806'), - (u'Länge', u'5045'), - (u'Schwierigkeit', u''), - (u'Lawinen', u'gelegentlich'), - (u'Betreiber', u''), - (u'Öffentliche Anreise', u'Ja'), - (u'Aufstieg möglich', u'Ja'), - (u'Aufstieg getrennt', u'Nein'), - (u'Gehzeit', u'105'), - (u'Aufstiegshilfe', u'Nein'), - (u'Beleuchtungsanlage', u'Nein'), - (u'Beleuchtungstage', u''), - (u'Rodelverleih', u'Ja'), - (u'Gütesiegel', u''), - (u'Webauskunft', u''), - (u'Telefonauskunft', u'+43-664-1808482 (Bergkristallhütte)'), - (u'Bild', u'Rodelbahn Bergkristallhütte 2009-03-03.jpg'), - (u'In Übersichtskarte', u'Ja'), - (u'Forumid', u'72')]) - python = v.to_python(other, None) - other2 = v.from_python(python, None) - assert other == other2 - - -def test_GasthausboxDictValidator(): - v = wrpylib.wrvalidators.GasthausboxDictValidator() - other = collections.OrderedDict([ - (u'Position', u'47.295549 N 9.986970 E'), - (u'Höhe', u'1250'), - (u'Betreiber', u''), - (u'Sitzplätze', u''), - (u'Übernachtung', u''), - (u'Rauchfrei', u'Nein'), - (u'Rodelverleih', u''), - (u'Handyempfang', u'A1; T-Mobile/Telering'), - (u'Homepage', u'http://www.bergkristallhuette.com/'), - (u'E-Mail', u'bergkristallhuette@gmx.at'), - (u'Telefon', u'+43-664-1808482'), - (u'Bild', u'Bergkritsallhütte 2009-02-07.JPG'), - (u'Rodelbahnen', u'[[Bergkristallhütte]]')]) - python = v.to_python(other, None) - other2 = v.from_python(python, None) - assert other == other2 + def test_EmailCommentListNeinLoopNone(self): + v = wrpylib.wrvalidators.EmailCommentListNeinLoopNone() + assert v.to_python(u'') == None + assert v.to_python(u'Nein') == u'Nein' + assert v.to_python(u'first@example.com') == u'first@example.com' + assert v.to_python(u'first@example.com (Nur Winter); second@example.com') == u'first@example.com (Nur Winter); second@example.com' + assert v.from_python(None) == u'' + assert v.from_python(u'Nein') == u'Nein' + assert v.from_python(u'first@example.com') == u'first@example.com' + assert v.from_python(u'first@example.com (Nur Winter); second@example.com') == u'first@example.com (Nur Winter); second@example.com' + testvalue = u'abc.def(at)example.com (comment)' + try: + v.to_python(testvalue) + assert False + except formencode.Invalid: + pass + try: + v.from_python(testvalue) + assert False + except formencode.Invalid: + pass + v = wrpylib.wrvalidators.EmailCommentListNeinLoopNone(allow_masked_email=True) + assert v.to_python(testvalue) == testvalue + assert v.from_python(testvalue) == testvalue + + + # test_WikiPage + + + # test_WikiPageList + + + def test_WikiPageListLoopNone(self): + v = wrpylib.wrvalidators.WikiPageListLoopNone() + assert v.to_python(u'') == None + assert v.to_python(u'[[Birgitzer Alm]]; [[Kemater Alm]]') == u'[[Birgitzer Alm]]; [[Kemater Alm]]' + assert v.from_python(None) == u'' + assert v.from_python(u'[[Birgitzer Alm]]; [[Kemater Alm]]') == u'[[Birgitzer Alm]]; [[Kemater Alm]]' + + + # test_TupleSecondValidator + + + def test_BoolUnicodeTupleValidator(self): + v = wrpylib.wrvalidators.BoolUnicodeTupleValidator() + assert v.to_python(u'') == (None, None) + assert v.to_python(u'Nein') == (False, None) + assert v.to_python(u'any text') == (True, u'any text') + assert v.from_python((None, None)) == u'' + assert v.from_python((False, None)) == u'Nein' + assert v.from_python((True, u'any text')) == u'any text' + + + + + def test_GermanLift(self): + v = wrpylib.wrvalidators.GermanLift() + assert v.to_python(u'') == (None, None) + assert v.to_python(u'Nein') == (False, None) + assert v.to_python(u'Sessellift (4 Euro)') == (True, u'Sessellift (4 Euro)') + assert v.from_python((None, None)) == u'' + assert v.from_python((False, None)) == u'Nein' + assert v.from_python((True, u'Sessellift (4 Euro)')) == u'Sessellift (4 Euro)' + + + def test_SledRental(self): + v = wrpylib.wrvalidators.SledRental() + assert v.to_python(u'') == (None, None) + assert v.to_python(u'Nein') == (False, None) + assert v.to_python(u'Ja') == (True, u'Ja') + assert v.to_python(u'Talstation (nur mit Ticket); Schneealm') == (True, u'Talstation (nur mit Ticket); Schneealm') + assert v.from_python((None, None)) == u'' + assert v.from_python((False, None)) == u'Nein' + assert v.from_python((True, u'Talstation (nur mit Ticket); Schneealm')) == u'Talstation (nur mit Ticket); Schneealm' + assert v.from_python((True, u'Ja')) == u'Ja' + + + def test_RodelbahnboxDictValidator(self): + v = wrpylib.wrvalidators.RodelbahnboxDictValidator() + other = collections.OrderedDict([ + (u'Position', u'47.309820 N 9.986508 E'), + (u'Position oben', u''), + (u'Höhe oben', u'1244'), + (u'Position unten', u''), + (u'Höhe unten', u'806'), + (u'Länge', u'5045'), + (u'Schwierigkeit', u''), + (u'Lawinen', u'gelegentlich'), + (u'Betreiber', u''), + (u'Öffentliche Anreise', u'Ja'), + (u'Aufstieg möglich', u'Ja'), + (u'Aufstieg getrennt', u'Nein'), + (u'Gehzeit', u'105'), + (u'Aufstiegshilfe', u'Nein'), + (u'Beleuchtungsanlage', u'Nein'), + (u'Beleuchtungstage', u''), + (u'Rodelverleih', u'Ja'), + (u'Gütesiegel', u''), + (u'Webauskunft', u''), + (u'Telefonauskunft', u'+43-664-1808482 (Bergkristallhütte)'), + (u'Bild', u'Rodelbahn Bergkristallhütte 2009-03-03.jpg'), + (u'In Übersichtskarte', u'Ja'), + (u'Forumid', u'72')]) + python = v.to_python(other, None) + other2 = v.from_python(python, None) + assert other == other2 + + + def test_GasthausboxDictValidator(self): + v = wrpylib.wrvalidators.GasthausboxDictValidator() + other = collections.OrderedDict([ + (u'Position', u'47.295549 N 9.986970 E'), + (u'Höhe', u'1250'), + (u'Betreiber', u''), + (u'Sitzplätze', u''), + (u'Übernachtung', u''), + (u'Rauchfrei', u'Nein'), + (u'Rodelverleih', u''), + (u'Handyempfang', u'A1; T-Mobile/Telering'), + (u'Homepage', u'http://www.bergkristallhuette.com/'), + (u'E-Mail', u'bergkristallhuette@gmx.at'), + (u'Telefon', u'+43-664-1808482'), + (u'Bild', u'Bergkritsallhütte 2009-02-07.JPG'), + (u'Rodelbahnen', u'[[Bergkristallhütte]]')]) + python = v.to_python(other, None) + other2 = v.from_python(python, None) + assert other == other2