@assert_equal.register(dict, dict)
def assert_dict_equal(result, expected, path=(), **kwargs):
    if path is None:
        path = ()

    result_keys = viewkeys(result)
    expected_keys = viewkeys(expected)
    if result_keys != expected_keys:
        if result_keys > expected_keys:
            diff = result_keys - expected_keys
            msg = 'extra %s in result: %r' % (_s('key', diff), diff)
        elif result_keys < expected_keys:
            diff = expected_keys - result_keys
            msg = 'result is missing %s: %r' % (_s('key', diff), diff)
        else:
            sym = result_keys ^ expected_keys
            in_result = sym - expected_keys
            in_expected = sym - result_keys
            msg = '%s only in result: %s\n%s only in expected: %s' % (
                _s('key', in_result),
                in_result,
                _s('key', in_expected),
                in_expected,
            )
        raise AssertionError(
            'dict keys do not match\n%s\n%s' % (
                msg,
                _fmt_path(path + ('.%s()' % ('viewkeys' if PY2 else 'keys'),)),
            ),
        )

    failures = []
    for k, (resultv, expectedv) in iteritems(dzip_exact(result, expected)):
        try:
            assert_equal(
                resultv,
                expectedv,
                path=path + ('[%r]' % k,),
                **kwargs
            )
        except __HOLE__ as e:
            failures.append(str(e))

    if failures:
        raise AssertionError('\n'.join(failures))
dataset/ETHPy150Open quantopian/zipline/zipline/testing/predicates.py/assert_dict_equal