summaryrefslogtreecommitdiff
path: root/Lib/test/test_datetime.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-02-07 21:49:01 +0000
committerGuido van Rossum <guido@python.org>2003-02-07 21:49:01 +0000
commitc9a23aa7bd43a39da9d888d5030ea12c8639a319 (patch)
treea4abfee6c5126947931df38beb352b205eae465d /Lib/test/test_datetime.py
parent36172281ca9f2b90d093f4509500aeaf8a547d37 (diff)
downloadcpython-c9a23aa7bd43a39da9d888d5030ea12c8639a319.tar.gz
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. """
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r--Lib/test/test_datetime.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 712a3497dd..6acf0731bf 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -1176,6 +1176,14 @@ class TestDateTime(TestDate):
derived = unpickler.loads(green)
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):
# The test_compare() inherited from TestDate covers the error cases.
# We just want to test lexicographic ordering on the members datetime