MAINT: Use six for Python 3 compatible names and behavior.

Use the six module to import functions and types that are
consistent between Python 2 and 3, so that one code base can
support both versions.

- Use integer types instead of int and long.
- Use string_types instead of basestring.
- Account for iteritems, itervalues, iterkeys.
- Use six.moves for filter and zip, reduce
- Use compatible bytes for md5 hasher.
- xrange and range
This commit is contained in:
Eddie Hebert
2014-01-07 11:33:50 -05:00
parent 40c8c38257
commit b4959e46cf
21 changed files with 95 additions and 47 deletions
+4 -2
View File
@@ -20,6 +20,8 @@ import pandas as pd
from datetime import timedelta, datetime
from unittest import TestCase
from six.moves import range
from zipline.utils.test_utils import setup_logger
from zipline.protocol import Event
@@ -64,7 +66,7 @@ class TestEventWindow(TestCase):
self.monday = datetime(2012, 7, 9, 16, tzinfo=pytz.utc)
self.eleven_normal_days = [self.monday + i * timedelta(days=1)
for i in xrange(11)]
for i in range(11)]
# Modify the end of the period slightly to exercise the
# incomplete day logic.
@@ -75,7 +77,7 @@ class TestEventWindow(TestCase):
# Second set of dates to test holiday handling.
self.jul4_monday = datetime(2012, 7, 2, 16, tzinfo=pytz.utc)
self.week_of_jul4 = [self.jul4_monday + i * timedelta(days=1)
for i in xrange(5)]
for i in range(5)]
def test_market_aware_window_normal_week(self):
window = NoopEventWindow(