Skip to main content

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.

Installation

Simply run:

$ pip install dictcomparator

Usage

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.

Tests

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.

Source Distribution

dictcomparator-0.2.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

dictcomparator-0.2.0-py2-none-any.whl (3.4 kB view details)

Uploaded Python 2

File details

Details for the file dictcomparator-0.2.0.tar.gz.

File metadata

File hashes

Hashes for dictcomparator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3531fd4ee427dc10e7475d930878661feec5f7f41b1978e874871ff804f87b8f
MD5 01984649c80c244aa0bc2e804fb909f5
BLAKE2b-256 cf41aab4907f2ec9d23515fc6f7633303b6fca74e76a7a5007a87a2acffeb722

See more details on using hashes here.

File details

Details for the file dictcomparator-0.2.0-py2-none-any.whl.

File metadata

File hashes

Hashes for dictcomparator-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 eeb80deff6bea39332825b08f315fe439f958b77d17d39e74390d9fb0451a9df
MD5 f0cd16f1e58ca575b8518079acf03efc
BLAKE2b-256 6a069aa0ba2e97e8dd4316f2e1a35442d29050fd6584e7e1157c763d1c18fd44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page