Skip to content

Commit caa8a94

Browse files
committed
Merge branch 'master' into 356-altendky-nth_of_month_outside_scope
2 parents 5f895d9 + 94d28b0 commit caa8a94

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

pendulum/tz/zoneinfo/reader.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from collections import namedtuple
55
from struct import unpack
6-
from typing import List, Dict
6+
from typing import Dict, List, Optional
77

88
from pytzdata.exceptions import TimezoneNotFound
99

@@ -200,12 +200,15 @@ def _parse_abbrs(
200200

201201
return abbrs
202202

203-
def _parse_posix_tz(self, fd): # type: (...) -> PosixTimezone
203+
def _parse_posix_tz(self, fd): # type: (...) -> Optional[PosixTimezone]
204204
s = fd.read().decode("utf-8")
205205

206206
if not s.startswith("\n") or not s.endswith("\n"):
207207
raise InvalidZoneinfoFile('Invalid posix rule in file "{}"'.format(fd.name))
208208

209209
s = s.strip()
210210

211+
if not s:
212+
return
213+
211214
return posix_spec(s)

tests/tz/test_timezones.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
import pytest
23

34
import pendulum
45

@@ -9,8 +10,6 @@ def test_timezones():
910
assert "America/Argentina/Buenos_Aires" in zones
1011

1112

12-
def test_timezones_are_loadable():
13-
zones = pendulum.timezones
14-
15-
for zone in zones:
16-
pendulum.timezone(zone)
13+
@pytest.mark.parametrize("zone", [zone for zone in pendulum.timezones])
14+
def test_timezones_are_loadable(zone):
15+
pendulum.timezone(zone)

0 commit comments

Comments
 (0)