summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/tests/test_public.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 2c9fbce8..7c9a0244 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -422,11 +422,19 @@ class test_Command(ClassChecker):
assert ns.source.required is False
assert ns.source.multivalue is False
- # Test type error:
+ # Test TypeError:
e = raises(TypeError, self.__get_instance, args=(u'whatever',))
assert str(e) == \
'arg: need %r or %r; got %r' % (str, public.Option, u'whatever')
+ # Test ValueError, required after optional:
+ e = raises(ValueError, self.__get_instance, args=('arg1?', 'arg2'))
+ assert str(e) == 'arg2: required argument after optional'
+
+ # Test ValueError, scalar after multivalue:
+ e = raises(ValueError, self.__get_instance, args=('arg1+', 'arg2'))
+ assert str(e) == 'arg2: only final argument can be multivalue'
+
def test_Option(self):
"""
Tests the `public.Command.Option` property.