From 16e75a31d48c19d1fa8d5a04674d4eda23d0be21 Mon Sep 17 00:00:00 2001 From: Jonathan Kamens Date: Tue, 30 Apr 2013 21:13:18 -0400 Subject: [PATCH] TST: Fix check() test utility function to detect all list differences The check() function in zipline.utils.test_utils was only comparing lists up to the length of the shortest list. This fix uses izip_longest instead of izip so it compares up to the length of the longest list, which among other things means that it will now correctly report when one list is empty and the other is not. --- zipline/utils/test_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zipline/utils/test_utils.py b/zipline/utils/test_utils.py index 5c674389..149c5a5d 100644 --- a/zipline/utils/test_utils.py +++ b/zipline/utils/test_utils.py @@ -1,7 +1,7 @@ from datetime import datetime import blist from zipline.utils.date_utils import EPOCH -from itertools import izip +from itertools import izip_longest from logbook import FileHandler from zipline.finance.blotter import ORDER_STATUS @@ -19,7 +19,7 @@ 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))) - for i, (a_val, b_val) in enumerate(izip(a, b)): + for i, (a_val, b_val) in enumerate(izip_longest(a, b)): check(test, a_val, b_val, label + "[" + str(i) + "]")