mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-28 18:09:32 +08:00
BUG: Remove set_trace and add test coverage.
This commit is contained in:
@@ -23,7 +23,6 @@ import pandas as pd
|
||||
from six import iteritems
|
||||
from six.moves import range, map
|
||||
|
||||
from zipline.testing import parameter_space
|
||||
import zipline.utils.events
|
||||
from zipline.utils.calendars import get_calendar
|
||||
from zipline.utils.events import (
|
||||
@@ -454,13 +453,25 @@ class StatelessRulesTests(RuleTestCase):
|
||||
rule_type(n=3.0) # Should trigger a warning about float coercion.
|
||||
|
||||
self.assertEqual(len(raised_warnings), 1)
|
||||
warning_str = raised_warnings[0].message.message
|
||||
|
||||
# We only implicitly convert from float to int when there's no loss of
|
||||
# precision.
|
||||
with self.assertRaises(TypeError):
|
||||
rule_type(3.1)
|
||||
|
||||
def test_invalid_offsets(self):
|
||||
with self.assertRaises(ValueError):
|
||||
NthTradingDayOfWeek(5)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
NthTradingDayOfWeek(-1)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
NthTradingDayOfMonth(-1)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
NthTradingDayOfMonth(24)
|
||||
|
||||
|
||||
class StatefulRulesTests(RuleTestCase):
|
||||
CALENDAR_STRING = "NYSE"
|
||||
|
||||
@@ -434,7 +434,6 @@ class TradingDayOfWeekRule(six.with_metaclass(ABCMeta, StatelessRule)):
|
||||
@preprocess(n=lossless_float_to_int('TradingDayOfWeekRule'))
|
||||
def __init__(self, n, invert):
|
||||
if not 0 <= n < MAX_WEEK_RANGE:
|
||||
import nose.tools; nose.tools.set_trace()
|
||||
raise _out_of_range_error(MAX_WEEK_RANGE)
|
||||
|
||||
self.td_delta = (-n - 1) if invert else n
|
||||
|
||||
Reference in New Issue
Block a user