diff options
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/plugable.py | 1 | ||||
-rw-r--r-- | ipalib/tests/test_plugable.py | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 66cb18fe5..ffef8d643 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -484,6 +484,7 @@ class DictProxy(ReadOnly): """ :param d: The ``dict`` instance to proxy. """ + assert type(d) is dict, '`d` must be %r, got %r' % (dict, type(d)) self.__d = d self.__lock__() assert self.__islocked__() diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index 5c907dc7a..2854ee6a6 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -461,6 +461,8 @@ class test_DictProxy(ClassChecker): def test_class(self): assert self.cls.__bases__ == (plugable.ReadOnly,) + for non_dict in ('hello', 69, object): + raises(AssertionError, self.cls, non_dict) def test_DictProxy(self): cnt = 10 |