1. Marcin Kasperski
  2. dict_compare


dict_compare /

Filename Size Date modified Message
40 B
856 B
94 B
796 B
5.7 KB
1.4 KB


dict_compare compares two python dictionaries and reports on any differences between them.

This can be very handy when comparing dictionary structures. Typical case is comparing expected and received values in a unittest.

The typical use case is:

import unittest
from dict_compare import dict_compare

class TestSample(unittest.TestCase):
    def test_someExample(self):
        expected_dict = {
            'foo': 'bar',
            'quux': ['some', 'more']
        received_dict = {
            'foo': 'bar',
            'quux': ['some', 'other']
        self.assertTrue( dict_compare(expected_dict, received_dict, reporter=self.fail) )

if __name__ == '__main__':

Have fun!