mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-01 14:51:47 +08:00
Merge pull request #1230 from quantopian/pipeline-example
DOC/TEST: Add example algo using Pipeline.
This commit is contained in:
@@ -3936,3 +3936,33 @@ class TestOrderAfterDelist(WithTradingEnvironment, ZiplineTestCase):
|
||||
"asset will be liquidated on "
|
||||
"2016-01-11 00:00:00+00:00.",
|
||||
w.message)
|
||||
|
||||
|
||||
class AlgoInputValidationTestCase(ZiplineTestCase):
|
||||
|
||||
def test_reject_passing_both_api_methods_and_script(self):
|
||||
script = dedent(
|
||||
"""
|
||||
def initialize(context):
|
||||
pass
|
||||
|
||||
def handle_data(context, data):
|
||||
pass
|
||||
|
||||
def before_trading_start(context, data):
|
||||
pass
|
||||
|
||||
def analyze(context, results):
|
||||
pass
|
||||
"""
|
||||
)
|
||||
for method in ('initialize',
|
||||
'handle_data',
|
||||
'before_trading_start',
|
||||
'analyze'):
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
TradingAlgorithm(
|
||||
script=script,
|
||||
**{method: lambda *args, **kwargs: None}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user