diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-07-19 12:57:39 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-07-19 12:57:39 +0100 |
commit | ef2188c1bfd532ddc2e4c1acb533b422afde6c57 (patch) | |
tree | a9483e827cfabebcbb422c9a6426b53f928f3d31 /tests/unittest.py | |
parent | d24e9b285fd8d602c3b12c6ba589da0dd2cddee3 (diff) |
Imported Upstream version 0.33.0
Diffstat (limited to 'tests/unittest.py')
-rw-r--r-- | tests/unittest.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unittest.py b/tests/unittest.py index b25f2db5..b15b0672 100644 --- a/tests/unittest.py +++ b/tests/unittest.py @@ -109,6 +109,17 @@ class TestCase(unittest.TestCase): except AssertionError as e: raise (type(e))(e.message + " for '.%s'" % key) + def assert_dict(self, required, actual): + """Does a partial assert of a dict. + + Args: + required (dict): The keys and value which MUST be in 'actual'. + actual (dict): The test result. Extra keys will not be checked. + """ + for key in required: + self.assertEquals(required[key], actual[key], + msg="%s mismatch. %s" % (key, actual)) + def DEBUG(target): """A decorator to set the .loglevel attribute to logging.DEBUG. |