mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 05:39:30 +08:00
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:
@@ -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) + "]")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user