Added test_GermanPublicTransport.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 21 Apr 2013 11:30:38 +0000 (11:30 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 21 Apr 2013 11:30:38 +0000 (11:30 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@1372 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrvalidators.py

index b108a47278a7db78085145f30d8e4485849f2506..19fca40e7259363f3774e6ac88e3c5ae1421023c 100644 (file)
@@ -125,7 +125,23 @@ def test_GeoNone():
 # test_GermanAvalanches
 
 
 # test_GermanAvalanches
 
 
-# test_GermanPublicTransport
+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
+
+    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'
 
 
 # test_GermanTristateFloatComment
 
 
 # test_GermanTristateFloatComment