Skip to content

Commit

Permalink
TST: When comparing dicts, ensure they have the same keys.
Browse files Browse the repository at this point in the history
dict 'b' might have more keys.
  • Loading branch information
richafrank committed Apr 15, 2013
1 parent d487401 commit e8f6b43
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions zipline/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e8f6b43

Please sign in to comment.