MCPcopy Index your code
hub / github.com/python/cpython / assertDictEqual

Method assertDictEqual

Lib/unittest/case.py:1214–1224  ·  view source on GitHub ↗
(self, d1, d2, msg=None)

Source from the content-addressed store, hash-verified

1212 self.fail(self._formatMessage(msg, standardMsg))
1213
1214 def assertDictEqual(self, d1, d2, msg=None):
1215 self.assertIsInstance(d1, dict, 'First argument is not a dictionary')
1216 self.assertIsInstance(d2, dict, 'Second argument is not a dictionary')
1217
1218 if d1 != d2:
1219 standardMsg = '%s != %s' % _common_shorten_repr(d1, d2)
1220 diff = ('\n' + '\n'.join(difflib.ndiff(
1221 pprint.pformat(d1).splitlines(),
1222 pprint.pformat(d2).splitlines())))
1223 standardMsg = self._truncateMessage(standardMsg, diff)
1224 self.fail(self._formatMessage(msg, standardMsg))
1225
1226 def assertCountEqual(self, first, second, msg=None):
1227 """Asserts that two iterables have the same elements, the same number of

Calls 8

assertIsInstanceMethod · 0.95
_truncateMessageMethod · 0.95
failMethod · 0.95
_formatMessageMethod · 0.95
_common_shorten_reprFunction · 0.85
pformatMethod · 0.80
joinMethod · 0.45
splitlinesMethod · 0.45