mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-03 12:40:47 +08:00
TST: Adds asset type verification to test_order tests
This commit is contained in:
+11
-1
@@ -23,6 +23,7 @@ from unittest import TestCase
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from zipline.assets import Equity, Future
|
||||
from zipline.utils.api_support import ZiplineAPI
|
||||
from zipline.utils.control_flow import nullctx
|
||||
from zipline.utils.test_utils import (
|
||||
@@ -91,7 +92,6 @@ from zipline.sources import (SpecificEquityTrades,
|
||||
DataFrameSource,
|
||||
DataPanelSource,
|
||||
RandomWalkSource)
|
||||
from zipline.assets import Equity
|
||||
|
||||
from zipline.finance.execution import LimitOrder
|
||||
from zipline.finance.trading import SimulationParameters
|
||||
@@ -797,6 +797,11 @@ class TestTransformAlgorithm(TestCase):
|
||||
sim_params=self.sim_params,
|
||||
env=self.env,
|
||||
)
|
||||
|
||||
# Ensure that the environment's asset 0 is an Equity
|
||||
asset_to_test = algo.sid(0)
|
||||
self.assertIsInstance(asset_to_test, Equity)
|
||||
|
||||
algo.run(self.df)
|
||||
|
||||
@parameterized.expand([
|
||||
@@ -811,6 +816,11 @@ class TestTransformAlgorithm(TestCase):
|
||||
sim_params=self.sim_params,
|
||||
env=self.futures_env,
|
||||
)
|
||||
|
||||
# Ensure that the environment's asset 0 is a Future
|
||||
asset_to_test = algo.sid(0)
|
||||
self.assertIsInstance(asset_to_test, Future)
|
||||
|
||||
algo.run(self.df)
|
||||
|
||||
def test_order_method_style_forwarding(self):
|
||||
|
||||
Reference in New Issue
Block a user