summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-12-30 17:37:30 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-12-30 17:37:30 (GMT)
commit31cc3156e7651170407a9ce7211313910acb23fe (patch)
tree47eea29dc083bb65427e3e163d309f1284cf4897
parentba97659f5fedddac67587a0da94f486fd920cfb0 (diff)
downloadcpython-31cc3156e7651170407a9ce7211313910acb23fe.zip
cpython-31cc3156e7651170407a9ce7211313910acb23fe.tar.gz
cpython-31cc3156e7651170407a9ce7211313910acb23fe.tar.bz2
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.
-rw-r--r--Lib/test/test_datetime.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 3f41dda..264d75c 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -2592,6 +2592,13 @@ class TestTimezoneConversions(unittest.TestCase):
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,6 +2656,12 @@ class TestTimezoneConversions(unittest.TestCase):
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.
self.convert_between_tz_and_utc(Eastern, utc_real)