From e7a5e097c419bed7816d3cd6c370b5171db37b33 Mon Sep 17 00:00:00 2001 From: Joe Jevnik Date: Tue, 18 Nov 2014 16:10:01 -0500 Subject: [PATCH] BUG: Explicitly guard against empty bar data in history container contstruction. BarData can be falsey. in create_buffer_panel, the intention of the check against bar_data was to see if it was passed at all, not if it was truthey. In order to make that check more explicit, the check now asserts that bar_data is not None. --- tests/test_history.py | 2 +- zipline/history/history_container.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_history.py b/tests/test_history.py index ab242661..8bc3842d 100644 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -22,7 +22,7 @@ import numpy as np import pandas as pd from pandas.util.testing import assert_frame_equal -from zipline.history import history, Frequency +from zipline.history import history from zipline.history.history_container import HistoryContainer from zipline.protocol import BarData import zipline.utils.factory as factory diff --git a/zipline/history/history_container.py b/zipline/history/history_container.py index e61d38d9..a71a52a6 100644 --- a/zipline/history/history_container.py +++ b/zipline/history/history_container.py @@ -594,7 +594,7 @@ class HistoryContainer(object): ) self.buffer_spec = spec - if bar_data: + if bar_data is not None: frame = self.frame_from_bardata(bar_data, initial_dt) rp.add_frame(initial_dt, frame)