[Python-checkins] python/dist/src/Lib/test test_datetime.py,1.14,1.15

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Mon, 30 Dec 2002 09:37:33 -0800


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

Modified Files:
	test_datetime.py 
Log Message:
Added tests that conversion to our own timezone is always an identity,
and that conversion to "timezone" None is the same as stripping the
tzinfo member.


Index: test_datetime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_datetime.py	30 Dec 2002 17:09:40 -0000	1.14
--- test_datetime.py	30 Dec 2002 17:37:30 -0000	1.15
***************
*** 2593,2596 ****
--- 2593,2603 ----
              for during in dston, dston + delta, dstoff - delta:
                  self.assertEqual(during.dst(), HOUR)
+ 
+                 # Conversion to our own timezone is always an identity.
+                 self.assertEqual(during.astimezone(tz), during)
+                 # Conversion to None is always the same as stripping tzinfo.
+                 self.assertEqual(during.astimezone(None),
+                                  during.replace(tzinfo=None))
+ 
                  asutc = during.astimezone(utc)
                  there_and_back = asutc.astimezone(tz)
***************
*** 2649,2652 ****
--- 2656,2665 ----
                  there_and_back = outside.astimezone(utc).astimezone(tz)
                  self.assertEqual(outside, there_and_back)
+ 
+                 # Conversion to our own timezone is always an identity.
+                 self.assertEqual(outside.astimezone(tz), outside)
+                 # Conversion to None is always the same as stripping tzinfo.
+                 self.assertEqual(outside.astimezone(None),
+                                  outside.replace(tzinfo=None))
  
      def test_easy(self):