Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A simple library for a better dictionary comparison when testing code

Project description

Improved output for dictionaries comparison

What is it?

It is a very simple library aimed to developers which provides better output when comparing python dictionaries during tests.

How does it work?

The library uses the open source library deepdiff to check for dictionaries differences and parses its output for a more friendly set of error messages when an AssertionError is raised.

The library exposes a function, assert_dicts_equal, which should be used in tests when comparing a result dict object to an expected dict object.


Simply run:

$ pip install dictcomparator


For using the library in tests it is as simple as the following:

from dictcomparator import assert_dicts_equal

# dict_1 and dict_2 are the two dictionaries being compared
assert_dicts_equal(dict_1, dict_2)

If the dictionaries have any differences they will be detailed in the error messages of the AssertionError exception raised.


The library includes its own set of simple tests. You may run them using your favorite tests runner. For development nose was used as the test runner.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dictcomparator, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size dictcomparator-0.2.0-py2-none-any.whl (3.4 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size dictcomparator-0.2.0.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page