Skip to content

Commit

Permalink
ci: if tzdata not available, skip comparing to ZoneInfo (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Feb 20, 2024
1 parent c2c90fd commit 47aff70
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/test_tzinfo.py
Expand Up @@ -8,7 +8,7 @@
from pydantic_core import SchemaValidator, TzInfo, core_schema

if sys.version_info >= (3, 9):
from zoneinfo import ZoneInfo
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError


class _ALWAYS_EQ:
Expand Down Expand Up @@ -174,10 +174,17 @@ def test_comparison(self):
estdatetime = self.DT.replace(tzinfo=timezone(-timedelta(hours=5)))
self.assertTrue(self.EST == estdatetime.tzinfo)
self.assertTrue(tz > estdatetime.tzinfo)

if sys.version_info >= (3, 9) and sys.platform == 'linux':
self.assertFalse(tz == ZoneInfo('Europe/London'))
with self.assertRaises(TypeError):
tz > ZoneInfo('Europe/London')
try:
europe_london = ZoneInfo('Europe/London')
except ZoneInfoNotFoundError:
# tz data not available
pass
else:
self.assertFalse(tz == europe_london)
with self.assertRaises(TypeError):
tz > europe_london

def test_copy(self):
for tz in self.ACDT, self.EST:
Expand Down

0 comments on commit 47aff70

Please sign in to comment.