mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Merge the test part of the below checkin to the sandbox and Zope3, so
the tests will remain in sync: """ Tres discovered a weird bug when a datetime is pickled, caused by the shadowing of __year, __month, __day and the use of proxies. Here's a quick fix and a quick unit test. I don't quite understand why this wasn't caught by the pickling unit tests. """
This commit is contained in:
parent
cef9db6db5
commit
275666fd50
1 changed files with 8 additions and 0 deletions
|
@ -1176,6 +1176,14 @@ class TestDateTime(TestDate):
|
||||||
derived = unpickler.loads(green)
|
derived = unpickler.loads(green)
|
||||||
self.assertEqual(orig, derived)
|
self.assertEqual(orig, derived)
|
||||||
|
|
||||||
|
def test_more_pickling(self):
|
||||||
|
a = self.theclass(2003, 2, 7, 16, 48, 37, 444116)
|
||||||
|
s = pickle.dumps(a)
|
||||||
|
b = pickle.loads(s)
|
||||||
|
self.assertEqual(b.year, 2003)
|
||||||
|
self.assertEqual(b.month, 2)
|
||||||
|
self.assertEqual(b.day, 7)
|
||||||
|
|
||||||
def test_more_compare(self):
|
def test_more_compare(self):
|
||||||
# The test_compare() inherited from TestDate covers the error cases.
|
# The test_compare() inherited from TestDate covers the error cases.
|
||||||
# We just want to test lexicographic ordering on the members datetime
|
# We just want to test lexicographic ordering on the members datetime
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue