diff options
-rw-r--r-- | ipalib/frontend.py | 3 | ||||
-rw-r--r-- | ipalib/tests/test_frontend.py | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index a880adf6..f6626973 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -134,8 +134,9 @@ class Param(plugable.ReadOnly): kw.update(kw_from_spec) default = dict(self.__default) if not set(default).issuperset(kw): + extra = sorted(set(kw) - set(default)) raise TypeError( - 'no such kwargs: %r' % list(set(kw) - set(default)) + 'Param.__init__() takes no such kwargs: %s' % ', '.join(extra) ) default.update(kw) self.__kw = default diff --git a/ipalib/tests/test_frontend.py b/ipalib/tests/test_frontend.py index 8b4df3bb..43c1abf2 100644 --- a/ipalib/tests/test_frontend.py +++ b/ipalib/tests/test_frontend.py @@ -169,6 +169,10 @@ class test_Param(ClassChecker): assert o.required is True assert o.multivalue is True + e = raises(TypeError, self.cls, name, whatever=True, another=False) + assert str(e) == \ + 'Param.__init__() takes no such kwargs: another, whatever' + def test_convert(self): """ Test the `frontend.Param.convert` method. |