File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 33
44from collections import namedtuple
55from struct import unpack
6- from typing import List , Dict
6+ from typing import Dict , List , Optional
77
88from 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 )
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
2+ import pytest
23
34import 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 )
You can’t perform that action at this time.
0 commit comments