TEST: Don't mask unexpected exceptions from TALIB.

We know when we expect the error to be raised.
This commit is contained in:
Scott Sanderson
2016-05-13 14:32:21 -04:00
parent 2f90665676
commit c4b69d6223
+5 -5
View File
@@ -72,17 +72,17 @@ class BollingerBandsTestCase(WithTechnicalFactor, ZiplineTestCase):
middle_cols = []
upper_cols = []
for n in range(self.nassets):
try:
close_col = closes[:, n]
if np.isnan(close_col).all():
# ta-lib doesn't deal well with all nans.
upper, middle, lower = [np.full(self.ndays, np.nan)] * 3
else:
upper, middle, lower = talib.BBANDS(
closes[:, n],
window_length,
k,
k,
)
except Exception:
# If the input array is all nan then talib raises an instance
# of Exception.
upper, middle, lower = [np.full(self.ndays, np.nan)] * 3
upper_cols.append(upper)
middle_cols.append(middle)