summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-07-06 23:19:45 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-07-06 23:19:45 (GMT)
commita11d8c03a4c596c52bfea6c2f5b3940fa6126d38 (patch)
tree61001351a1033f71ccef91ecb753d5d9cfa6b884 /Lib
parent44afa5e6a4faef2dfdf43bd939125f763f8e90e4 (diff)
downloadcpython-a11d8c03a4c596c52bfea6c2f5b3940fa6126d38.zip
cpython-a11d8c03a4c596c52bfea6c2f5b3940fa6126d38.tar.gz
cpython-a11d8c03a4c596c52bfea6c2f5b3940fa6126d38.tar.bz2
Issue #9000: datetime.timezone objects now have eval-friendly repr.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_datetime.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index c12bfb2..bb36001 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -153,6 +153,15 @@ class TestTimeZone(unittest.TestCase):
timezone.min, timezone.max]:
self.assertEqual(str(tz), tz.tzname(None))
+ def test_repr(self):
+ import datetime
+ for tz in [self.ACDT, self.EST, timezone.utc,
+ timezone.min, timezone.max]:
+ # test round-trip
+ tzrep = repr(tz)
+ self.assertEqual(tz, eval(tzrep))
+
+
def test_class_members(self):
limit = timedelta(hours=23, minutes=59)
self.assertEqual(timezone.utc.utcoffset(None), ZERO)