changeset 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 1ff7cb6c381b
children b971703ee4a9
files MoinMoin/_tests/test_wikiutil.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
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):