summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index aac962b5..578332ea 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -584,6 +584,21 @@ class test_Command(ClassChecker):
e = raises(errors.ArgumentError, o.group_args, 1)
assert str(e) == 'example takes at least 2 arguments'
+ def test_args_to_kw(self):
+ o = self.__get_instance(args=('one', 'two?'))
+ assert o.args_to_kw(1) == dict(one=1)
+ assert o.args_to_kw(1, 2) == dict(one=1, two=2)
+
+ o = self.__get_instance(args=('one', 'two*'))
+ assert o.args_to_kw(1) == dict(one=1)
+ assert o.args_to_kw(1, 2) == dict(one=1, two=(2,))
+ assert o.args_to_kw(1, 2, 3) == dict(one=1, two=(2, 3))
+
+ o = self.__get_instance(args=('one', 'two+'))
+ assert o.args_to_kw(1) == dict(one=1)
+ assert o.args_to_kw(1, 2) == dict(one=1, two=(2,))
+ assert o.args_to_kw(1, 2, 3) == dict(one=1, two=(2, 3))
+
class test_Object(ClassChecker):
"""