diff MoinMoin/_tests/test_wikiutil.py @ 2548:5db66a25f0ba

introduce required_arg wrapper class
author Johannes Berg <johannes AT sipsolutions DOT net>
date Mon, 23 Jul 2007 19:43:40 +0200
parents c2ef5800253f
children 2523642e9516
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Mon Jul 23 19:38:16 2007 +0200
+++ b/MoinMoin/_tests/test_wikiutil.py	Mon Jul 23 19:43:40 2007 +0200
@@ -506,6 +506,9 @@
     def _test_invoke_float_None(self, i=float):
         assert i == 1.4 or i is None
 
+    def _test_invoke_float_required(self, i=wikiutil.required_arg(float)):
+        assert i == 1.4
+
     def _test_invoke_choice(self, a, choice=[u'a', u'b', u'c']):
         assert a == 7
         assert choice == u'a'
@@ -576,5 +579,11 @@
             [{u'7 \xc3': 'test', 'test': u'x'}])
         ief(self.request, self._test_arbitrary_kw, u'7 \xc3=test, test= x ',
             [{u'7 \xc3': 'test', 'test': u'x'}])
+        py.test.raises(ValueError, ief, self.request,
+                       self._test_invoke_float_required, u'')
+        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_float_required, u',')
 
 coverage_modules = ['MoinMoin.wikiutil']