MCPcopy Index your code
hub / github.com/bugy/script-server / assert_large_dict_equal

Function assert_large_dict_equal

src/tests/test_utils.py:418–451  ·  view source on GitHub ↗
(expected, actual, testcase)

Source from the content-addressed store, hash-verified

416
417
418def assert_large_dict_equal(expected, actual, testcase):
419 if len(expected) < 20 and len(actual) < 20:
420 testcase.assertEqual(expected, actual)
421 return
422
423 if expected == actual:
424 return
425
426 diff_expected = {}
427 diff_actual = {}
428 too_large_diff = False
429
430 all_keys = set()
431 all_keys.update(expected.keys())
432 all_keys.update(actual.keys())
433 for key in all_keys:
434 expected_value = expected.get(key)
435 actual_value = actual.get(key)
436
437 if expected_value == actual_value:
438 continue
439
440 diff_expected[key] = expected_value
441 diff_actual[key] = actual_value
442
443 if len(diff_expected) >= 50:
444 too_large_diff = True
445 break
446
447 message = 'Showing only different elements'
448 if too_large_diff:
449 message += ' (limited to 50)'
450
451 testcase.assertEqual(diff_expected, diff_actual, message)
452
453
454def wait_observable_close_notification(observable, timeout):

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected