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.
This commit is contained in:
Jonathan Kamens
2013-04-30 21:13:18 -04:00
parent 419c03dedb
commit 16e75a31d4
+2 -2
View File
@@ -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) + "]")