def test_get_timezones(self): ws = GetServerTimeZones(self.account.protocol) data = ws.call() self.assertAlmostEqual(len(list(data)), 130, delta=30, msg=data) # Test shortcut self.assertAlmostEqual(len(list(self.account.protocol.get_timezones())), 130, delta=30, msg=data) # Test translation to TimeZone objects for tz_id, tz_name, periods, transitions, transitionsgroups in self.account.protocol.get_timezones( return_full_timezone_data=True): TimeZone.from_server_timezone(periods=periods, transitions=transitions, transitionsgroups=transitionsgroups, for_year=2018)
def test_get_timezones(self): # Test shortcut data = list(self.account.protocol.get_timezones()) self.assertAlmostEqual(len(list( self.account.protocol.get_timezones())), 130, delta=30, msg=data) # Test translation to TimeZone objects for tz_definition in self.account.protocol.get_timezones( return_full_timezone_data=True): try: tz = TimeZone.from_server_timezone( tz_definition=tz_definition, for_year=2018, ) self.assertEqual( tz.bias, tz_definition.get_std_and_dst( for_year=2018)[2].bias_in_minutes) except TimezoneDefinitionInvalidForYear: pass