mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Issue #9000: datetime.timezone objects now have eval-friendly repr.
This commit is contained in:
parent
44afa5e6a4
commit
a11d8c03a4
3 changed files with 33 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue