mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-27 21:36:39 +08:00
BUG: Fix and test getting all default calendars
This commit is contained in:
@@ -27,6 +27,7 @@ from pandas import read_csv
|
||||
from pandas.tslib import Timedelta
|
||||
from pandas.util.testing import assert_index_equal
|
||||
from pytz import timezone
|
||||
from toolz import concat
|
||||
|
||||
from zipline.errors import (
|
||||
CalendarNameCollision,
|
||||
@@ -38,7 +39,8 @@ from zipline.utils.calendars import(
|
||||
deregister_calendar,
|
||||
get_calendar,
|
||||
)
|
||||
from zipline.utils.calendars.calendar_utils import register_calendar_type
|
||||
from zipline.utils.calendars.calendar_utils import register_calendar_type, \
|
||||
_default_calendar_factories
|
||||
from zipline.utils.calendars.trading_calendar import days_at_time, \
|
||||
TradingCalendar
|
||||
|
||||
@@ -119,6 +121,13 @@ class CalendarRegistrationTestCase(TestCase):
|
||||
self.assertNotEqual(first_dummy, second_dummy)
|
||||
|
||||
|
||||
class DefaultsTestCase(TestCase):
|
||||
def test_default_calendars(self):
|
||||
for name in concat(_default_calendar_factories):
|
||||
self.assertIsNotNone(get_calendar(name),
|
||||
"get_calendar(%r) returned None" % name)
|
||||
|
||||
|
||||
class DaysAtTimeTestCase(TestCase):
|
||||
@parameterized.expand([
|
||||
# NYSE standard day
|
||||
|
||||
@@ -202,7 +202,7 @@ class BMFExchangeCalendar(TradingCalendar):
|
||||
|
||||
@property
|
||||
def tz(self):
|
||||
return timezone("America/Sao_Paolo")
|
||||
return timezone("America/Sao_Paulo")
|
||||
|
||||
@property
|
||||
def open_time(self):
|
||||
|
||||
@@ -27,6 +27,7 @@ MayBank = Holiday(
|
||||
"Early May Bank Holiday",
|
||||
month=5,
|
||||
offset=DateOffset(weekday=MO(1)),
|
||||
day=1,
|
||||
)
|
||||
# Spring bank holiday
|
||||
SpringBank = Holiday(
|
||||
|
||||
Reference in New Issue
Block a user