From 2d85a6daa3798ee5feda1b2bda33300b73bed615 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 10 Sep 2008 14:54:01 +0000 Subject: 281: Completed unit tests for Command.args --- ipalib/tests/test_public.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ipalib/tests/test_public.py') 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. -- cgit