From b403fd822b76a7deffe8110fbeb7993ef3cac3a5 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 14 Aug 2008 17:21:21 +0000 Subject: 159: Added plugable.DictProxy class; added corresponding unit tests; added setitem(), delitem() functions to tstutil --- ipalib/tests/tstutil.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ipalib/tests/tstutil.py') diff --git a/ipalib/tests/tstutil.py b/ipalib/tests/tstutil.py index 7b3a2d5e..79e8ae38 100644 --- a/ipalib/tests/tstutil.py +++ b/ipalib/tests/tstutil.py @@ -60,6 +60,22 @@ def getitem(obj, key): return obj[key] +def setitem(obj, key, value): + """ + Works like setattr but for dictionary interface. Uses this in combination + with raises() to test that, for example, TypeError is raised. + """ + obj[key] = value + + +def delitem(obj, key): + """ + Works like delattr but for dictionary interface. Uses this in combination + with raises() to test that, for example, TypeError is raised. + """ + del obj[key] + + def no_set(obj, name, value='some_new_obj'): """ Tests that attribute cannot be set. -- cgit