Git Product home page Git Product logo

dict_comparator's Introduction

DictComparator

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.