mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
281: Completed unit tests for Command.args
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user