From 88b98811454d5d94ff34c0ec0b2cd4c1bed1d658 Mon Sep 17 00:00:00 2001 From: Richard Frank Date: Wed, 12 Jun 2013 14:02:38 -0400 Subject: [PATCH] TST: Include the label in the failure message of isinstance asserts --- zipline/utils/test_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zipline/utils/test_utils.py b/zipline/utils/test_utils.py index 4642003b..4330bffd 100644 --- a/zipline/utils/test_utils.py +++ b/zipline/utils/test_utils.py @@ -17,15 +17,15 @@ def teardown_logger(test): def check_list(test, a, b, label): - test.assertTrue(isinstance(a, (list, blist.blist))) - test.assertTrue(isinstance(b, (list, blist.blist))) + test.assertIsInstance(a, (list, blist.blist), "not list at: " + label) + test.assertIsInstance(b, (list, blist.blist), "not list at: " + label) for i, (a_val, b_val) in enumerate(izip_longest(a, b)): check(test, a_val, b_val, label + "[" + str(i) + "]") def check_dict(test, a, b, label): - test.assertTrue(isinstance(a, dict)) - test.assertTrue(isinstance(b, dict)) + test.assertIsInstance(a, dict, "not dict at: " + label) + test.assertIsInstance(b, dict, "not dict at: " + label) test.assertEqual(sorted(a), sorted(b), "different keys at: " + label) for key in a: a_val = a[key] @@ -34,8 +34,8 @@ def check_dict(test, a, b, label): def check_datetime(test, a, b, label): - test.assertTrue(isinstance(a, datetime)) - test.assertTrue(isinstance(b, datetime)) + test.assertIsInstance(a, datetime, "not datetime at: " + label) + test.assertIsInstance(b, datetime, "not datetime at: " + label) test.assertEqual(EPOCH(a), EPOCH(b), "mismatched dates " + label)