'Checks whether dictionary is a superset of subset.'

def _assertDictContainsSubset(self, subset, dictionary, msg=None):

    missing = []
    mismatched = []
    for (key, value) in subset.items():
        if (key not in dictionary):
            missing.append(key)
        elif (value != dictionary[key]):
            mismatched.append(('%s,    expected:    %s,    actual:    %s' % (safe_repr(key), safe_repr(value), safe_repr(dictionary[key]))))
    if (not (missing or mismatched)):
        return
    standardMsg = ''
    if missing:
        standardMsg = ('Missing:    %s' % ','.join((safe_repr(m) for m in missing)))
    if mismatched:
        if standardMsg:
            standardMsg += ';    '
        standardMsg += ('Mismatched    values:    %s' % ','.join(mismatched))
    self.fail(self._formatMessage(msg, standardMsg))
