Ensure 'c.iso8601.FixedOffsets' unpickle cleanly under Py3k.
This commit is contained in:
@@ -13,6 +13,9 @@ Features
|
||||
Bug Fixes
|
||||
~~~~~~~~~
|
||||
|
||||
- Ensure that ``colander.iso8601.FixedOffset`` instances can be unpickled
|
||||
cleanly under Py3k.
|
||||
|
||||
- Avoid validating strings as sequences under Py3k.
|
||||
|
||||
- Sync documentation with 0.9.9 change to use ``insert_before`` rather than
|
||||
|
@@ -69,7 +69,7 @@ class FixedOffset(tzinfo):
|
||||
"""Fixed offset in hours and minutes from UTC
|
||||
|
||||
"""
|
||||
def __init__(self, offset_hours, offset_minutes, name):
|
||||
def __init__(self, offset_hours=0, offset_minutes=0, name='unknown'):
|
||||
self.__offset = timedelta(hours=offset_hours, minutes=offset_minutes)
|
||||
self.__name = name
|
||||
|
||||
|
@@ -28,6 +28,16 @@ class Test_FixedOffset(unittest.TestCase):
|
||||
from ..iso8601 import FixedOffset
|
||||
return FixedOffset(1, 30, 'oneandahalf')
|
||||
|
||||
def test_ctor_defaults(self):
|
||||
# Ensure that instances can be unpickled on Py3k
|
||||
from ..iso8601 import FixedOffset
|
||||
NOW = datetime.datetime.now()
|
||||
ZULU = datetime.timedelta(0, 0)
|
||||
inst = FixedOffset()
|
||||
self.assertEqual(inst.tzname(NOW), 'unknown')
|
||||
self.assertEqual(inst.utcoffset(NOW), ZULU)
|
||||
self.assertEqual(inst.dst(NOW), ZULU)
|
||||
|
||||
def test_utcoffset(self):
|
||||
inst = self._makeOne()
|
||||
result = inst.utcoffset(None)
|
||||
|
Reference in New Issue
Block a user