Change the TimestampStrings check to check for str instead of not ZoneInfo.

This fixes the pytest problem which threw:
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

during Mocking
This commit is contained in:
Clemens Schwaighofer
2025-09-25 15:36:47 +09:00
parent ca0ab2d7d1
commit bb60a570d0
4 changed files with 51 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ class TimestampStrings:
self.time_zone = time_zone if time_zone is not None else self.TIME_ZONE
try:
self.timestamp_now_tz = datetime.now(
ZoneInfo(self.time_zone) if not isinstance(self.time_zone, ZoneInfo) else self.time_zone
ZoneInfo(self.time_zone) if isinstance(self.time_zone, str) else self.time_zone
)
except ZoneInfoNotFoundError as e:
raise ValueError(f'Zone could not be loaded [{self.time_zone}]: {e}') from e