Files
catalyst/tests/test_doctests.py
T
Scott Sanderson ef4f642e62 ENH: Compute engine architecture for FFC API.
This patch lays the groundwork for a compute engine designed to
facilitate construction of factor-based universe screening and portfolio
allocation.  It contains:

A new module, `zipline.modelling`, containing entities that can be used
to express computations as dependency graphs.  Each node in such a graph
is an instance of the base `Term` class, defined in
`zipline.modelling.term`.  Dependency graphs are executed by instances
of `FFCEngine`, defined in `zipline.modelling.engine`.

A new module, `zipline.data.ffc`, containing loaders and dataset
definitions for inputs to the modelling API.

New `TradingAlgorithm` api methods: `add_factor`, and `add_filter`.
These methods can only be called from `initialize`, and are used to
inform the algorithm that each day it should compute the given terms.
Computed factor results are made available through a new attribute of
the `data` object in `before_trading_start` and `handle_data`.  Computed
filter results control which assets are available in the factor matrix
on each day.
2015-07-29 12:30:46 -04:00

55 lines
1.5 KiB
Python

from __future__ import print_function
import sys
import doctest
from unittest import TestCase
from zipline.lib import adjustment
from zipline.modelling import (
engine,
expression,
)
from zipline.utils import (
lazyval,
test_utils,
)
class DoctestTestCase(TestCase):
@classmethod
def setUpClass(cls):
import pdb
# Workaround for the issue addressed by this (unmerged) PR to pdbpp:
# https://bitbucket.org/antocuni/pdb/pull-request/40/fix-ensure_file_can_write_unicode/diff # noqa
if '_pdbpp_path_hack' in pdb.__file__:
cls._skip = True
else:
cls._skip = False
def _check_docs(self, module):
if self._skip:
# Printing this directly to __stdout__ so that it doesn't get
# captured by nose.
print("Warning: Skipping doctests for %s because "
"pdbpp is installed." % module.__name__, file=sys.__stdout__)
return
try:
doctest.testmod(module, verbose=True, raise_on_error=True)
except doctest.UnexpectedException as e:
raise e.exc_info[1]
def test_adjustment_docs(self):
self._check_docs(adjustment)
def test_expression_docs(self):
self._check_docs(expression)
def test_engine_docs(self):
self._check_docs(engine)
def test_lazyval_docs(self):
self._check_docs(lazyval)
def test_test_utils_docs(self):
self._check_docs(test_utils)