Skip to content

Commit

Permalink
backport tests for current get/setstate format
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Aug 10, 2012
1 parent 1894c8d commit c3eb124
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/DateTime/tests/testDateTime.py
Expand Up @@ -257,6 +257,24 @@ def test_strftime_old_instance(self):
from cPickle import dumps, loads
self.assertEqual(loads(dumps(dt)).strftime('%Y'), '2001')

def test_pickle(self):
dt = DateTime()
data = cPickle.dumps(dt, 1)
new = cPickle.loads(data)
self.assertEqual(dt.__dict__, new.__dict__)

def test_pickle_with_tz(self):
dt = DateTime('2002/5/2 8:00am GMT+8')
data = cPickle.dumps(dt, 1)
new = cPickle.loads(data)
self.assertEqual(dt.__dict__, new.__dict__)

def test_pickle_with_micros(self):
dt = DateTime('2002/5/2 8:00:14.123 GMT+8')
data = cPickle.dumps(dt, 1)
new = cPickle.loads(data)
self.assertEqual(dt.__dict__, new.__dict__)

def test_pickle_old(self):
dt = DateTime('2002/5/2 8:00am GMT+0')
data = ('(cDateTime.DateTime\nDateTime\nq\x01Noq\x02}q\x03(U\x05_amonq'
Expand Down

0 comments on commit c3eb124

Please sign in to comment.