Added more tests to TestOptWikipageEnum.test_from_str (one of them doesn't pass yet).
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 27 Jan 2017 22:03:51 +0000 (22:03 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 27 Jan 2017 22:03:51 +0000 (22:03 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2602 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrvalidators.py

index 7f540bc9a176ac34c059e6c64d4e7a86a3b69407..2725b0e19093f810e1e9f5ffa2f4bf47f0fefd58 100644 (file)
@@ -397,6 +397,22 @@ class TestOptWikipageEnum(unittest.TestCase):
         self.assertEqual(['[[Birgitzer Alm]]'], opt_wikipage_enum_from_str('[[Birgitzer Alm]]'))
         self.assertEqual([], opt_wikipage_enum_from_str('Nein'))
         self.assertEqual(None, opt_wikipage_enum_from_str(''))
         self.assertEqual(['[[Birgitzer Alm]]'], opt_wikipage_enum_from_str('[[Birgitzer Alm]]'))
         self.assertEqual([], opt_wikipage_enum_from_str('Nein'))
         self.assertEqual(None, opt_wikipage_enum_from_str(''))
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('[[Birgitzer Alm')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('Birgitzer Alm]]')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('[Birgitzer Alm]')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('Birgitzer Alm')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('Birgitzer Alm; Kemater Alm')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('[[Birgitzer Alm; Kemater Alm]]')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('[[Birgitzer Alm]], [[Kemater Alm]]')
+        with self.assertRaises(ValueError):
+            opt_wikipage_enum_from_str('[[Birgitzer Alm]]; Kemater Alm')
 
     def test_to_str(self):
         self.assertEqual('[[Birgitzer Alm]]; [[Kemater Alm]]', opt_wikipage_enum_to_str(['[[Birgitzer Alm]]', '[[Kemater Alm]]']))
 
     def test_to_str(self):
         self.assertEqual('[[Birgitzer Alm]]; [[Kemater Alm]]', opt_wikipage_enum_to_str(['[[Birgitzer Alm]]', '[[Kemater Alm]]']))