From 321940e1420bc8148becc593c757bee9ca8098df Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 19 Dec 2024 21:04:09 +0000 Subject: [PATCH 1/2] Assert that timezone loading is successful before use in tests. --- tests/test_icalendar.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_icalendar.py b/tests/test_icalendar.py index 92428cf..f59f6f3 100644 --- a/tests/test_icalendar.py +++ b/tests/test_icalendar.py @@ -503,6 +503,7 @@ def test_issue50(): def test_includes_dst_offset(): tz = dateutil.tz.gettz('us/eastern') + assert tz is not None # Simple first dt = datetime.datetime(2020, 1, 1) @@ -519,9 +520,13 @@ def test_omits_dst_offset(): # Check dateutil, pytz, and zoneinfo (3.9+) tzinfo instances timezones = [] if 'dateutil' in globals(): - timezones.append(dateutil.tz.gettz('us/eastern')) + tz = dateutil.tz.gettz('us/eastern') + assert tz is not None + timezones.append(tz) if 'zoneinfo' in globals(): - timezones.append(zoneinfo.ZoneInfo('us/eastern')) + tz = zoneinfo.ZoneInfo('us/eastern') + assert tz is not None + timezones.append(tz) for tz in timezones: dt = datetime.datetime(2020, 1, 1) From aab9e0dde84776e3c19830a74660f270ecf2a42a Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 19 Dec 2024 21:21:53 +0000 Subject: [PATCH 2/2] Correct case of timezone names. --- tests/test_icalendar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_icalendar.py b/tests/test_icalendar.py index f59f6f3..7067fa1 100644 --- a/tests/test_icalendar.py +++ b/tests/test_icalendar.py @@ -502,7 +502,7 @@ def test_issue50(): def test_includes_dst_offset(): - tz = dateutil.tz.gettz('us/eastern') + tz = dateutil.tz.gettz('US/Eastern') assert tz is not None # Simple first @@ -520,11 +520,11 @@ def test_omits_dst_offset(): # Check dateutil, pytz, and zoneinfo (3.9+) tzinfo instances timezones = [] if 'dateutil' in globals(): - tz = dateutil.tz.gettz('us/eastern') + tz = dateutil.tz.gettz('US/Eastern') assert tz is not None timezones.append(tz) if 'zoneinfo' in globals(): - tz = zoneinfo.ZoneInfo('us/eastern') + tz = zoneinfo.ZoneInfo('US/Eastern') assert tz is not None timezones.append(tz)