[Python-checkins] python/dist/src/Lib/test test_datetime.py,1.36,1.37

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 07 Feb 2003 13:49:04 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv14281

Modified Files:
	test_datetime.py 
Log Message:
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.
"""


Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** test_datetime.py	6 Feb 2003 16:42:14 -0000	1.36
--- test_datetime.py	7 Feb 2003 21:49:01 -0000	1.37
***************
*** 1177,1180 ****
--- 1177,1188 ----
              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.