def test_tz_path(): here = os.path.realpath(os.path.dirname(__file__)) filepath = os.path.realpath( os.path.join(here, '..', 'pytzdata', 'zoneinfo', 'Europe', 'Paris') ) assert filepath == tz_path('Europe/Paris')
def read_for(self, timezone): # type: (str) -> Timezone """ Read the zoneinfo structure for a given timezone name. :param timezone: The timezone. """ try: file_path = pytzdata.tz_path(timezone) except TimezoneNotFound: raise InvalidTimezone(timezone) return self.read(file_path)
def test_tz_path_empty_string(): with pytest.raises(ValueError): tz_path('')
def test_tz_path_invalid_name(): with pytest.raises(ValueError): tz_path('Europe/../Paris')
def test_tz_path_not_found(): with pytest.raises(TimezoneNotFound): tz_path('Invalid')