281: Completed unit tests for Command.args

This commit is contained in:
Jason Gerard DeRose
2008-09-10 14:54:01 +00:00
parent cbfacf7c2e
commit 2d85a6daa3

View File

@@ -422,11 +422,19 @@ class test_Command(ClassChecker):
assert ns.source.required is False assert ns.source.required is False
assert ns.source.multivalue is False assert ns.source.multivalue is False
# Test type error: # Test TypeError:
e = raises(TypeError, self.__get_instance, args=(u'whatever',)) e = raises(TypeError, self.__get_instance, args=(u'whatever',))
assert str(e) == \ assert str(e) == \
'arg: need %r or %r; got %r' % (str, public.Option, u'whatever') '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): def test_Option(self):
""" """
Tests the `public.Command.Option` property. Tests the `public.Command.Option` property.