TST: fix data tests

This commit is contained in:
Joe Jevnik
2016-06-15 19:52:32 -04:00
committed by LotannaEzenwa
parent ef4eafbbb8
commit e8728c0cd4
6 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -303,7 +303,7 @@ class BundleCoreTestCase(WithInstanceTmpDir, ZiplineTestCase):
output_dir):
_wrote_to.append(output_dir)
_wrote_to.clear()
_wrote_to[:] = []
self.ingest('bundle', environ=self.environ)
assert_equal(len(_wrote_to), 1, msg='ingest was called more than once')
ingestions = self._list_bundle()
+3
View File
@@ -1,3 +1,5 @@
from __future__ import division
import numpy as np
import pandas as pd
from six.moves.urllib.parse import urlparse, parse_qs
@@ -201,4 +203,5 @@ class YahooBundleTestCase(WithResponses, ZiplineTestCase):
adjustments,
expected,
msg=column,
decimal=4,
)
+1 -1
View File
@@ -212,7 +212,7 @@ cpdef _read_bcolz_data(ctable_t table,
carray[first_row:last_row + 1]
else:
continue
if column_name in {'open', 'high', 'low', 'close'}:
where_nan = (outbuf == 0)
outbuf_as_float = outbuf.astype(float64) * .001
+5 -3
View File
@@ -356,10 +356,12 @@ def _make_bundle_core():
asset_db_path(name, timestr, environ=environ),
)).path,
)
wf = stack.enter_context(working_file(
adjustment_db_path(name, timestr, environ=environ),
))
wf.close() # we need to close the file to delete it on windows
adjustment_db_writer = SQLiteAdjustmentWriter(
stack.enter_context(working_file(
adjustment_db_path(name, timestr, environ=environ),
)).path,
wf.path,
BcolzDailyBarReader(daily_bars_path),
bundle.calendar,
overwrite=True,
+4 -1
View File
@@ -258,7 +258,10 @@ def gen_symbol_data(api_key,
_update_splits(splits, asset_id, raw_data)
_update_dividends(dividends, asset_id, raw_data)
raw_data = raw_data.reindex(calendar, copy=False).fillna(0.0)
raw_data = raw_data.reindex(
calendar.tz_localize(None),
copy=False,
).fillna(0.0)
yield asset_id, raw_data
if should_sleep:
+1 -2
View File
@@ -15,7 +15,6 @@ from abc import ABCMeta, abstractmethod, abstractproperty
from errno import ENOENT
from functools import partial
from os import remove
from os.path import exists
import sqlite3
import warnings
@@ -875,7 +874,7 @@ class SQLiteAdjustmentWriter(object):
if isinstance(conn_or_path, sqlite3.Connection):
self.conn = conn_or_path
elif isinstance(conn_or_path, str):
if overwrite and exists(conn_or_path):
if overwrite:
try:
remove(conn_or_path)
except OSError as e: