160: DictProxy now checks type of d in __init__(); updated unit tests

This commit is contained in:
Jason Gerard DeRose
2008-08-14 17:29:13 +00:00
parent b403fd822b
commit 87cad5078a
2 changed files with 3 additions and 0 deletions

View File

@@ -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__()

View File

@@ -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