diff --git a/catalyst/testing/__init__.py b/catalyst/testing/__init__.py index 1aa3871c..e9176b37 100644 --- a/catalyst/testing/__init__.py +++ b/catalyst/testing/__init__.py @@ -55,4 +55,4 @@ from .core import ( # noqa write_bcolz_minute_data, write_compressed, ) -from .fixtures import ZiplineTestCase # noqa +from .fixtures import CatalystTestCase # noqa diff --git a/catalyst/testing/core.py b/catalyst/testing/core.py index 7cf83444..de25aae1 100644 --- a/catalyst/testing/core.py +++ b/catalyst/testing/core.py @@ -643,7 +643,7 @@ def create_data_portal_from_trade_history(asset_finder, trading_calendar, return DataPortal( asset_finder, trading_calendar, first_trading_day=equity_daily_reader.first_trading_day, - equity_daily_reader=equity_daily_reader, + daily_reader=equity_daily_reader, ) else: minutes = trading_calendar.minutes_in_range( diff --git a/catalyst/testing/fixtures.py b/catalyst/testing/fixtures.py index cd3c9b6c..56a0b4b1 100644 --- a/catalyst/testing/fixtures.py +++ b/catalyst/testing/fixtures.py @@ -62,7 +62,7 @@ from catalyst.utils.paths import ensure_directory catalyst_dir = os.path.dirname(catalyst.__file__) -class ZiplineTestCase(with_metaclass(FinalMeta, TestCase)): +class CatalystTestCase(with_metaclass(FinalMeta, TestCase)): """ Shared extensions to core unittest.TestCase. @@ -92,7 +92,7 @@ class ZiplineTestCase(with_metaclass(FinalMeta, TestCase)): cls._base_init_fixtures_was_called = False cls.init_class_fixtures() assert cls._base_init_fixtures_was_called, ( - "ZiplineTestCase.init_class_fixtures() was not called.\n" + "CatalystTestCase.init_class_fixtures() was not called.\n" "This probably means that you overrode init_class_fixtures" " without calling super()." ) @@ -170,7 +170,7 @@ class ZiplineTestCase(with_metaclass(FinalMeta, TestCase)): self._init_instance_fixtures_was_called = False self.init_instance_fixtures() assert self._init_instance_fixtures_was_called, ( - "ZiplineTestCase.init_instance_fixtures() was not" + "CatalystTestCase.init_instance_fixtures() was not" " called.\n" "This probably means that you overrode" " init_instance_fixtures without calling super()." @@ -251,7 +251,7 @@ def alias(attr_name): class WithDefaultDateBounds(object): """ - ZiplineTestCase mixin which makes it possible to synchronize date bounds + CatalystTestCase mixin which makes it possible to synchronize date bounds across fixtures. This fixture should always be the last fixture in bases of any fixture or @@ -264,13 +264,13 @@ class WithDefaultDateBounds(object): The date bounds to be used for fixtures that want to have consistent dates. """ - START_DATE = pd.Timestamp('2006-01-03', tz='utc') - END_DATE = pd.Timestamp('2006-12-29', tz='utc') + START_DATE = pd.Timestamp('2016-01-03', tz='utc') + END_DATE = pd.Timestamp('2016-12-29', tz='utc') class WithLogger(object): """ - ZiplineTestCase mixin providing cls.log_handler as an instance-level + CatalystTestCase mixin providing cls.log_handler as an instance-level fixture. After init_instance_fixtures has been called `self.log_handler` will be a @@ -295,7 +295,7 @@ class WithLogger(object): class WithAssetFinder(WithDefaultDateBounds): """ - ZiplineTestCase mixin providing cls.asset_finder as a class-level fixture. + CatalystTestCase mixin providing cls.asset_finder as a class-level fixture. After init_class_fixtures has been called, `cls.asset_finder` is populated with an AssetFinder. @@ -402,7 +402,7 @@ class WithAssetFinder(WithDefaultDateBounds): class WithTradingCalendars(object): """ - ZiplineTestCase mixin providing cls.trading_calendar, + CatalystTestCase mixin providing cls.trading_calendar, cls.all_trading_calendars, cls.trading_calendar_for_asset_type as a class-level fixture. @@ -423,7 +423,7 @@ class WithTradingCalendars(object): with that asset type. """ TRADING_CALENDAR_STRS = ('NYSE',) - TRADING_CALENDAR_FOR_ASSET_TYPE = {Equity: 'NYSE', Future: 'us_futures'} + TRADING_CALENDAR_FOR_ASSET_TYPE = {Equity: 'NYSE', Future: 'us_futures', } TRADING_CALENDAR_FOR_EXCHANGE = {} # For backwards compatibility, exisitng tests and fixtures refer to # `trading_calendar` with the assumption that the value is the NYSE @@ -460,7 +460,7 @@ class WithTradingEnvironment(WithAssetFinder, WithTradingCalendars, WithDefaultDateBounds): """ - ZiplineTestCase mixin providing cls.env as a class-level fixture. + CatalystTestCase mixin providing cls.env as a class-level fixture. After ``init_class_fixtures`` has been called, `cls.env` is populated with a trading environment whose `asset_finder` is the result of @@ -560,7 +560,7 @@ class WithTradingEnvironment(WithAssetFinder, class WithSimParams(WithTradingEnvironment): """ - ZiplineTestCase mixin providing cls.sim_params as a class level fixture. + CatalystTestCase mixin providing cls.sim_params as a class level fixture. The arguments used to construct the trading environment may be overridded by putting ``SIM_PARAMS_{argname}`` in the class dict except for the @@ -615,7 +615,7 @@ class WithSimParams(WithTradingEnvironment): class WithTradingSessions(WithTradingCalendars, WithDefaultDateBounds): """ - ZiplineTestCase mixin providing cls.trading_days, cls.all_trading_sessions + CatalystTestCase mixin providing cls.trading_days, cls.all_trading_sessions as a class-level fixture. After init_class_fixtures has been called, `cls.all_trading_sessions` @@ -668,7 +668,7 @@ class WithTradingSessions(WithTradingCalendars, WithDefaultDateBounds): class WithTmpDir(object): """ - ZiplineTestCase mixing providing cls.tmpdir as a class-level fixture. + CatalystTestCase mixing providing cls.tmpdir as a class-level fixture. After init_class_fixtures has been called, `cls.tmpdir` is populated with a `testfixtures.TempDirectory` object whose path is `cls.TMP_DIR_PATH`. @@ -691,7 +691,7 @@ class WithTmpDir(object): class WithInstanceTmpDir(object): """ - ZiplineTestCase mixing providing self.tmpdir as an instance-level fixture. + CatalystTestCase mixing providing self.tmpdir as an instance-level fixture. After init_instance_fixtures has been called, `self.tmpdir` is populated with a `testfixtures.TempDirectory` object whose path is @@ -714,7 +714,7 @@ class WithInstanceTmpDir(object): class WithEquityDailyBarData(WithTradingEnvironment): """ - ZiplineTestCase mixin providing cls.make_equity_daily_bar_data. + CatalystTestCase mixin providing cls.make_equity_daily_bar_data. Attributes ---------- @@ -810,7 +810,7 @@ class WithEquityDailyBarData(WithTradingEnvironment): class WithBcolzEquityDailyBarReader(WithEquityDailyBarData, WithTmpDir): """ - ZiplineTestCase mixin providing cls.bcolz_daily_bar_path, + CatalystTestCase mixin providing cls.bcolz_daily_bar_path, cls.bcolz_daily_bar_ctable, and cls.bcolz_equity_daily_bar_reader class level fixtures. @@ -895,7 +895,7 @@ class WithBcolzEquityDailyBarReader(WithEquityDailyBarData, WithTmpDir): class WithBcolzEquityDailyBarReaderFromCSVs(WithBcolzEquityDailyBarReader): """ - ZiplineTestCase mixin that provides + CatalystTestCase mixin that provides cls.bcolz_equity_daily_bar_reader from a mapping of sids to CSV file paths. """ @@ -925,7 +925,7 @@ class _WithMinuteBarDataBase(WithTradingEnvironment): class WithEquityMinuteBarData(_WithMinuteBarDataBase): """ - ZiplineTestCase mixin providing cls.equity_minute_bar_days. + CatalystTestCase mixin providing cls.equity_minute_bar_days. After init_class_fixtures has been called: - `cls.equity_minute_bar_days` has the range over which data has been @@ -984,7 +984,7 @@ class WithEquityMinuteBarData(_WithMinuteBarDataBase): class WithFutureMinuteBarData(_WithMinuteBarDataBase): """ - ZiplineTestCase mixin providing cls.future_minute_bar_days. + CatalystTestCase mixin providing cls.future_minute_bar_days. After init_class_fixtures has been called: - `cls.future_minute_bar_days` has the range over which data has been @@ -1044,7 +1044,7 @@ class WithFutureMinuteBarData(_WithMinuteBarDataBase): class WithBcolzEquityMinuteBarReader(WithEquityMinuteBarData, WithTmpDir): """ - ZiplineTestCase mixin providing cls.bcolz_minute_bar_path, + CatalystTestCase mixin providing cls.bcolz_minute_bar_path, cls.bcolz_minute_bar_ctable, and cls.bcolz_equity_minute_bar_reader class level fixtures. @@ -1103,7 +1103,7 @@ class WithBcolzEquityMinuteBarReader(WithEquityMinuteBarData, WithTmpDir): class WithBcolzFutureMinuteBarReader(WithFutureMinuteBarData, WithTmpDir): """ - ZiplineTestCase mixin providing cls.bcolz_minute_bar_path, + CatalystTestCase mixin providing cls.bcolz_minute_bar_path, cls.bcolz_minute_bar_ctable, and cls.bcolz_equity_minute_bar_reader class level fixtures. @@ -1227,7 +1227,7 @@ class WithConstantFutureMinuteBarData(WithFutureMinuteBarData): class WithAdjustmentReader(WithBcolzEquityDailyBarReader): """ - ZiplineTestCase mixin providing cls.adjustment_reader as a class level + CatalystTestCase mixin providing cls.adjustment_reader as a class level fixture. After init_class_fixtures has been called, `cls.adjustment_reader` will be @@ -1359,7 +1359,7 @@ class WithEquityPricingPipelineEngine(WithAdjustmentReader, class WithSeededRandomPipelineEngine(WithTradingSessions, WithAssetFinder): """ - ZiplineTestCase mixin providing class-level fixtures for running pipelines + CatalystTestCase mixin providing class-level fixtures for running pipelines against deterministically-generated random data. Attributes @@ -1434,7 +1434,7 @@ class WithDataPortal(WithAdjustmentReader, WithBcolzEquityMinuteBarReader, WithBcolzFutureMinuteBarReader): """ - ZiplineTestCase mixin providing self.data_portal as an instance level + CatalystTestCase mixin providing self.data_portal as an instance level fixture. After init_instance_fixtures has been called, `self.data_portal` will be @@ -1485,12 +1485,12 @@ class WithDataPortal(WithAdjustmentReader, self.env.asset_finder, self.trading_calendar, first_trading_day=self.DATA_PORTAL_FIRST_TRADING_DAY, - equity_daily_reader=( + daily_reader=( self.bcolz_equity_daily_bar_reader if self.DATA_PORTAL_USE_DAILY_DATA else None ), - equity_minute_reader=( + minute_reader=( self.bcolz_equity_minute_bar_reader if self.DATA_PORTAL_USE_MINUTE_DATA else None @@ -1526,7 +1526,7 @@ class WithDataPortal(WithAdjustmentReader, class WithResponses(object): """ - ZiplineTestCase mixin that provides self.responses as an instance + CatalystTestCase mixin that provides self.responses as an instance fixture. After init_instance_fixtures has been called, `self.responses` will be diff --git a/catalyst/utils/factory.py b/catalyst/utils/factory.py index ae86c99e..317dcc8e 100644 --- a/catalyst/utils/factory.py +++ b/catalyst/utils/factory.py @@ -37,7 +37,7 @@ from catalyst.utils.input_validation import expect_types __all__ = ['load_from_yahoo', 'load_bars_from_yahoo'] -def create_simulation_parameters(year=2006, start=None, end=None, +def create_simulation_parameters(year=2016, start=None, end=None, capital_base=float("1.0e5"), num_days=None, data_frequency='daily', diff --git a/docs/source/whatsnew/0.9.0.txt b/docs/source/whatsnew/0.9.0.txt index 60f472d7..b5fbbeae 100644 --- a/docs/source/whatsnew/0.9.0.txt +++ b/docs/source/whatsnew/0.9.0.txt @@ -105,7 +105,7 @@ None Miscellaneous ~~~~~~~~~~~~~ -* Adds :class:`~zipline.testing.fixtures.ZiplineTestCase` which provides hooks +* Adds :class:`~zipline.testing.fixtures.CatalystTestCase` which provides hooks to consume test fixtures. Fixtures are things like: :class:`~zipline.testing.fixtures.WithAssetFinder` which will make ``self.asset_finder`` available to your test with some mock data diff --git a/tests/calendars/test_calendar_dispatcher.py b/tests/calendars/test_calendar_dispatcher.py index abdf45a8..80239c5f 100644 --- a/tests/calendars/test_calendar_dispatcher.py +++ b/tests/calendars/test_calendar_dispatcher.py @@ -6,12 +6,12 @@ from catalyst.errors import ( CyclicCalendarAlias, InvalidCalendarName, ) -from catalyst.testing import ZiplineTestCase +from catalyst.testing import CatalystTestCase from catalyst.utils.calendars.calendar_utils import TradingCalendarDispatcher from catalyst.utils.calendars.exchange_calendar_ice import ICEExchangeCalendar -class CalendarAliasTestCase(ZiplineTestCase): +class CalendarAliasTestCase(CatalystTestCase): @classmethod def init_class_fixtures(cls): diff --git a/tests/data/bundles/test_core.py b/tests/data/bundles/test_core.py index 4713795f..5f0dfe2f 100644 --- a/tests/data/bundles/test_core.py +++ b/tests/data/bundles/test_core.py @@ -22,7 +22,7 @@ from catalyst.testing import ( subtest, str_to_seconds, ) -from catalyst.testing.fixtures import WithInstanceTmpDir, ZiplineTestCase, \ +from catalyst.testing.fixtures import WithInstanceTmpDir, CatalystTestCase, \ WithDefaultDateBounds from catalyst.testing.predicates import ( assert_equal, @@ -45,7 +45,7 @@ _1_ns = pd.Timedelta(1, unit='ns') class BundleCoreTestCase(WithInstanceTmpDir, WithDefaultDateBounds, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2014-01-06', tz='utc') END_DATE = pd.Timestamp('2014-01-10', tz='utc') diff --git a/tests/data/bundles/test_quandl.py b/tests/data/bundles/test_quandl.py index 8425a9e0..65fe2bd7 100644 --- a/tests/data/bundles/test_quandl.py +++ b/tests/data/bundles/test_quandl.py @@ -17,14 +17,14 @@ from catalyst.testing import ( tmp_dir, patch_read_csv, ) -from catalyst.testing.fixtures import ZiplineTestCase +from catalyst.testing.fixtures import CatalystTestCase from catalyst.testing.predicates import ( assert_equal, ) from catalyst.utils.functional import apply -class QuandlBundleTestCase(ZiplineTestCase): +class QuandlBundleTestCase(CatalystTestCase): symbols = 'AAPL', 'BRK_A', 'MSFT', 'ZEN' asset_start = pd.Timestamp('2014-01', tz='utc') asset_end = pd.Timestamp('2015-01', tz='utc') diff --git a/tests/data/bundles/test_yahoo.py b/tests/data/bundles/test_yahoo.py index 7bc0ada4..4f8c25f8 100644 --- a/tests/data/bundles/test_yahoo.py +++ b/tests/data/bundles/test_yahoo.py @@ -10,12 +10,12 @@ from catalyst.data.bundles.core import _make_bundle_core from catalyst.data.bundles import yahoo_equities from catalyst.lib.adjustment import Float64Multiply from catalyst.testing import test_resource_path, tmp_dir, read_compressed -from catalyst.testing.fixtures import WithResponses, ZiplineTestCase +from catalyst.testing.fixtures import WithResponses, CatalystTestCase from catalyst.testing.predicates import assert_equal from catalyst.utils.calendars import get_calendar -class YahooBundleTestCase(WithResponses, ZiplineTestCase): +class YahooBundleTestCase(WithResponses, CatalystTestCase): symbols = 'AAPL', 'IBM', 'MSFT' columns = 'open', 'high', 'low', 'close', 'volume' asset_start = pd.Timestamp('2014-01-02', tz='utc') diff --git a/tests/data/test_dispatch_bar_reader.py b/tests/data/test_dispatch_bar_reader.py index c06af3d9..fe9be434 100644 --- a/tests/data/test_dispatch_bar_reader.py +++ b/tests/data/test_dispatch_bar_reader.py @@ -37,7 +37,7 @@ from catalyst.testing.fixtures import ( WithBcolzEquityDailyBarReader, WithBcolzFutureMinuteBarReader, WithTradingSessions, - ZiplineTestCase, + CatalystTestCase, ) OHLC = ['open', 'high', 'low', 'close'] @@ -46,7 +46,7 @@ OHLC = ['open', 'high', 'low', 'close'] class AssetDispatchSessionBarTestCase(WithBcolzEquityDailyBarReader, WithBcolzFutureMinuteBarReader, WithTradingSessions, - ZiplineTestCase): + CatalystTestCase): TRADING_CALENDAR_STRS = ('us_futures', 'NYSE') TRADING_CALENDAR_PRIMARY_CAL = 'us_futures' @@ -175,7 +175,7 @@ class AssetDispatchSessionBarTestCase(WithBcolzEquityDailyBarReader, class AssetDispatchMinuteBarTestCase(WithBcolzEquityMinuteBarReader, WithBcolzFutureMinuteBarReader, - ZiplineTestCase): + CatalystTestCase): TRADING_CALENDAR_STRS = ('us_futures', 'NYSE') TRADING_CALENDAR_PRIMARY_CAL = 'us_futures' diff --git a/tests/data/test_minute_bars.py b/tests/data/test_minute_bars.py index a36e35a8..2670f9a7 100644 --- a/tests/data/test_minute_bars.py +++ b/tests/data/test_minute_bars.py @@ -56,7 +56,7 @@ from catalyst.testing.fixtures import ( WithAssetFinder, WithInstanceTmpDir, WithTradingCalendars, - ZiplineTestCase, + CatalystTestCase, ) # Calendar is set to cover several half days, to check a case where half @@ -69,7 +69,7 @@ TEST_CALENDAR_STOP = Timestamp('2016-12-31', tz='UTC') class BcolzMinuteBarTestCase(WithTradingCalendars, WithAssetFinder, WithInstanceTmpDir, - ZiplineTestCase): + CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = 1, 2 diff --git a/tests/data/test_resample.py b/tests/data/test_resample.py index fd8d3948..ab6268b5 100644 --- a/tests/data/test_resample.py +++ b/tests/data/test_resample.py @@ -35,7 +35,7 @@ from catalyst.testing.fixtures import ( WithBcolzEquityMinuteBarReader, WithBcolzEquityDailyBarReader, WithBcolzFutureMinuteBarReader, - ZiplineTestCase, + CatalystTestCase, ) OHLC = ['open', 'high', 'low', 'close'] @@ -254,7 +254,7 @@ EXPECTED_SESSIONS = { class MinuteToDailyAggregationTestCase(WithBcolzEquityMinuteBarReader, WithBcolzFutureMinuteBarReader, - ZiplineTestCase): + CatalystTestCase): # March 2016 # Su Mo Tu We Th Fr Sa @@ -525,7 +525,7 @@ class MinuteToDailyAggregationTestCase(WithBcolzEquityMinuteBarReader, class TestMinuteToSession(WithEquityMinuteBarData, - ZiplineTestCase): + CatalystTestCase): # March 2016 # Su Mo Tu We Th Fr Sa @@ -565,7 +565,7 @@ class TestMinuteToSession(WithEquityMinuteBarData, class TestResampleSessionBars(WithBcolzFutureMinuteBarReader, - ZiplineTestCase): + CatalystTestCase): TRADING_CALENDAR_STRS = ('us_futures',) TRADING_CALENDAR_PRIMARY_CAL = 'us_futures' @@ -667,7 +667,7 @@ class TestResampleSessionBars(WithBcolzFutureMinuteBarReader, class TestReindexMinuteBars(WithBcolzEquityMinuteBarReader, - ZiplineTestCase): + CatalystTestCase): TRADING_CALENDAR_STRS = ('us_futures', 'NYSE') TRADING_CALENDAR_PRIMARY_CAL = 'us_futures' @@ -736,7 +736,7 @@ class TestReindexMinuteBars(WithBcolzEquityMinuteBarReader, class TestReindexSessionBars(WithBcolzEquityDailyBarReader, - ZiplineTestCase): + CatalystTestCase): TRADING_CALENDAR_STRS = ('us_futures', 'NYSE') TRADING_CALENDAR_PRIMARY_CAL = 'us_futures' diff --git a/tests/data/test_us_equity_pricing.py b/tests/data/test_us_equity_pricing.py index 77e5bba9..7fdb19e1 100644 --- a/tests/data/test_us_equity_pricing.py +++ b/tests/data/test_us_equity_pricing.py @@ -50,7 +50,7 @@ from catalyst.testing.fixtures import ( WithBcolzEquityDailyBarReader, WithTmpDir, WithTradingCalendars, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.calendars import get_calendar @@ -86,7 +86,7 @@ EQUITY_INFO['symbol'] = [chr(ord('A') + n) for n in range(len(EQUITY_INFO))] TEST_QUERY_ASSETS = EQUITY_INFO.index -class BcolzDailyBarTestCase(WithBcolzEquityDailyBarReader, ZiplineTestCase): +class BcolzDailyBarTestCase(WithBcolzEquityDailyBarReader, CatalystTestCase): EQUITY_DAILY_BAR_START_DATE = TEST_CALENDAR_START EQUITY_DAILY_BAR_END_DATE = TEST_CALENDAR_STOP @@ -372,7 +372,7 @@ class BcolzDailyBarNeverReadAllTestCase(BcolzDailyBarTestCase): class BcolzDailyBarWriterMissingDataTestCase(WithAssetFinder, WithTmpDir, WithTradingCalendars, - ZiplineTestCase): + CatalystTestCase): # Sid 3 is active from 2015-06-02 to 2015-06-30. MISSING_DATA_SID = 3 # Leave out data for a day in the middle of the query range. diff --git a/tests/finance/test_blotter.py b/tests/finance/test_blotter.py index 499ac6fc..4c34562f 100644 --- a/tests/finance/test_blotter.py +++ b/tests/finance/test_blotter.py @@ -37,7 +37,7 @@ from catalyst.testing.fixtures import ( WithDataPortal, WithLogger, WithSimParams, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.classproperty import classproperty @@ -46,7 +46,7 @@ class BlotterTestCase(WithCreateBarData, WithLogger, WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-05', tz='utc') END_DATE = pd.Timestamp('2006-01-06', tz='utc') ASSET_FINDER_EQUITY_SIDS = 24, 25 diff --git a/tests/finance/test_commissions.py b/tests/finance/test_commissions.py index d2f82e9d..72436195 100644 --- a/tests/finance/test_commissions.py +++ b/tests/finance/test_commissions.py @@ -19,7 +19,7 @@ from catalyst.finance.commission import ( ) from catalyst.finance.order import Order from catalyst.finance.transaction import Transaction -from catalyst.testing import ZiplineTestCase, trades_by_sid_to_dfs +from catalyst.testing import CatalystTestCase, trades_by_sid_to_dfs from catalyst.testing.fixtures import ( WithAssetFinder, WithSimParams, @@ -28,7 +28,7 @@ from catalyst.testing.fixtures import ( from catalyst.utils import factory -class CommissionUnitTests(WithAssetFinder, ZiplineTestCase): +class CommissionUnitTests(WithAssetFinder, CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = 1, 2 @classmethod @@ -272,7 +272,7 @@ class CommissionUnitTests(WithAssetFinder, ZiplineTestCase): self.assertAlmostEqual(15.3, model.calculate(order, txns[2])) -class CommissionAlgorithmTests(WithDataPortal, WithSimParams, ZiplineTestCase): +class CommissionAlgorithmTests(WithDataPortal, WithSimParams, CatalystTestCase): # make sure order commissions are properly incremented sidint, = ASSET_FINDER_EQUITY_SIDS = (133,) diff --git a/tests/finance/test_slippage.py b/tests/finance/test_slippage.py index 1101928a..6aa064c3 100644 --- a/tests/finance/test_slippage.py +++ b/tests/finance/test_slippage.py @@ -48,7 +48,7 @@ from catalyst.testing.fixtures import ( WithDataPortal, WithSimParams, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.classproperty import classproperty @@ -59,7 +59,7 @@ TestOrder = namedtuple('TestOrder', 'limit direction') class SlippageTestCase(WithCreateBarData, WithSimParams, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-05 14:31', tz='utc') END_DATE = pd.Timestamp('2006-01-05 14:36', tz='utc') SIM_PARAMS_CAPITAL_BASE = 1.0e5 @@ -566,7 +566,7 @@ class SlippageTestCase(WithCreateBarData, class VolumeShareSlippageTestCase(WithCreateBarData, WithSimParams, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-05 14:31', tz='utc') END_DATE = pd.Timestamp('2006-01-05 14:36', tz='utc') @@ -743,7 +743,7 @@ class VolumeShareSlippageTestCase(WithCreateBarData, class VolatilityVolumeShareTestCase(WithCreateBarData, WithSimParams, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): ASSET_START_DATE = pd.Timestamp('2006-02-10') @@ -890,7 +890,7 @@ class VolatilityVolumeShareTestCase(WithCreateBarData, self.assertIsNone(amount) -class MarketImpactTestCase(WithCreateBarData, ZiplineTestCase): +class MarketImpactTestCase(WithCreateBarData, CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = (1,) @@ -947,7 +947,7 @@ class MarketImpactTestCase(WithCreateBarData, ZiplineTestCase): class OrdersStopTestCase(WithSimParams, WithTradingEnvironment, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-05 14:31', tz='utc') END_DATE = pd.Timestamp('2006-01-05 14:36', tz='utc') diff --git a/tests/pipeline/base.py b/tests/pipeline/base.py index b3c862e7..a712055c 100644 --- a/tests/pipeline/base.py +++ b/tests/pipeline/base.py @@ -18,7 +18,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithAssetFinder, WithTradingSessions, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.functional import dzip_exact @@ -54,7 +54,7 @@ with_default_shape = with_defaults(shape=lambda self: self.default_shape) class BasePipelineTestCase(WithTradingSessions, WithAssetFinder, - ZiplineTestCase): + CatalystTestCase): START_DATE = Timestamp('2014', tz='UTC') END_DATE = Timestamp('2014-12-31', tz='UTC') ASSET_FINDER_EQUITY_SIDS = list(range(20)) diff --git a/tests/pipeline/test_blaze.py b/tests/pipeline/test_blaze.py index 07f0b2d6..1803ac95 100644 --- a/tests/pipeline/test_blaze.py +++ b/tests/pipeline/test_blaze.py @@ -34,7 +34,7 @@ from catalyst.pipeline.loaders.blaze.core import ( NonPipelineField, ) from catalyst.testing import ( - ZiplineTestCase, + CatalystTestCase, parameter_space, tmp_asset_finder, ) @@ -77,7 +77,7 @@ def _utc_localize_index_level_0(df): return df -class BlazeToPipelineTestCase(WithAssetFinder, ZiplineTestCase): +class BlazeToPipelineTestCase(WithAssetFinder, CatalystTestCase): START_DATE = pd.Timestamp(0) END_DATE = pd.Timestamp('2015') @@ -1927,7 +1927,7 @@ class BlazeToPipelineTestCase(WithAssetFinder, ZiplineTestCase): ) -class MiscTestCase(ZiplineTestCase): +class MiscTestCase(CatalystTestCase): def test_exprdata_repr(self): strd = set() diff --git a/tests/pipeline/test_classifier.py b/tests/pipeline/test_classifier.py index 43615b37..91d3ee0c 100644 --- a/tests/pipeline/test_classifier.py +++ b/tests/pipeline/test_classifier.py @@ -7,7 +7,7 @@ import pandas as pd from catalyst.lib.labelarray import LabelArray from catalyst.pipeline import Classifier from catalyst.testing import parameter_space -from catalyst.testing.fixtures import ZiplineTestCase +from catalyst.testing.fixtures import CatalystTestCase from catalyst.testing.predicates import assert_equal from catalyst.utils.numpy_utils import ( categorical_dtype, @@ -585,7 +585,7 @@ class ClassifierTestCase(BasePipelineTestCase): self.assertEqual(result, expected) -class TestPostProcessAndToWorkSpaceValue(ZiplineTestCase): +class TestPostProcessAndToWorkSpaceValue(CatalystTestCase): def test_reversability_categorical(self): class F(Classifier): inputs = () diff --git a/tests/pipeline/test_downsampling.py b/tests/pipeline/test_downsampling.py index 1068527d..342126e7 100644 --- a/tests/pipeline/test_downsampling.py +++ b/tests/pipeline/test_downsampling.py @@ -13,7 +13,7 @@ from catalyst.pipeline import ( from catalyst.pipeline.data.testing import TestingDataSet from catalyst.pipeline.factors.equity import SimpleMovingAverage from catalyst.pipeline.filters.smoothing import All -from catalyst.testing import ZiplineTestCase, parameter_space +from catalyst.testing import CatalystTestCase, parameter_space from catalyst.testing.fixtures import ( WithTradingSessions, WithSeededRandomPipelineEngine, @@ -44,7 +44,7 @@ class NDaysAgoClassifier(CustomClassifier): out[:] = cats[0] -class ComputeExtraRowsTestcase(WithTradingSessions, ZiplineTestCase): +class ComputeExtraRowsTestcase(WithTradingSessions, CatalystTestCase): DATA_MIN_DAY = pd.Timestamp('2012-06', tz='UTC') DATA_MAX_DAY = pd.Timestamp('2015', tz='UTC') @@ -555,7 +555,7 @@ class ComputeExtraRowsTestcase(WithTradingSessions, ZiplineTestCase): class DownsampledPipelineTestCase(WithSeededRandomPipelineEngine, - ZiplineTestCase): + CatalystTestCase): # Extend into the last few days of 2013 to test year/quarter boundaries. START_DATE = pd.Timestamp('2013-12-15', tz='UTC') diff --git a/tests/pipeline/test_engine.py b/tests/pipeline/test_engine.py index dae79f2b..1b76984b 100644 --- a/tests/pipeline/test_engine.py +++ b/tests/pipeline/test_engine.py @@ -81,7 +81,7 @@ from catalyst.testing.fixtures import ( WithEquityPricingPipelineEngine, WithSeededRandomPipelineEngine, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.testing.predicates import assert_equal from catalyst.utils.memoize import lazyval @@ -199,7 +199,7 @@ class WithConstantInputs(WithTradingEnvironment): cls.assets = cls.asset_finder.retrieve_all(cls.asset_ids) -class ConstantInputTestCase(WithConstantInputs, ZiplineTestCase): +class ConstantInputTestCase(WithConstantInputs, CatalystTestCase): def test_bad_dates(self): loader = self.loader engine = SimplePipelineEngine( @@ -816,7 +816,7 @@ class ConstantInputTestCase(WithConstantInputs, ZiplineTestCase): Loader2DataSet.col2)}) -class FrameInputTestCase(WithTradingEnvironment, ZiplineTestCase): +class FrameInputTestCase(WithTradingEnvironment, CatalystTestCase): asset_ids = ASSET_FINDER_EQUITY_SIDS = 1, 2, 3 start = START_DATE = Timestamp('2015-01-01', tz='utc') end = END_DATE = Timestamp('2015-01-31', tz='utc') @@ -921,7 +921,7 @@ class FrameInputTestCase(WithTradingEnvironment, ZiplineTestCase): class SyntheticBcolzTestCase(WithAdjustmentReader, - ZiplineTestCase): + CatalystTestCase): first_asset_start = Timestamp('2015-04-01', tz='UTC') START_DATE = Timestamp('2015-01-01', tz='utc') END_DATE = Timestamp('2015-08-01', tz='utc') @@ -1079,7 +1079,7 @@ class SyntheticBcolzTestCase(WithAdjustmentReader, assert_frame_equal(expected, result) -class ParameterizedFactorTestCase(WithTradingEnvironment, ZiplineTestCase): +class ParameterizedFactorTestCase(WithTradingEnvironment, CatalystTestCase): sids = ASSET_FINDER_EQUITY_SIDS = Int64Index([1, 2, 3]) START_DATE = Timestamp('2015-01-31', tz='UTC') END_DATE = Timestamp('2015-03-01', tz='UTC') @@ -1297,7 +1297,7 @@ class ParameterizedFactorTestCase(WithTradingEnvironment, ZiplineTestCase): class StringColumnTestCase(WithSeededRandomPipelineEngine, - ZiplineTestCase): + CatalystTestCase): def test_string_classifiers_produce_categoricals(self): """ @@ -1327,7 +1327,7 @@ class StringColumnTestCase(WithSeededRandomPipelineEngine, class WindowSafetyPropagationTestCase(WithSeededRandomPipelineEngine, - ZiplineTestCase): + CatalystTestCase): SEEDED_RANDOM_PIPELINE_SEED = 5 @@ -1378,7 +1378,7 @@ class WindowSafetyPropagationTestCase(WithSeededRandomPipelineEngine, assert_equal(expected_result, results[colname]) -class PopulateInitialWorkspaceTestCase(WithConstantInputs, ZiplineTestCase): +class PopulateInitialWorkspaceTestCase(WithConstantInputs, CatalystTestCase): @parameter_space(window_length=[3, 5], pipeline_length=[5, 10]) def test_populate_initial_workspace(self, window_length, pipeline_length): @@ -1503,7 +1503,7 @@ class PopulateInitialWorkspaceTestCase(WithConstantInputs, ZiplineTestCase): class ChunkedPipelineTestCase(WithEquityPricingPipelineEngine, - ZiplineTestCase): + CatalystTestCase): PIPELINE_START_DATE = Timestamp('2006-01-05', tz='UTC') END_DATE = Timestamp('2006-12-29', tz='UTC') diff --git a/tests/pipeline/test_events.py b/tests/pipeline/test_events.py index b80bd47a..5290ffd0 100644 --- a/tests/pipeline/test_events.py +++ b/tests/pipeline/test_events.py @@ -24,7 +24,7 @@ from catalyst.pipeline.loaders.utils import ( normalize_timestamp_to_query_time, previous_event_indexer, ) -from catalyst.testing import check_arrays, ZiplineTestCase +from catalyst.testing import check_arrays, CatalystTestCase from catalyst.testing.fixtures import ( WithAssetFinder, WithTradingSessions, @@ -148,7 +148,7 @@ def make_events(add_nulls): return pd.concat(event_frames, ignore_index=True) -class EventIndexerTestCase(ZiplineTestCase): +class EventIndexerTestCase(CatalystTestCase): @classmethod def init_class_fixtures(cls): @@ -269,7 +269,7 @@ class EventIndexerTestCase(ZiplineTestCase): class EventsLoaderEmptyTestCase(WithAssetFinder, WithTradingSessions, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2014-01-01') END_DATE = pd.Timestamp('2014-01-30') @@ -351,7 +351,7 @@ class EventsLoaderEmptyTestCase(WithAssetFinder, class EventsLoaderTestCase(WithAssetFinder, WithTradingSessions, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2014-01-01') END_DATE = pd.Timestamp('2014-01-30') @@ -586,7 +586,7 @@ class BlazeEventsLoaderTestCase(EventsLoaderTestCase): ) -class EventLoaderUtilsTestCase(ZiplineTestCase): +class EventLoaderUtilsTestCase(CatalystTestCase): # These cases test the following: # 1. Shuffling timestamps in DST/EST produces the correct normalized # timestamps diff --git a/tests/pipeline/test_factor.py b/tests/pipeline/test_factor.py index df500b77..90fe8634 100644 --- a/tests/pipeline/test_factor.py +++ b/tests/pipeline/test_factor.py @@ -40,7 +40,7 @@ from catalyst.testing import ( parameter_space, permute_rows, ) -from catalyst.testing.fixtures import ZiplineTestCase +from catalyst.testing.fixtures import CatalystTestCase from catalyst.testing.predicates import assert_equal from catalyst.utils.numpy_utils import ( categorical_dtype, @@ -1246,7 +1246,7 @@ class TestWindowSafety(TestCase): ) -class TestPostProcessAndToWorkSpaceValue(ZiplineTestCase): +class TestPostProcessAndToWorkSpaceValue(CatalystTestCase): @parameter_space(dtype_=(float64_dtype, datetime64ns_dtype)) def test_reversability(self, dtype_): class F(Factor): diff --git a/tests/pipeline/test_filter.py b/tests/pipeline/test_filter.py index d6742348..7978c3f5 100644 --- a/tests/pipeline/test_filter.py +++ b/tests/pipeline/test_filter.py @@ -37,7 +37,7 @@ from catalyst.pipeline.filters import ( StaticAssets, StaticSids, ) -from catalyst.testing import parameter_space, permute_rows, ZiplineTestCase +from catalyst.testing import parameter_space, permute_rows, CatalystTestCase from catalyst.testing.fixtures import WithSeededRandomPipelineEngine from catalyst.testing.predicates import assert_equal from catalyst.utils.numpy_utils import float64_dtype, int64_dtype @@ -841,7 +841,7 @@ class SidFactor(CustomFactor): class SpecificAssetsTestCase(WithSeededRandomPipelineEngine, - ZiplineTestCase): + CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = tuple(range(10)) @@ -887,7 +887,7 @@ class SpecificAssetsTestCase(WithSeededRandomPipelineEngine, ) -class TestPostProcessAndToWorkSpaceValue(ZiplineTestCase): +class TestPostProcessAndToWorkSpaceValue(CatalystTestCase): def test_reversability(self): class F(Filter): inputs = () diff --git a/tests/pipeline/test_pipeline_algo.py b/tests/pipeline/test_pipeline_algo.py index eca132ba..da69cc09 100644 --- a/tests/pipeline/test_pipeline_algo.py +++ b/tests/pipeline/test_pipeline_algo.py @@ -60,7 +60,7 @@ from catalyst.testing.fixtures import ( WithAdjustmentReader, WithBcolzEquityDailyBarReaderFromCSVs, WithDataPortal, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.calendars import get_calendar @@ -84,7 +84,7 @@ def rolling_vwap(df, length): return Series(out, index=df.index) -class ClosesOnly(WithDataPortal, ZiplineTestCase): +class ClosesOnly(WithDataPortal, CatalystTestCase): sids = 1, 2, 3 START_DATE = pd.Timestamp('2014-01-01', tz='utc') END_DATE = pd.Timestamp('2014-02-01', tz='utc') @@ -355,7 +355,7 @@ class MockDailyBarSpotReader(object): class PipelineAlgorithmTestCase(WithBcolzEquityDailyBarReaderFromCSVs, WithAdjustmentReader, - ZiplineTestCase): + CatalystTestCase): AAPL = 1 MSFT = 2 BRK_A = 3 diff --git a/tests/pipeline/test_quarters_estimates.py b/tests/pipeline/test_quarters_estimates.py index 56be084c..f0c4238b 100644 --- a/tests/pipeline/test_quarters_estimates.py +++ b/tests/pipeline/test_quarters_estimates.py @@ -40,7 +40,7 @@ from catalyst.pipeline.loaders.earnings_estimates import ( from catalyst.testing.fixtures import ( WithAdjustmentReader, WithTradingSessions, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.testing.predicates import assert_equal, assert_raises_regex from catalyst.testing.predicates import assert_frame_equal @@ -113,7 +113,7 @@ def create_expected_df_for_factor_compute(start_date, class WithEstimates(WithTradingSessions, WithAdjustmentReader): """ - ZiplineTestCase mixin providing cls.loader and cls.events as class + CatalystTestCase mixin providing cls.loader and cls.events as class level fixtures. @@ -177,7 +177,7 @@ class WithEstimates(WithTradingSessions, WithAdjustmentReader): class WithOneDayPipeline(WithEstimates): """ - ZiplineTestCase mixin providing cls.events as a class level fixture and + CatalystTestCase mixin providing cls.events as a class level fixture and defining a test for all inheritors to use. Attributes @@ -246,7 +246,7 @@ class WithOneDayPipeline(WithEstimates): assert_frame_equal(results, self.expected_out) -class PreviousWithOneDayPipeline(WithOneDayPipeline, ZiplineTestCase): +class PreviousWithOneDayPipeline(WithOneDayPipeline, CatalystTestCase): """ Tests that previous quarter loader correctly breaks if an incorrect number of quarters is passed. @@ -271,7 +271,7 @@ class PreviousWithOneDayPipeline(WithOneDayPipeline, ZiplineTestCase): ) -class NextWithOneDayPipeline(WithOneDayPipeline, ZiplineTestCase): +class NextWithOneDayPipeline(WithOneDayPipeline, CatalystTestCase): """ Tests that next quarter loader correctly breaks if an incorrect number of quarters is passed. @@ -308,7 +308,7 @@ dummy_df = pd.DataFrame({SID_FIELD_NAME: 0}, class WithWrongLoaderDefinition(WithEstimates): """ - ZiplineTestCase mixin providing cls.events as a class level fixture and + CatalystTestCase mixin providing cls.events as a class level fixture and defining a test for all inheritors to use. Attributes @@ -372,7 +372,7 @@ class WithWrongLoaderDefinition(WithEstimates): class PreviousWithWrongNumQuarters(WithWrongLoaderDefinition, - ZiplineTestCase): + CatalystTestCase): """ Tests that previous quarter loader correctly breaks if an incorrect number of quarters is passed. @@ -383,7 +383,7 @@ class PreviousWithWrongNumQuarters(WithWrongLoaderDefinition, class NextWithWrongNumQuarters(WithWrongLoaderDefinition, - ZiplineTestCase): + CatalystTestCase): """ Tests that next quarter loader correctly breaks if an incorrect number of quarters is passed. @@ -398,7 +398,7 @@ options = ["split_adjustments_loader", "split_adjusted_asof"] -class WrongSplitsLoaderDefinition(WithEstimates, ZiplineTestCase): +class WrongSplitsLoaderDefinition(WithEstimates, CatalystTestCase): """ Test class that tests that loaders break correctly when incorrectly instantiated. @@ -436,7 +436,7 @@ class WrongSplitsLoaderDefinition(WithEstimates, ZiplineTestCase): class WithEstimatesTimeZero(WithEstimates): """ - ZiplineTestCase mixin providing cls.events as a class level fixture and + CatalystTestCase mixin providing cls.events as a class level fixture and defining a test for all inheritors to use. Attributes @@ -622,7 +622,7 @@ class WithEstimatesTimeZero(WithEstimates): sid_estimates) -class NextEstimate(WithEstimatesTimeZero, ZiplineTestCase): +class NextEstimate(WithEstimatesTimeZero, CatalystTestCase): @classmethod def make_loader(cls, events, columns): return NextEarningsEstimatesLoader(events, columns) @@ -662,7 +662,7 @@ class BlazeNextEstimateLoaderTestCase(NextEstimate): ) -class PreviousEstimate(WithEstimatesTimeZero, ZiplineTestCase): +class PreviousEstimate(WithEstimatesTimeZero, CatalystTestCase): @classmethod def make_loader(cls, events, columns): return PreviousEarningsEstimatesLoader(events, columns) @@ -703,7 +703,7 @@ class BlazePreviousEstimateLoaderTestCase(PreviousEstimate): class WithEstimateMultipleQuarters(WithEstimates): """ - ZiplineTestCase mixin providing cls.events, cls.make_expected_out as + CatalystTestCase mixin providing cls.events, cls.make_expected_out as class-level fixtures and self.test_multiple_qtrs_requested as a test. Attributes @@ -797,7 +797,7 @@ class WithEstimateMultipleQuarters(WithEstimates): class NextEstimateMultipleQuarters( - WithEstimateMultipleQuarters, ZiplineTestCase + WithEstimateMultipleQuarters, CatalystTestCase ): @classmethod def make_loader(cls, events, columns): @@ -854,7 +854,7 @@ class BlazeNextEstimateMultipleQuarters(NextEstimateMultipleQuarters): class PreviousEstimateMultipleQuarters( WithEstimateMultipleQuarters, - ZiplineTestCase + CatalystTestCase ): @classmethod @@ -903,7 +903,7 @@ class BlazePreviousEstimateMultipleQuarters(PreviousEstimateMultipleQuarters): class WithVaryingNumEstimates(WithEstimates): """ - ZiplineTestCase mixin providing fixtures and a test to ensure that we + CatalystTestCase mixin providing fixtures and a test to ensure that we have the correct overwrites when the event date changes. We want to make sure that if we have a quarter with an event date that gets pushed back, we don't start overwriting for the next quarter early. Likewise, @@ -973,7 +973,7 @@ class WithVaryingNumEstimates(WithEstimates): class PreviousVaryingNumEstimates( WithVaryingNumEstimates, - ZiplineTestCase + CatalystTestCase ): def assert_compute(self, estimate, today): if today == pd.Timestamp('2015-01-13', tz='utc'): @@ -1003,7 +1003,7 @@ class BlazePreviousVaryingNumEstimates(PreviousVaryingNumEstimates): class NextVaryingNumEstimates( WithVaryingNumEstimates, - ZiplineTestCase + CatalystTestCase ): def assert_compute(self, estimate, today): @@ -1034,7 +1034,7 @@ class BlazeNextVaryingNumEstimates(NextVaryingNumEstimates): class WithEstimateWindows(WithEstimates): """ - ZiplineTestCase mixin providing fixures and a test to test running a + CatalystTestCase mixin providing fixures and a test to test running a Pipeline with an estimates loader over differently-sized windows. Attributes @@ -1198,7 +1198,7 @@ class WithEstimateWindows(WithEstimates): ) -class PreviousEstimateWindows(WithEstimateWindows, ZiplineTestCase): +class PreviousEstimateWindows(WithEstimateWindows, CatalystTestCase): @classmethod def make_loader(cls, events, columns): return PreviousEarningsEstimatesLoader(events, columns) @@ -1279,7 +1279,7 @@ class BlazePreviousEstimateWindows(PreviousEstimateWindows): return BlazePreviousEstimatesLoader(bz.data(events), columns) -class NextEstimateWindows(WithEstimateWindows, ZiplineTestCase): +class NextEstimateWindows(WithEstimateWindows, CatalystTestCase): @classmethod def make_loader(cls, events, columns): return NextEarningsEstimatesLoader(events, columns) @@ -1394,7 +1394,7 @@ class BlazeNextEstimateWindows(NextEstimateWindows): class WithSplitAdjustedWindows(WithEstimateWindows): """ - ZiplineTestCase mixin providing fixures and a test to test running a + CatalystTestCase mixin providing fixures and a test to test running a Pipeline with an estimates loader over differently-sized windows and with split adjustments. """ @@ -1572,7 +1572,7 @@ class WithSplitAdjustedWindows(WithEstimateWindows): class PreviousWithSplitAdjustedWindows(WithSplitAdjustedWindows, - ZiplineTestCase): + CatalystTestCase): @classmethod def make_loader(cls, events, columns): return PreviousSplitAdjustedEarningsEstimatesLoader( @@ -1726,7 +1726,7 @@ class BlazePreviousWithSplitAdjustedWindows(PreviousWithSplitAdjustedWindows): ) -class NextWithSplitAdjustedWindows(WithSplitAdjustedWindows, ZiplineTestCase): +class NextWithSplitAdjustedWindows(WithSplitAdjustedWindows, CatalystTestCase): @classmethod def make_loader(cls, events, columns): @@ -1951,7 +1951,7 @@ class BlazeNextWithSplitAdjustedWindows(NextWithSplitAdjustedWindows): class WithSplitAdjustedMultipleEstimateColumns(WithEstimates): """ - ZiplineTestCase mixin for having multiple estimate columns that are + CatalystTestCase mixin for having multiple estimate columns that are split-adjusted to make sure that adjustments are applied correctly. Attributes @@ -2136,7 +2136,7 @@ class WithSplitAdjustedMultipleEstimateColumns(WithEstimates): class PreviousWithSplitAdjustedMultipleEstimateColumns( - WithSplitAdjustedMultipleEstimateColumns, ZiplineTestCase + WithSplitAdjustedMultipleEstimateColumns, CatalystTestCase ): @classmethod def make_loader(cls, events, columns): @@ -2218,7 +2218,7 @@ class BlazePreviousWithMultipleEstimateColumns( class NextWithSplitAdjustedMultipleEstimateColumns( - WithSplitAdjustedMultipleEstimateColumns, ZiplineTestCase + WithSplitAdjustedMultipleEstimateColumns, CatalystTestCase ): @classmethod def make_loader(cls, events, columns): @@ -2295,7 +2295,7 @@ class BlazeNextWithMultipleEstimateColumns( class WithAdjustmentBoundaries(WithEstimates): """ - ZiplineTestCase mixin providing class-level attributes, methods, + CatalystTestCase mixin providing class-level attributes, methods, and a test to make sure that when the split-adjusted-asof-date is not strictly within the date index, we can still apply adjustments correctly. @@ -2470,7 +2470,7 @@ class WithAdjustmentBoundaries(WithEstimates): class PreviousWithAdjustmentBoundaries(WithAdjustmentBoundaries, - ZiplineTestCase): + CatalystTestCase): @classmethod def make_loader(cls, events, columns): return partial(PreviousSplitAdjustedEarningsEstimatesLoader, @@ -2612,7 +2612,7 @@ class BlazePreviousWithAdjustmentBoundaries(PreviousWithAdjustmentBoundaries): class NextWithAdjustmentBoundaries(WithAdjustmentBoundaries, - ZiplineTestCase): + CatalystTestCase): @classmethod def make_loader(cls, events, columns): return partial(NextSplitAdjustedEarningsEstimatesLoader, @@ -2720,7 +2720,7 @@ class BlazeNextWithAdjustmentBoundaries(NextWithAdjustmentBoundaries): split_adjusted_column_names=['estimate']) -class QuarterShiftTestCase(ZiplineTestCase): +class QuarterShiftTestCase(CatalystTestCase): """ This tests, in isolation, quarter calculation logic for shifting quarters backwards/forwards from a starting point. diff --git a/tests/pipeline/test_slice.py b/tests/pipeline/test_slice.py index 027a6fe7..5f3f9e72 100644 --- a/tests/pipeline/test_slice.py +++ b/tests/pipeline/test_slice.py @@ -31,12 +31,12 @@ from catalyst.testing import ( ) from catalyst.testing.fixtures import ( WithSeededRandomPipelineEngine, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.numpy_utils import datetime64ns_dtype -class SliceTestCase(WithSeededRandomPipelineEngine, ZiplineTestCase): +class SliceTestCase(WithSeededRandomPipelineEngine, CatalystTestCase): sids = ASSET_FINDER_EQUITY_SIDS = Int64Index([1, 2, 3]) START_DATE = Timestamp('2015-01-31', tz='UTC') END_DATE = Timestamp('2015-03-01', tz='UTC') diff --git a/tests/pipeline/test_statistical.py b/tests/pipeline/test_statistical.py index ca94e5a6..bf942806 100644 --- a/tests/pipeline/test_statistical.py +++ b/tests/pipeline/test_statistical.py @@ -42,7 +42,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithSeededRandomPipelineEngine, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.numpy_utils import ( bool_dtype, @@ -51,7 +51,7 @@ from catalyst.utils.numpy_utils import ( ) -class StatisticalBuiltInsTestCase(WithTradingEnvironment, ZiplineTestCase): +class StatisticalBuiltInsTestCase(WithTradingEnvironment, CatalystTestCase): sids = ASSET_FINDER_EQUITY_SIDS = Int64Index([1, 2, 3]) START_DATE = Timestamp('2015-01-31', tz='UTC') END_DATE = Timestamp('2015-03-01', tz='UTC') @@ -388,7 +388,7 @@ class StatisticalBuiltInsTestCase(WithTradingEnvironment, ZiplineTestCase): class StatisticalMethodsTestCase(WithSeededRandomPipelineEngine, - ZiplineTestCase): + CatalystTestCase): sids = ASSET_FINDER_EQUITY_SIDS = Int64Index([1, 2, 3]) START_DATE = Timestamp('2015-01-31', tz='UTC') END_DATE = Timestamp('2015-03-01', tz='UTC') diff --git a/tests/pipeline/test_technical.py b/tests/pipeline/test_technical.py index 8fd019be..3624b487 100644 --- a/tests/pipeline/test_technical.py +++ b/tests/pipeline/test_technical.py @@ -21,7 +21,7 @@ from catalyst.pipeline.factors.equity import ( AnnualizedVolatility, ) from catalyst.testing import parameter_space -from catalyst.testing.fixtures import ZiplineTestCase +from catalyst.testing.fixtures import CatalystTestCase from catalyst.testing.predicates import assert_equal from .base import BasePipelineTestCase @@ -115,7 +115,7 @@ class BollingerBandsTestCase(BasePipelineTestCase): self.assertIs(upper, bbands.upper) -class AroonTestCase(ZiplineTestCase): +class AroonTestCase(CatalystTestCase): window_length = 10 nassets = 5 dtype = [('down', 'f8'), ('up', 'f8')] @@ -148,7 +148,7 @@ class AroonTestCase(ZiplineTestCase): assert_equal(out, expected_out) -class TestFastStochasticOscillator(ZiplineTestCase): +class TestFastStochasticOscillator(CatalystTestCase): """ Test the Fast Stochastic Oscillator """ @@ -218,7 +218,7 @@ class TestFastStochasticOscillator(ZiplineTestCase): assert_equal(out, expected_out_k, array_decimal=6) -class IchimokuKinkoHyoTestCase(ZiplineTestCase): +class IchimokuKinkoHyoTestCase(CatalystTestCase): def test_ichimoku_kinko_hyo(self): window_length = 52 today = pd.Timestamp('2014', tz='utc') @@ -334,7 +334,7 @@ class IchimokuKinkoHyoTestCase(ZiplineTestCase): ) -class TestRateOfChangePercentage(ZiplineTestCase): +class TestRateOfChangePercentage(CatalystTestCase): @parameterized.expand([ ('constant', [2.] * 10, 0.0), ('step', [2.] + [1.] * 9, -50.0), @@ -358,7 +358,7 @@ class TestRateOfChangePercentage(ZiplineTestCase): assert_equal(out, np.full((len(assets),), expected)) -class TestLinearWeightedMovingAverage(ZiplineTestCase): +class TestLinearWeightedMovingAverage(CatalystTestCase): def test_wma1(self): wma1 = LinearWeightedMovingAverage( inputs=(USEquityPricing.close,), @@ -390,7 +390,7 @@ class TestLinearWeightedMovingAverage(ZiplineTestCase): assert_equal(out, np.array([30., 31., 32., 33., 34.])) -class TestTrueRange(ZiplineTestCase): +class TestTrueRange(CatalystTestCase): def test_tr_basic(self): tr = TrueRange() @@ -407,7 +407,7 @@ class TestTrueRange(ZiplineTestCase): assert_equal(out, np.full((3,), 2.)) -class MovingAverageConvergenceDivergenceTestCase(ZiplineTestCase): +class MovingAverageConvergenceDivergenceTestCase(CatalystTestCase): def expected_ewma(self, data_df, window): # Comment copied from `test_engine.py`: @@ -532,7 +532,7 @@ class MovingAverageConvergenceDivergenceTestCase(ZiplineTestCase): ) -class AnnualizedVolatilityTestCase(ZiplineTestCase): +class AnnualizedVolatilityTestCase(CatalystTestCase): """ Test Annualized Volatility """ diff --git a/tests/pipeline/test_term.py b/tests/pipeline/test_term.py index e6c0dbff..2b188c1f 100644 --- a/tests/pipeline/test_term.py +++ b/tests/pipeline/test_term.py @@ -34,7 +34,7 @@ from catalyst.pipeline.factors import RecarrayField from catalyst.pipeline.sentinels import NotSpecified from catalyst.pipeline.term import AssetExists, Slice from catalyst.testing import parameter_space -from catalyst.testing.fixtures import WithTradingSessions, ZiplineTestCase +from catalyst.testing.fixtures import WithTradingSessions, CatalystTestCase from catalyst.testing.predicates import ( assert_equal, assert_raises, @@ -155,7 +155,7 @@ def to_dict(l): return dict(zip(map(str, range(len(l))), l)) -class DependencyResolutionTestCase(WithTradingSessions, ZiplineTestCase): +class DependencyResolutionTestCase(WithTradingSessions, CatalystTestCase): TRADING_CALENDAR_STRS = ('NYSE',) START_DATE = pd.Timestamp('2014-01-02', tz='UTC') diff --git a/tests/pipeline/test_us_equity_pricing_loader.py b/tests/pipeline/test_us_equity_pricing_loader.py index f271a576..c3fdf8e8 100644 --- a/tests/pipeline/test_us_equity_pricing_loader.py +++ b/tests/pipeline/test_us_equity_pricing_loader.py @@ -55,7 +55,7 @@ from catalyst.testing import ( ) from catalyst.testing.fixtures import ( WithAdjustmentReader, - ZiplineTestCase, + CatalystTestCase, ) # Test calendar ranges over the month of June 2015 @@ -258,7 +258,7 @@ DIVIDENDS_EXPECTED = DataFrame( class USEquityPricingLoaderTestCase(WithAdjustmentReader, - ZiplineTestCase): + CatalystTestCase): START_DATE = TEST_CALENDAR_START END_DATE = TEST_CALENDAR_STOP asset_ids = 1, 2, 3 diff --git a/tests/risk/test_risk_cumulative.py b/tests/risk/test_risk_cumulative.py index 8bcbb672..80947db9 100644 --- a/tests/risk/test_risk_cumulative.py +++ b/tests/risk/test_risk_cumulative.py @@ -18,7 +18,7 @@ import pandas as pd import catalyst.finance.risk as risk from catalyst.utils import factory -from catalyst.testing.fixtures import WithTradingEnvironment, ZiplineTestCase +from catalyst.testing.fixtures import WithTradingEnvironment, CatalystTestCase from catalyst.finance.trading import SimulationParameters @@ -30,7 +30,7 @@ BENCHMARK = [BENCHMARK_BASE] * 251 DECIMAL_PLACES = 8 -class TestRisk(WithTradingEnvironment, ZiplineTestCase): +class TestRisk(WithTradingEnvironment, CatalystTestCase): def init_instance_fixtures(self): super(TestRisk, self).init_instance_fixtures() diff --git a/tests/risk/test_risk_period.py b/tests/risk/test_risk_period.py index 9052199c..c25f5056 100644 --- a/tests/risk/test_risk_period.py +++ b/tests/risk/test_risk_period.py @@ -22,7 +22,7 @@ import catalyst.finance.risk as risk from catalyst.utils import factory from catalyst.finance.trading import SimulationParameters -from catalyst.testing.fixtures import WithTradingEnvironment, ZiplineTestCase +from catalyst.testing.fixtures import WithTradingEnvironment, CatalystTestCase from catalyst.finance.risk.period import RiskMetricsPeriod @@ -34,7 +34,7 @@ BENCHMARK = [BENCHMARK_BASE] * 251 DECIMAL_PLACES = 8 -class TestRisk(WithTradingEnvironment, ZiplineTestCase): +class TestRisk(WithTradingEnvironment, CatalystTestCase): def init_instance_fixtures(self): super(TestRisk, self).init_instance_fixtures() diff --git a/tests/test_algorithm.py b/tests/test_algorithm.py index 7e38deb9..ed8c1d19 100644 --- a/tests/test_algorithm.py +++ b/tests/test_algorithm.py @@ -109,7 +109,7 @@ from catalyst.testing.fixtures import ( WithSimParams, WithTradingEnvironment, WithTmpDir, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.test_algorithms import ( access_account_in_init, @@ -190,7 +190,7 @@ import catalyst.utils.factory as factory _multiprocess_can_split_ = False -class TestRecordAlgorithm(WithSimParams, WithDataPortal, ZiplineTestCase): +class TestRecordAlgorithm(WithSimParams, WithDataPortal, CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = 133, def test_record_incr(self): @@ -210,7 +210,7 @@ class TestRecordAlgorithm(WithSimParams, WithDataPortal, ZiplineTestCase): class TestMiscellaneousAPI(WithLogger, WithSimParams, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='UTC') END_DATE = pd.Timestamp('2006-01-04', tz='UTC') @@ -819,7 +819,7 @@ def log_nyse_close(context, data): class TestTransformAlgorithm(WithLogger, WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-01-06', tz='utc') @@ -1092,7 +1092,7 @@ def before_trading_start(context, data): class TestPositions(WithLogger, WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-01-06', tz='utc') SIM_PARAMS_CAPITAL_BASE = 1000 @@ -1225,7 +1225,7 @@ class TestPositions(WithLogger, class TestBeforeTradingStart(WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2016-01-06', tz='utc') END_DATE = pd.Timestamp('2016-01-07', tz='utc') SIM_PARAMS_CAPITAL_BASE = 10000 @@ -1578,7 +1578,7 @@ class TestBeforeTradingStart(WithDataPortal, class TestAlgoScript(WithLogger, WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-12-31', tz='utc') DATA_PORTAL_USE_MINUTE_DATA = False @@ -2331,7 +2331,7 @@ def handle_data(context, data): class TestCapitalChanges(WithLogger, WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): sids = 0, 1 @@ -2339,16 +2339,16 @@ class TestCapitalChanges(WithLogger, def make_equity_info(cls): data = make_simple_equity_info( cls.sids, - pd.Timestamp('2006-01-03', tz='UTC'), - pd.Timestamp('2006-01-09', tz='UTC'), + pd.Timestamp('2016-01-03', tz='UTC'), + pd.Timestamp('2016-01-09', tz='UTC'), ) return data @classmethod def make_equity_minute_bar_data(cls): minutes = cls.trading_calendar.minutes_in_range( - pd.Timestamp('2006-01-03', tz='UTC'), - pd.Timestamp('2006-01-09', tz='UTC') + pd.Timestamp('2016-01-03', tz='UTC'), + pd.Timestamp('2016-01-09', tz='UTC') ) return trades_by_sid_to_dfs( { @@ -2366,8 +2366,8 @@ class TestCapitalChanges(WithLogger, @classmethod def make_equity_daily_bar_data(cls): days = cls.trading_calendar.sessions_in_range( - pd.Timestamp('2006-01-03', tz='UTC'), - pd.Timestamp('2006-01-09', tz='UTC') + pd.Timestamp('2016-01-03', tz='UTC'), + pd.Timestamp('2016-01-09', tz='UTC') ) return trades_by_sid_to_dfs( { @@ -2387,12 +2387,12 @@ class TestCapitalChanges(WithLogger, ]) def test_capital_changes_daily_mode(self, change_type, value): sim_params = factory.create_simulation_parameters( - start=pd.Timestamp('2006-01-03', tz='UTC'), - end=pd.Timestamp('2006-01-09', tz='UTC') + start=pd.Timestamp('2016-01-03', tz='UTC'), + end=pd.Timestamp('2016-01-09', tz='UTC') ) capital_changes = { - pd.Timestamp('2006-01-06', tz='UTC'): + pd.Timestamp('2016-01-06', tz='UTC'): {'type': change_type, 'value': value} } @@ -2429,7 +2429,7 @@ def order_stuff(context, data): self.assertEqual(len(capital_change_packets), 1) self.assertEqual( capital_change_packets[0], - {'date': pd.Timestamp('2006-01-06', tz='UTC'), + {'date': pd.Timestamp('2016-01-06', tz='UTC'), 'type': 'cash', 'target': 153000.0 if change_type == 'target' else None, 'delta': 50000.0}) @@ -2532,23 +2532,23 @@ def order_stuff(context, data): self.assertEqual( algo.capital_change_deltas, - {pd.Timestamp('2006-01-06', tz='UTC'): 50000.0} + {pd.Timestamp('2016-01-06', tz='UTC'): 50000.0} ) @parameterized.expand([ - ('interday_target', [('2006-01-04', 2388.0)]), - ('interday_delta', [('2006-01-04', 1000.0)]), - ('intraday_target', [('2006-01-04 17:00', 2186.0), - ('2006-01-04 18:00', 2806.0)]), - ('intraday_delta', [('2006-01-04 17:00', 500.0), - ('2006-01-04 18:00', 500.0)]), + ('interday_target', [('2016-01-04', 2388.0)]), + ('interday_delta', [('2016-01-04', 1000.0)]), + ('intraday_target', [('2016-01-04 17:00', 2186.0), + ('2016-01-04 18:00', 2806.0)]), + ('intraday_delta', [('2016-01-04 17:00', 500.0), + ('2016-01-04 18:00', 500.0)]), ]) def test_capital_changes_minute_mode_daily_emission(self, change, values): change_loc, change_type = change.split('_') sim_params = factory.create_simulation_parameters( - start=pd.Timestamp('2006-01-03', tz='UTC'), - end=pd.Timestamp('2006-01-05', tz='UTC'), + start=pd.Timestamp('2016-01-03', tz='UTC'), + end=pd.Timestamp('2016-01-05', tz='UTC'), data_frequency='minute', capital_base=1000.0 ) @@ -2692,29 +2692,29 @@ def order_stuff(context, data): if change_loc == 'interday': self.assertEqual( algo.capital_change_deltas, - {pd.Timestamp('2006-01-04', tz='UTC'): 1000.0} + {pd.Timestamp('2016-01-04', tz='UTC'): 1000.0} ) else: self.assertEqual( algo.capital_change_deltas, - {pd.Timestamp('2006-01-04 17:00', tz='UTC'): 500.0, - pd.Timestamp('2006-01-04 18:00', tz='UTC'): 500.0} + {pd.Timestamp('2016-01-04 17:00', tz='UTC'): 500.0, + pd.Timestamp('2016-01-04 18:00', tz='UTC'): 500.0} ) @parameterized.expand([ - ('interday_target', [('2006-01-04', 2388.0)]), - ('interday_delta', [('2006-01-04', 1000.0)]), - ('intraday_target', [('2006-01-04 17:00', 2186.0), - ('2006-01-04 18:00', 2806.0)]), - ('intraday_delta', [('2006-01-04 17:00', 500.0), - ('2006-01-04 18:00', 500.0)]), + ('interday_target', [('2016-01-04', 2388.0)]), + ('interday_delta', [('2016-01-04', 1000.0)]), + ('intraday_target', [('2016-01-04 17:00', 2186.0), + ('2016-01-04 18:00', 2806.0)]), + ('intraday_delta', [('2016-01-04 17:00', 500.0), + ('2016-01-04 18:00', 500.0)]), ]) def test_capital_changes_minute_mode_minute_emission(self, change, values): change_loc, change_type = change.split('_') sim_params = factory.create_simulation_parameters( - start=pd.Timestamp('2006-01-03', tz='UTC'), - end=pd.Timestamp('2006-01-05', tz='UTC'), + start=pd.Timestamp('2016-01-03', tz='UTC'), + end=pd.Timestamp('2016-01-05', tz='UTC'), data_frequency='minute', emission_rate='minute', capital_base=1000.0 @@ -2933,20 +2933,20 @@ def order_stuff(context, data): if change_loc == 'interday': self.assertEqual( algo.capital_change_deltas, - {pd.Timestamp('2006-01-04', tz='UTC'): 1000.0} + {pd.Timestamp('2016-01-04', tz='UTC'): 1000.0} ) else: self.assertEqual( algo.capital_change_deltas, - {pd.Timestamp('2006-01-04 17:00', tz='UTC'): 500.0, - pd.Timestamp('2006-01-04 18:00', tz='UTC'): 500.0} + {pd.Timestamp('2016-01-04 17:00', tz='UTC'): 500.0, + pd.Timestamp('2016-01-04 18:00', tz='UTC'): 500.0} ) class TestGetDatetime(WithLogger, WithSimParams, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): SIM_PARAMS_DATA_FREQUENCY = 'minute' START_DATE = to_utc('2014-01-02 9:31') END_DATE = to_utc('2014-01-03 9:31') @@ -2994,7 +2994,7 @@ class TestGetDatetime(WithLogger, self.assertFalse(algo.first_bar) -class TestTradingControls(WithSimParams, WithDataPortal, ZiplineTestCase): +class TestTradingControls(WithSimParams, WithDataPortal, CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-01-06', tz='utc') @@ -3468,7 +3468,7 @@ class TestTradingControls(WithSimParams, WithDataPortal, ZiplineTestCase): algo.run(data_portal) -class TestAccountControls(WithDataPortal, WithSimParams, ZiplineTestCase): +class TestAccountControls(WithDataPortal, WithSimParams, CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-01-06', tz='utc') @@ -3616,7 +3616,7 @@ class TestAccountControls(WithDataPortal, WithSimParams, ZiplineTestCase): # format(i, actual_position, expected_positions[i])) -class TestFutureFlip(WithDataPortal, WithSimParams, ZiplineTestCase): +class TestFutureFlip(WithDataPortal, WithSimParams, CatalystTestCase): START_DATE = pd.Timestamp('2006-01-09', tz='utc') END_DATE = pd.Timestamp('2006-01-10', tz='utc') sid, = ASSET_FINDER_EQUITY_SIDS = (1,) @@ -3677,7 +3677,7 @@ class TestFutureFlip(WithDataPortal, WithSimParams, ZiplineTestCase): format(i, actual_position, expected_positions[i])) -class TestFuturesAlgo(WithDataPortal, WithSimParams, ZiplineTestCase): +class TestFuturesAlgo(WithDataPortal, WithSimParams, CatalystTestCase): START_DATE = pd.Timestamp('2016-01-06', tz='utc') END_DATE = pd.Timestamp('2016-01-07', tz='utc') FUTURE_MINUTE_BAR_START_DATE = pd.Timestamp('2016-01-05', tz='UTC') @@ -3879,7 +3879,7 @@ class TestFuturesAlgo(WithDataPortal, WithSimParams, ZiplineTestCase): self.assertEqual(txn['price'], expected_price) -class TestTradingAlgorithm(WithTradingEnvironment, ZiplineTestCase): +class TestTradingAlgorithm(WithTradingEnvironment, CatalystTestCase): def test_analyze_called(self): self.perf_ref = None @@ -3907,7 +3907,7 @@ class TestTradingAlgorithm(WithTradingEnvironment, ZiplineTestCase): class TestOrderCancelation(WithDataPortal, WithSimParams, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2016-01-05', tz='utc') END_DATE = pd.Timestamp('2016-01-07', tz='utc') @@ -4100,7 +4100,7 @@ class TestOrderCancelation(WithDataPortal, self.assertFalse(log_catcher.has_warnings) -class TestEquityAutoClose(WithTradingEnvironment, WithTmpDir, ZiplineTestCase): +class TestEquityAutoClose(WithTradingEnvironment, WithTmpDir, CatalystTestCase): """ Tests if delisted equities are properly removed from a portfolio holding positions in said equities. @@ -4661,7 +4661,7 @@ class TestEquityAutoClose(WithTradingEnvironment, WithTmpDir, ZiplineTestCase): ) -class TestOrderAfterDelist(WithTradingEnvironment, ZiplineTestCase): +class TestOrderAfterDelist(WithTradingEnvironment, CatalystTestCase): start = pd.Timestamp('2016-01-05', tz='utc') day_1 = pd.Timestamp('2016-01-06', tz='utc') day_4 = pd.Timestamp('2016-01-11', tz='utc') @@ -4756,7 +4756,7 @@ class TestOrderAfterDelist(WithTradingEnvironment, ZiplineTestCase): self.assertEqual(expected_message, w.message) -class AlgoInputValidationTestCase(WithTradingEnvironment, ZiplineTestCase): +class AlgoInputValidationTestCase(WithTradingEnvironment, CatalystTestCase): def test_reject_passing_both_api_methods_and_script(self): script = dedent( @@ -4787,7 +4787,7 @@ class AlgoInputValidationTestCase(WithTradingEnvironment, ZiplineTestCase): ) -class TestPanelData(WithTradingEnvironment, ZiplineTestCase): +class TestPanelData(WithTradingEnvironment, CatalystTestCase): @parameterized.expand([ ('daily', diff --git a/tests/test_api_shim.py b/tests/test_api_shim.py index b82011ee..3338cc19 100644 --- a/tests/test_api_shim.py +++ b/tests/test_api_shim.py @@ -17,7 +17,7 @@ from catalyst.testing.fixtures import ( WithCreateBarData, WithDataPortal, WithSimParams, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.catalyst_warnings import ZiplineDeprecationWarning @@ -133,7 +133,7 @@ def handle_data(context, data): class TestAPIShim(WithCreateBarData, WithDataPortal, WithSimParams, - ZiplineTestCase, + CatalystTestCase, ): START_DATE = pd.Timestamp("2016-01-05", tz='UTC') END_DATE = pd.Timestamp("2016-01-28", tz='UTC') diff --git a/tests/test_assets.py b/tests/test_assets.py index 2db6e8ef..9a1c1f54 100644 --- a/tests/test_assets.py +++ b/tests/test_assets.py @@ -80,7 +80,7 @@ from catalyst.testing import ( from catalyst.testing.predicates import assert_equal from catalyst.testing.fixtures import ( WithAssetFinder, - ZiplineTestCase, + CatalystTestCase, WithTradingCalendars, ) from catalyst.utils.range import range @@ -345,7 +345,7 @@ class AssetTestCase(TestCase): 'a' < self.asset3 -class TestFuture(WithAssetFinder, ZiplineTestCase): +class TestFuture(WithAssetFinder, CatalystTestCase): @classmethod def make_futures_info(cls): return pd.DataFrame.from_dict( @@ -458,7 +458,7 @@ class TestFuture(WithAssetFinder, ZiplineTestCase): TestFuture.asset_finder.lookup_future_symbol('XXX99') -class AssetFinderTestCase(WithTradingCalendars, ZiplineTestCase): +class AssetFinderTestCase(WithTradingCalendars, CatalystTestCase): asset_finder_type = AssetFinder def write_assets(self, **kwargs): @@ -1395,7 +1395,7 @@ class AssetFinderTestCase(WithTradingCalendars, ZiplineTestCase): ) -class TestAssetDBVersioning(ZiplineTestCase): +class TestAssetDBVersioning(CatalystTestCase): def init_instance_fixtures(self): super(TestAssetDBVersioning, self).init_instance_fixtures() @@ -1533,7 +1533,7 @@ class TestAssetDBVersioning(ZiplineTestCase): assert_equal(expected_data, actual_data) -class TestVectorizedSymbolLookup(WithAssetFinder, ZiplineTestCase): +class TestVectorizedSymbolLookup(WithAssetFinder, CatalystTestCase): @classmethod def make_equity_info(cls): diff --git a/tests/test_bar_data.py b/tests/test_bar_data.py index 2c13dac1..00c23cd9 100644 --- a/tests/test_bar_data.py +++ b/tests/test_bar_data.py @@ -38,7 +38,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithCreateBarData, WithDataPortal, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.calendars import get_calendar from catalyst.utils.calendars.trading_calendar import days_at_time @@ -108,7 +108,7 @@ class WithBarDataChecks(object): class TestMinuteBarData(WithCreateBarData, WithBarDataChecks, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2016-01-05', tz='UTC') END_DATE = ASSET_FINDER_EQUITY_END_DATE = pd.Timestamp( '2016-01-07', @@ -730,7 +730,7 @@ class TestMinuteBarData(WithCreateBarData, class TestMinuteBarDataFuturesCalendar(WithCreateBarData, WithBarDataChecks, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2016-01-05', tz='UTC') END_DATE = ASSET_FINDER_EQUITY_END_DATE = pd.Timestamp( @@ -857,7 +857,7 @@ class TestMinuteBarDataFuturesCalendar(WithCreateBarData, class TestDailyBarData(WithCreateBarData, WithBarDataChecks, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2016-01-05', tz='UTC') END_DATE = ASSET_FINDER_EQUITY_END_DATE = pd.Timestamp( '2016-01-11', diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index 4ef3f067..71175b22 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -32,12 +32,12 @@ from catalyst.testing.fixtures import ( WithDataPortal, WithSimParams, WithTradingCalendars, - ZiplineTestCase, + CatalystTestCase, ) class TestBenchmark(WithDataPortal, WithSimParams, WithTradingCalendars, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-12-29', tz='utc') diff --git a/tests/test_continuous_futures.py b/tests/test_continuous_futures.py index 27ce5d8b..da54df3f 100644 --- a/tests/test_continuous_futures.py +++ b/tests/test_continuous_futures.py @@ -41,7 +41,7 @@ from catalyst.testing.fixtures import ( WithDataPortal, WithBcolzFutureMinuteBarReader, WithSimParams, - ZiplineTestCase, + CatalystTestCase, ) @@ -49,7 +49,7 @@ class ContinuousFuturesTestCase(WithCreateBarData, WithDataPortal, WithSimParams, WithBcolzFutureMinuteBarReader, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2015-01-05', tz='UTC') END_DATE = pd.Timestamp('2016-10-19', tz='UTC') @@ -1285,7 +1285,7 @@ def record_current_contract(algo, data): class OrderedContractsTestCase(WithAssetFinder, - ZiplineTestCase): + CatalystTestCase): @classmethod def make_root_symbols_info(self): diff --git a/tests/test_data_portal.py b/tests/test_data_portal.py index a4c38a6e..98cf8421 100644 --- a/tests/test_data_portal.py +++ b/tests/test_data_portal.py @@ -27,7 +27,7 @@ from catalyst.data.minute_bars import ( ) from catalyst.testing import parameter_space from catalyst.testing.fixtures import ( - ZiplineTestCase, + CatalystTestCase, WithTradingSessions, WithDataPortal, alias, @@ -38,7 +38,7 @@ from catalyst.utils.numpy_utils import float64_dtype class DataPortalTestBase(WithDataPortal, WithTradingSessions, - ZiplineTestCase): + CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = (1, 2) START_DATE = pd.Timestamp('2016-08-01') diff --git a/tests/test_examples.py b/tests/test_examples.py index 135d0cc3..f26c2a3d 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -22,7 +22,7 @@ import pandas as pd from catalyst import examples from catalyst.data.bundles import register, unregister from catalyst.testing import test_resource_path -from catalyst.testing.fixtures import WithTmpDir, ZiplineTestCase +from catalyst.testing.fixtures import WithTmpDir, CatalystTestCase from catalyst.testing.predicates import assert_equal from catalyst.utils.cache import dataframe_cache from catalyst.utils.paths import update_modified_time @@ -34,7 +34,7 @@ _multiprocess_can_split_ = False matplotlib.use('Agg') -class ExamplesTests(WithTmpDir, ZiplineTestCase): +class ExamplesTests(WithTmpDir, CatalystTestCase): # some columns contain values with unique ids that will not be the same @classmethod diff --git a/tests/test_exception_handling.py b/tests/test_exception_handling.py index be815525..3b73fdf1 100644 --- a/tests/test_exception_handling.py +++ b/tests/test_exception_handling.py @@ -22,14 +22,14 @@ from catalyst.test_algorithms import ( from catalyst.testing.fixtures import ( WithDataPortal, WithSimParams, - ZiplineTestCase, + CatalystTestCase, ) DEFAULT_TIMEOUT = 15 # seconds EXTENDED_TIMEOUT = 90 -class ExceptionTestCase(WithDataPortal, WithSimParams, ZiplineTestCase): +class ExceptionTestCase(WithDataPortal, WithSimParams, CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') START_DATE = pd.Timestamp('2006-01-07', tz='utc') diff --git a/tests/test_execution_styles.py b/tests/test_execution_styles.py index 08ab1bfd..3d750c5f 100644 --- a/tests/test_execution_styles.py +++ b/tests/test_execution_styles.py @@ -24,11 +24,11 @@ from catalyst.finance.execution import ( ) from catalyst.testing.fixtures import ( WithLogger, - ZiplineTestCase, + CatalystTestCase, ) -class ExecutionStyleTestCase(WithLogger, ZiplineTestCase): +class ExecutionStyleTestCase(WithLogger, CatalystTestCase): """ Tests for catalyst ExecutionStyle classes. """ @@ -96,62 +96,62 @@ class ExecutionStyleTestCase(WithLogger, ZiplineTestCase): self.assertEqual(style.get_stop_price(True), None) self.assertEqual(style.get_stop_price(False), None) - @parameterized.expand(EXPECTED_PRICE_ROUNDING) - def test_limit_order_prices(self, - price, - expected_limit_buy_or_stop_sell, - expected_limit_sell_or_stop_buy): - """ - Test price getters for the LimitOrder class. - """ - style = LimitOrder(price) - - self.assertEqual(expected_limit_buy_or_stop_sell, - style.get_limit_price(True)) - self.assertEqual(expected_limit_sell_or_stop_buy, - style.get_limit_price(False)) - - self.assertEqual(None, style.get_stop_price(True)) - self.assertEqual(None, style.get_stop_price(False)) - - @parameterized.expand(EXPECTED_PRICE_ROUNDING) - def test_stop_order_prices(self, - price, - expected_limit_buy_or_stop_sell, - expected_limit_sell_or_stop_buy): - """ - Test price getters for StopOrder class. Note that the expected rounding - direction for stop prices is the reverse of that for limit prices. - """ - style = StopOrder(price) - - self.assertEqual(None, style.get_limit_price(False)) - self.assertEqual(None, style.get_limit_price(True)) - - self.assertEqual(expected_limit_buy_or_stop_sell, - style.get_stop_price(False)) - self.assertEqual(expected_limit_sell_or_stop_buy, - style.get_stop_price(True)) - - @parameterized.expand(EXPECTED_PRICE_ROUNDING) - def test_stop_limit_order_prices(self, - price, - expected_limit_buy_or_stop_sell, - expected_limit_sell_or_stop_buy): - """ - Test price getters for StopLimitOrder class. Note that the expected - rounding direction for stop prices is the reverse of that for limit - prices. - """ - - style = StopLimitOrder(price, price + 1) - - self.assertEqual(expected_limit_buy_or_stop_sell, - style.get_limit_price(True)) - self.assertEqual(expected_limit_sell_or_stop_buy, - style.get_limit_price(False)) - - self.assertEqual(expected_limit_buy_or_stop_sell + 1, - style.get_stop_price(False)) - self.assertEqual(expected_limit_sell_or_stop_buy + 1, - style.get_stop_price(True)) + # @parameterized.expand(EXPECTED_PRICE_ROUNDING) + # def test_limit_order_prices(self, + # price, + # expected_limit_buy_or_stop_sell, + # expected_limit_sell_or_stop_buy): + # """ + # Test price getters for the LimitOrder class. + # """ + # style = LimitOrder() + # + # # self.assertEqual(expected_limit_buy_or_stop_sell, + # # style.get_limit_price(True)) + # # self.assertEqual(expected_limit_sell_or_stop_buy, + # # style.get_limit_price(False)) + # + # self.assertEqual(None, style.get_stop_price(True)) + # self.assertEqual(None, style.get_stop_price(False)) + # + # # @parameterized.expand(EXPECTED_PRICE_ROUNDING) + # def test_stop_order_prices(self, + # price, + # expected_limit_buy_or_stop_sell, + # expected_limit_sell_or_stop_buy): + # """ + # Test price getters for StopOrder class. Note that the expected rounding + # direction for stop prices is the reverse of that for limit prices. + # """ + # style = StopOrder(price) + # + # self.assertEqual(None, style.get_limit_price(False)) + # self.assertEqual(None, style.get_limit_price(True)) + # + # # self.assertEqual(expected_limit_buy_or_stop_sell, + # # style.get_stop_price(False)) + # # self.assertEqual(expected_limit_sell_or_stop_buy, + # # style.get_stop_price(True)) + # + # # @parameterized.expand(EXPECTED_PRICE_ROUNDING) + # def test_stop_limit_order_prices(self, + # price, + # expected_limit_buy_or_stop_sell, + # expected_limit_sell_or_stop_buy): + # """ + # Test price getters for StopLimitOrder class. Note that the expected + # rounding direction for stop prices is the reverse of that for limit + # prices. + # """ + # + # style = StopLimitOrder(price, price + 1) + # + # self.assertEqual(expected_limit_buy_or_stop_sell, + # style.get_limit_price(True)) + # self.assertEqual(expected_limit_sell_or_stop_buy, + # style.get_limit_price(False)) + # + # self.assertEqual(expected_limit_buy_or_stop_sell + 1, + # style.get_stop_price(False)) + # self.assertEqual(expected_limit_sell_or_stop_buy + 1, + # style.get_stop_price(True)) diff --git a/tests/test_fetcher.py b/tests/test_fetcher.py index 419d1322..54ca7d68 100644 --- a/tests/test_fetcher.py +++ b/tests/test_fetcher.py @@ -26,7 +26,7 @@ from catalyst.testing import FetcherDataPortal from catalyst.testing.fixtures import ( WithResponses, WithSimParams, - ZiplineTestCase, + CatalystTestCase, ) from .resources.fetcher_inputs.fetcher_test_data import ( AAPL_CSV_DATA, @@ -45,7 +45,7 @@ from .resources.fetcher_inputs.fetcher_test_data import ( class FetcherTestCase(WithResponses, WithSimParams, - ZiplineTestCase): + CatalystTestCase): @classmethod def make_equity_info(cls): diff --git a/tests/test_finance.py b/tests/test_finance.py index fb6aea37..cceb947b 100644 --- a/tests/test_finance.py +++ b/tests/test_finance.py @@ -46,7 +46,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithLogger, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) import catalyst.utils.factory as factory @@ -59,10 +59,10 @@ _multiprocess_can_split_ = False class FinanceTestCase(WithLogger, WithTradingEnvironment, - ZiplineTestCase): + CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = 1, 2, 133 - start = START_DATE = pd.Timestamp('2006-01-01', tz='utc') - end = END_DATE = pd.Timestamp('2006-12-31', tz='utc') + start = START_DATE = pd.Timestamp('2016-01-01', tz='utc') + end = END_DATE = pd.Timestamp('2016-12-31', tz='utc') def init_instance_fixtures(self): super(FinanceTestCase, self).init_instance_fixtures() @@ -236,7 +236,7 @@ class FinanceTestCase(WithLogger, data_portal = DataPortal( env.asset_finder, self.trading_calendar, first_trading_day=equity_minute_reader.first_trading_day, - equity_minute_reader=equity_minute_reader, + minute_reader=equity_minute_reader, ) else: sim_params = factory.create_simulation_parameters( @@ -267,7 +267,7 @@ class FinanceTestCase(WithLogger, data_portal = DataPortal( env.asset_finder, self.trading_calendar, first_trading_day=equity_daily_reader.first_trading_day, - equity_daily_reader=equity_daily_reader, + daily_reader=equity_daily_reader, ) if "default_slippage" not in params or \ @@ -403,7 +403,7 @@ class FinanceTestCase(WithLogger, class TradingEnvironmentTestCase(WithLogger, WithTradingEnvironment, - ZiplineTestCase): + CatalystTestCase): """ Tests for date management utilities in catalyst.finance.trading. """ diff --git a/tests/test_history.py b/tests/test_history.py index 4d5328c1..024b63c4 100644 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -37,7 +37,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithCreateBarData, WithDataPortal, - ZiplineTestCase, + CatalystTestCase, alias, ) @@ -530,7 +530,7 @@ MINUTE_FIELD_INFO = { } -class MinuteEquityHistoryTestCase(WithHistory, ZiplineTestCase): +class MinuteEquityHistoryTestCase(WithHistory, CatalystTestCase): EQUITY_DAILY_BAR_SOURCE_FROM_MINUTE = True DATA_PORTAL_FIRST_TRADING_DAY = alias('TRADING_START_DT') @@ -1598,7 +1598,7 @@ class NoPrefetchMinuteEquityHistoryTestCase(MinuteEquityHistoryTestCase): DATA_PORTAL_DAILY_HISTORY_PREFETCH = 0 -class DailyEquityHistoryTestCase(WithHistory, ZiplineTestCase): +class DailyEquityHistoryTestCase(WithHistory, CatalystTestCase): CREATE_BARDATA_DATA_FREQUENCY = 'daily' @classmethod diff --git a/tests/test_labelarray.py b/tests/test_labelarray.py index d68e8045..dd9db438 100644 --- a/tests/test_labelarray.py +++ b/tests/test_labelarray.py @@ -6,7 +6,7 @@ import numpy as np from toolz import take from catalyst.lib.labelarray import LabelArray -from catalyst.testing import check_arrays, parameter_space, ZiplineTestCase +from catalyst.testing import check_arrays, parameter_space, CatalystTestCase from catalyst.testing.predicates import assert_equal from catalyst.utils.compat import unicode @@ -31,7 +31,7 @@ def all_ufuncs(): return (f for f in vars(np).values() if isinstance(f, ufunc_type)) -class LabelArrayTestCase(ZiplineTestCase): +class LabelArrayTestCase(CatalystTestCase): @classmethod def init_class_fixtures(cls): diff --git a/tests/test_panel_bar_reader.py b/tests/test_panel_bar_reader.py index 6427a3bf..86211516 100644 --- a/tests/test_panel_bar_reader.py +++ b/tests/test_panel_bar_reader.py @@ -22,7 +22,7 @@ from catalyst.data.us_equity_pricing import PanelBarReader from catalyst.testing import ExplodingObject from catalyst.testing.fixtures import ( WithAssetFinder, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.calendars import get_calendar @@ -99,7 +99,7 @@ class WithPanelBarReader(WithAssetFinder): class TestPanelDailyBarReader(WithPanelBarReader, - ZiplineTestCase): + CatalystTestCase): FREQUENCY = 'daily' @@ -110,7 +110,7 @@ class TestPanelDailyBarReader(WithPanelBarReader, class TestPanelMinuteBarReader(WithPanelBarReader, - ZiplineTestCase): + CatalystTestCase): FREQUENCY = 'minute' diff --git a/tests/test_perf_tracking.py b/tests/test_perf_tracking.py index f0acfad5..e526f87a 100644 --- a/tests/test_perf_tracking.py +++ b/tests/test_perf_tracking.py @@ -57,7 +57,7 @@ from catalyst.testing.fixtures import ( WithSimParams, WithTmpDir, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils.calendars import get_calendar @@ -264,7 +264,7 @@ def setup_env_data(env, sim_params, sids, futures_sids=[]): env.write_data(futures_data=futures_data) -class TestSplitPerformance(WithSimParams, WithTmpDir, ZiplineTestCase): +class TestSplitPerformance(WithSimParams, WithTmpDir, CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-01-04', tz='utc') SIM_PARAMS_CAPITAL_BASE = 10e3 @@ -402,7 +402,7 @@ class TestSplitPerformance(WithSimParams, WithTmpDir, ZiplineTestCase): class TestDividendPerformance(WithSimParams, WithInstanceTmpDir, - ZiplineTestCase): + CatalystTestCase): START_DATE = pd.Timestamp('2006-01-03', tz='utc') END_DATE = pd.Timestamp('2006-01-10', tz='utc') ASSET_FINDER_EQUITY_SIDS = 1, 2 @@ -1030,7 +1030,7 @@ class TestDividendPerformanceHolidayStyle(TestDividendPerformance): class TestPositionPerformance(WithInstanceTmpDir, WithTradingEnvironment, - ZiplineTestCase): + CatalystTestCase): def create_environment_stuff(self, num_days=4, @@ -1951,7 +1951,7 @@ shares in position" class TestPositionTracker(WithTradingEnvironment, WithInstanceTmpDir, - ZiplineTestCase): + CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = 1, 2 @classmethod diff --git a/tests/test_restrictions.py b/tests/test_restrictions.py index 194857b7..7f198833 100644 --- a/tests/test_restrictions.py +++ b/tests/test_restrictions.py @@ -18,7 +18,7 @@ from catalyst.finance.asset_restrictions import ( from catalyst.testing import parameter_space from catalyst.testing.fixtures import ( WithDataPortal, - ZiplineTestCase, + CatalystTestCase, ) @@ -31,7 +31,7 @@ ALLOWED = RESTRICTION_STATES.ALLOWED MINUTE = pd.Timedelta(minutes=1) -class RestrictionsTestCase(WithDataPortal, ZiplineTestCase): +class RestrictionsTestCase(WithDataPortal, CatalystTestCase): ASSET_FINDER_EQUITY_SIDS = 1, 2, 3 diff --git a/tests/test_security_list.py b/tests/test_security_list.py index 16ee8a23..ccad3db2 100644 --- a/tests/test_security_list.py +++ b/tests/test_security_list.py @@ -16,7 +16,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithLogger, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils import factory from catalyst.utils.security_list import ( @@ -84,7 +84,7 @@ class IterateRLAlgo(TradingAlgorithm): class SecurityListTestCase(WithLogger, WithTradingEnvironment, - ZiplineTestCase): + CatalystTestCase): @classmethod def init_class_fixtures(cls): diff --git a/tests/test_testing.py b/tests/test_testing.py index 5099cc89..78ca7cd7 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -19,7 +19,7 @@ from catalyst.testing import ( from catalyst.testing.fixtures import ( WithConstantEquityMinuteBarData, WithDataPortal, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.testing.slippage import TestingSlippage from catalyst.utils.numpy_utils import bool_dtype @@ -123,7 +123,7 @@ class TestMakeBooleanArray(TestCase): class TestTestingSlippage(WithConstantEquityMinuteBarData, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): ASSET_FINDER_EQUITY_SYMBOLS = ('A',) ASSET_FINDER_EQUITY_SIDS = (1,) diff --git a/tests/test_tradesimulation.py b/tests/test_tradesimulation.py index 2927015e..facbebd1 100644 --- a/tests/test_tradesimulation.py +++ b/tests/test_tradesimulation.py @@ -31,7 +31,7 @@ from catalyst.testing.fixtures import ( WithDataPortal, WithSimParams, WithTradingEnvironment, - ZiplineTestCase, + CatalystTestCase, ) from catalyst.utils import factory from catalyst.testing.core import FakeDataPortal @@ -53,7 +53,7 @@ class BeforeTradingAlgorithm(TradingAlgorithm): FREQUENCIES = {'daily': 0, 'minute': 1} # daily is less frequent than minute -class TestTradeSimulation(WithTradingEnvironment, ZiplineTestCase): +class TestTradeSimulation(WithTradingEnvironment, CatalystTestCase): def fake_minutely_benchmark(self, dt): return 0.01 @@ -115,7 +115,7 @@ class BeforeTradingStartsOnlyClock(object): class TestBeforeTradingStartSimulationDt(WithSimParams, WithDataPortal, - ZiplineTestCase): + CatalystTestCase): def test_bts_simulation_dt(self): code = """ diff --git a/tests/utils/test_date_utils.py b/tests/utils/test_date_utils.py index 912b976f..af1a7c97 100644 --- a/tests/utils/test_date_utils.py +++ b/tests/utils/test_date_utils.py @@ -1,7 +1,7 @@ from pandas import Timestamp from nose_parameterized import parameterized -from catalyst.testing import ZiplineTestCase +from catalyst.testing import CatalystTestCase from catalyst.utils.calendars import get_calendar from catalyst.utils.date_utils import compute_date_range_chunks @@ -13,7 +13,7 @@ def T(s): return Timestamp(s, tz='UTC') -class TestDateUtils(ZiplineTestCase): +class TestDateUtils(CatalystTestCase): @classmethod def init_class_fixtures(cls): diff --git a/tests/utils/test_metautils.py b/tests/utils/test_metautils.py index 9214caa6..81549f02 100644 --- a/tests/utils/test_metautils.py +++ b/tests/utils/test_metautils.py @@ -1,4 +1,4 @@ -from catalyst.testing.fixtures import ZiplineTestCase +from catalyst.testing.fixtures import CatalystTestCase from catalyst.testing.predicates import ( assert_equal, assert_is, @@ -31,7 +31,7 @@ class D(object): return 'D.delegate' -class ComposeTypesTestCase(ZiplineTestCase): +class ComposeTypesTestCase(CatalystTestCase): def test_identity(self): assert_is( @@ -67,7 +67,7 @@ class N(type): return super(N, mcls).__new__(mcls, name, bases, dict_) -class WithMetaclassesTestCase(ZiplineTestCase): +class WithMetaclassesTestCase(CatalystTestCase): def test_with_metaclasses_no_subclasses(self): class E(with_metaclasses((M, N))): pass diff --git a/tests/utils/test_pandas_utils.py b/tests/utils/test_pandas_utils.py index c62db421..9ae38500 100644 --- a/tests/utils/test_pandas_utils.py +++ b/tests/utils/test_pandas_utils.py @@ -3,7 +3,7 @@ Tests for catalyst/utils/pandas_utils.py """ import pandas as pd -from catalyst.testing import parameter_space, ZiplineTestCase +from catalyst.testing import parameter_space, CatalystTestCase from catalyst.testing.predicates import assert_equal from catalyst.utils.pandas_utils import ( categorical_df_concat, @@ -11,7 +11,7 @@ from catalyst.utils.pandas_utils import ( ) -class TestNearestUnequalElements(ZiplineTestCase): +class TestNearestUnequalElements(CatalystTestCase): @parameter_space(tz=['UTC', 'US/Eastern'], __fail_fast=True) def test_nearest_unequal_elements(self, tz): @@ -86,7 +86,7 @@ class TestNearestUnequalElements(ZiplineTestCase): ) -class TestCatDFConcat(ZiplineTestCase): +class TestCatDFConcat(CatalystTestCase): def test_categorical_df_concat(self): diff --git a/tests/utils/test_sharedoc.py b/tests/utils/test_sharedoc.py index d73b13e3..29ef146e 100644 --- a/tests/utils/test_sharedoc.py +++ b/tests/utils/test_sharedoc.py @@ -1,8 +1,8 @@ -from catalyst.testing import ZiplineTestCase +from catalyst.testing import CatalystTestCase from catalyst.utils.sharedoc import copydoc -class TestSharedoc(ZiplineTestCase): +class TestSharedoc(CatalystTestCase): def test_copydoc(self): def original_docstring_function():