diff MoinMoin/_tests/test_wikiutil.py @ 3371:8ac95a64f1a8

really make required_arg take choices (including test)
author Johannes Berg <johannes AT sipsolutions DOT net>
date Thu, 20 Mar 2008 21:42:32 +0100
parents c538d9029186
children b6d727809985
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Thu Mar 20 21:39:55 2008 +0100
+++ b/MoinMoin/_tests/test_wikiutil.py	Thu Mar 20 21:42:32 2008 +0100
@@ -540,6 +540,9 @@
         assert a == 7
         assert choice == u'a'
 
+    def _test_invoke_choice_required(self, i=wikiutil.required_arg((u'b', u'a'))):
+        assert i == u'a'
+
     def _test_trailing(self, a, _trailing_args=[]):
         assert _trailing_args == [u'a']
 
@@ -616,6 +619,10 @@
         ief(self.request, self._test_invoke_float_required, u'1.4')
         ief(self.request, self._test_invoke_float_required, u'i=1.4')
         py.test.raises(ValueError, ief, self.request,
+                       self._test_invoke_choice_required, u'')
+        ief(self.request, self._test_invoke_choice_required, u'a')
+        ief(self.request, self._test_invoke_choice_required, u'i=a')
+        py.test.raises(ValueError, ief, self.request,
                        self._test_invoke_float_required, u',')
 
     def testConstructors(self):