diff --git a/tests/test_fetcher.py b/tests/test_fetcher.py index 4b5cc060..97330978 100644 --- a/tests/test_fetcher.py +++ b/tests/test_fetcher.py @@ -297,7 +297,6 @@ def handle_data(context, data): @parameterized.expand([("unspecified", ""), ("none", "usecols=None"), - ("empty", "usecols=[]"), ("without date", "usecols=['Value']"), ("with date", "usecols=('Value', 'Date')")]) def test_usecols(self, testname, usecols): @@ -325,30 +324,9 @@ def initialize(context): context.stocks = [sid(3766), sid(25317)] def handle_data(context, data): - if {should_have_data}: - try: - data.current("urban", "cpi") - except (KeyError, ValueError): - assert False - else: - try: - data.current("urban", "cpi") - except (KeyError, ValueError): - assert True + data.current("urban", "cpi") """ - - results = self.run_algo( - code.format( - usecols=usecols, - should_have_data=testname in [ - 'none', - 'unspecified', - 'without date', - 'with date', - ], - ) - ) - + results = self.run_algo(code.format(usecols=usecols)) # 251 trading days in 2006 self.assertEqual(len(results), 251) diff --git a/zipline/sources/requests_csv.py b/zipline/sources/requests_csv.py index ac35f49e..c1ba028b 100644 --- a/zipline/sources/requests_csv.py +++ b/zipline/sources/requests_csv.py @@ -224,7 +224,7 @@ class PandasCSV(with_metaclass(ABCMeta, object)): date_str_series.values, format=format_str, utc=True, - coerce=True, + errors='coerce', ) else: parsed = pd.to_datetime( @@ -301,7 +301,7 @@ class PandasCSV(with_metaclass(ABCMeta, object)): df['sid'] = self.symbol elif self.finder: - df.sort(self.symbol_column) + df.sort_values(by=self.symbol_column, inplace=True) # Pop the 'sid' column off of the DataFrame, just in case the user # has assigned it, and throw a warning