[Zope3-checkins] CVS: Zope3/src/datetime/tests - test_datetime.py:1.7

Tim Peters tim.one@comcast.net
Mon, 30 Dec 2002 12:38:28 -0500


Update of /cvs-repository/Zope3/src/datetime/tests
In directory cvs.zope.org:/tmp/cvs-serv21358/src/datetime/tests

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.


=== Zope3/src/datetime/tests/test_datetime.py 1.6 => 1.7 ===
--- Zope3/src/datetime/tests/test_datetime.py:1.6	Mon Dec 30 12:07:22 2002
+++ Zope3/src/datetime/tests/test_datetime.py	Mon Dec 30 12:38:27 2002
@@ -2602,6 +2602,13 @@
 
             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)
 
@@ -2658,6 +2665,12 @@
                 self.assertEqual(outside.dst(), ZERO)
                 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):
         # Despite the name of this test, the endcases are excruciating.