From e8f6b43f2bbd11404d8d6ba24d2d898b8d50b8e5 Mon Sep 17 00:00:00 2001 From: Richard Frank Date: Mon, 15 Apr 2013 16:54:47 -0400 Subject: [PATCH] TST: When comparing dicts, ensure they have the same keys. dict 'b' might have more keys. --- zipline/utils/test_utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zipline/utils/test_utils.py b/zipline/utils/test_utils.py index 42a5f00e..32de1d00 100644 --- a/zipline/utils/test_utils.py +++ b/zipline/utils/test_utils.py @@ -26,10 +26,8 @@ def check_list(test, a, b, label): def check_dict(test, a, b, label): test.assertTrue(isinstance(a, dict)) test.assertTrue(isinstance(b, dict)) - for key in a.keys(): - - test.assertTrue(key in a, "missing key at: " + label + "." + key) - test.assertTrue(key in b, "missing key at: " + label + "." + key) + test.assertEqual(sorted(a), sorted(b), "different keys at: " + label) + for key in a: a_val = a[key] b_val = b[key] check(test, a_val, b_val, label + "." + key)