diff MoinMoin/_tests/test_wikiutil.py @ 3259:c538d9029186

test_wikiutil: testUnitArgument added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 15 Mar 2008 19:58:03 +0100
parents 2bbf611f4f2c
children 8ac95a64f1a8
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Fri Mar 14 18:07:32 2008 +0100
+++ b/MoinMoin/_tests/test_wikiutil.py	Sat Mar 15 19:58:03 2008 +0100
@@ -319,6 +319,13 @@
             for val in result:
                 assert val is None or isinstance(val, unicode)
 
+    def testUnitArgument(self):
+        result = wikiutil.UnitArgument('7mm', float, ['%', 'mm'])
+        assert result.get_default() ==  (7.0, 'mm')
+        assert result.parse_argument('8%') == (8.0, '%')
+        py.test.raises(ValueError, result.parse_argument,  u'7m')
+        py.test.raises(ValueError, result.parse_argument,  u'7')
+        py.test.raises(ValueError, result.parse_argument,  u'mm')
 
 class TestArgGetters:
     def testGetBoolean(self):