module documentation

Undocumented

Class context_passthrough Undocumented
Class DatetimeAmbiguousTest Test the datetime_exists / datetime_ambiguous functions
Class DatetimeExistsTest Undocumented
Class GettzTest Undocumented
Class ImaginaryDateTest Undocumented
Class TestEnfold Undocumented
Class TzFoldMixin Mix-in class for testing ambiguous times
Class TZICalTest Undocumented
Class TzLocalNixTest No class docstring; 0/4 constant, 1/17 method documented
Class TzLocalTest Undocumented
Class TzOffsetTest Undocumented
Class TzPickleFileTest Run all the TzPickleTest tests, using a temporary file
Class TzPickleTest Undocumented
Class TZRangeTest Undocumented
Class TZStrTest Undocumented
Class TZTest Undocumented
Class TzUTCTest Undocumented
Class TzWinFoldMixin Undocumented
Class TzWinLocalTest Undocumented
Class TzWinTest Undocumented
Class ZoneInfoGettzTest Undocumented
Function get_timezone_tuple Retrieve a (tzname, utcoffset, dst) tuple for a given DST
Function mark_tzlocal_nix Undocumented
Function test_gettz_badzone Undocumented
Function test_gettz_badzone_unicode Undocumented
Function test_gettz_cache_clear Undocumented
Function test_gettz_same_result_for_none_and_empty_string Undocumented
Function test_gettz_set_cache_size Undocumented
Function test_gettz_weakref Undocumented
Function test_gettz_zone_wrong_type Undocumented
Function test_invalid_GNU_tzstr Undocumented
Function test_resolve_imaginary Undocumented
Function test_resolve_imaginary_ambiguous Undocumented
Function test_resolve_imaginary_existing Undocumented
Function test_samoa_transition Undocumented
Function test_sub_minute_rounding_tzfile Undocumented
Function test_tzfile_sub_minute_offset Undocumented
Function test_tzlocal_local_time_trim_colon Undocumented
Function test_tzlocal_offset_equal Undocumented
Function test_tzlocal_offset_unequal Undocumented
Function test_tzlocal_utc_equal Undocumented
Function test_tzlocal_utc_unequal Undocumented
Function test_tzoffset_is Undocumented
Function test_tzoffset_is_not Undocumented
Function test_tzoffset_singleton Undocumented
Function test_tzoffset_sub_minute Undocumented
Function test_tzoffset_sub_minute_rounding Undocumented
Function test_tzoffset_weakref Undocumented
Function test_tzstr_default_cmp Undocumented
Function test_tzstr_default_end Undocumented
Function test_tzstr_default_start Undocumented
Function test_tzstr_weakref Undocumented
Function test_valid_dateutil_format Undocumented
Function test_valid_GNU_tzstr Undocumented
Constant DEFAULT_TZSTR_RULES_EQUIV_2003 Undocumented
Constant EDT_TUPLE Undocumented
Constant EST_TUPLE Undocumented
Constant EUROPE_HELSINKI Undocumented
Constant IS_WIN Undocumented
Constant MISSING_TARBALL Undocumented
Constant NEW_YORK Undocumented
Constant SUPPORTS_SUB_MINUTE_OFFSETS Undocumented
Constant TZFILE_EST5EDT Undocumented
Constant TZICAL_EST5EDT Undocumented
Constant TZICAL_PST8PDT Undocumented
Variable resolve_imaginary_tests Undocumented
Function __get_kiritimati_resolve_imaginary_test Undocumented
def get_timezone_tuple(dt): (source)

Retrieve a (tzname, utcoffset, dst) tuple for a given DST

def mark_tzlocal_nix(f): (source)

Undocumented

@pytest.mark.gettz
@pytest.mark.parametrize('badzone', ['Fake.Region/Abcdefghijklmnop'])
def test_gettz_badzone(badzone): (source)

Undocumented

@pytest.mark.gettz
def test_gettz_badzone_unicode(): (source)

Undocumented

@pytest.mark.gettz
@pytest.mark.xfail(IS_WIN, reason='zoneinfo separately cached')
def test_gettz_cache_clear(): (source)

Undocumented

@pytest.mark.gettz
def test_gettz_same_result_for_none_and_empty_string(): (source)

Undocumented

@pytest.mark.gettz
@pytest.mark.xfail(IS_WIN, reason='zoneinfo separately cached')
def test_gettz_set_cache_size(): (source)

Undocumented

@pytest.mark.xfail(IS_WIN, reason='Windows does not use system zoneinfo')
@pytest.mark.smoke
@pytest.mark.gettz
def test_gettz_weakref(): (source)

Undocumented

@pytest.mark.gettz
@pytest.mark.parametrize('badzone,exc_reason', [pytest.param(b'America/New_York', '.*should be str, not bytes.*', id='bytes on Python 3', marks=[pytest.mark.skipif(PY2, reason='bytes arguments accepted in Python 2')]), pytest.param(object(), None, id='no startswith()', marks=[pytest.mark.xfail(reason='AttributeError instead of TypeError', raises=AttributeError)])])
def test_gettz_zone_wrong_type(badzone, exc_reason): (source)

Undocumented

@pytest.mark.tzstr
@pytest.mark.parametrize('tz_str', ['hdfiughdfuig,dfughdfuigpu87ñ::', ',dfughdfuigpu87ñ::', '-1:WART4WARST,J1,J365/25', 'WART4WARST,J1,J365/-25', 'IST-2IDT,M3.4.-1/26,M10.5.0', 'IST-2IDT,M3,2000,1/26,M10,5,0'])
def test_invalid_GNU_tzstr(tz_str): (source)

Undocumented

@pytest.mark.tz_resolve_imaginary
@pytest.mark.parametrize('tzi, dt, dt_exp', resolve_imaginary_tests)
def test_resolve_imaginary(tzi, dt, dt_exp): (source)

Undocumented

@pytest.mark.tz_resolve_imaginary
@pytest.mark.parametrize('dt', [datetime(2017, 11, 5, 1, 30, tzinfo=tz.gettz('America/New_York')), datetime(2018, 10, 28, 1, 30, tzinfo=tz.gettz('Europe/London')), datetime(2017, 4, 2, 2, 30, tzinfo=tz.gettz('Australia/Sydney'))])
def test_resolve_imaginary_ambiguous(dt): (source)

Undocumented

@pytest.mark.tz_resolve_imaginary
@pytest.mark.parametrize('dt', [datetime(2017, 6, 2, 12, 30, tzinfo=tz.gettz('America/New_York')), datetime(2018, 4, 2, 9, 30, tzinfo=tz.gettz('Europe/London')), datetime(2017, 2, 2, 16, 30, tzinfo=tz.gettz('Australia/Sydney')), datetime(2017, 12, 2, 12, 30, tzinfo=tz.gettz('America/New_York')), datetime(2018, 12, 2, 9, 30, tzinfo=tz.gettz('Europe/London')), datetime(2017, 6, 2, 16, 30, tzinfo=tz.gettz('Australia/Sydney')), datetime(2025, 9, 25, 1, 17, tzinfo=tz.UTC), datetime(2025, 9, 25, 1, 17, tzinfo=tz.tzoffset('EST', -18000)), datetime(2019, 3, 4, tzinfo=None)])
def test_resolve_imaginary_existing(dt): (source)

Undocumented

@pytest.mark.tzfile
def test_samoa_transition(): (source)

Undocumented

@pytest.mark.tzfile
@pytest.mark.skipif(SUPPORTS_SUB_MINUTE_OFFSETS, reason='Sub-minute offsets supported.')
def test_sub_minute_rounding_tzfile(): (source)

Undocumented

@pytest.mark.tzfile
@pytest.mark.skipif(not SUPPORTS_SUB_MINUTE_OFFSETS, reason='Sub-minute offsets not supported')
def test_tzfile_sub_minute_offset(): (source)

Undocumented

@mark_tzlocal_nix
def test_tzlocal_local_time_trim_colon(): (source)

Undocumented

@mark_tzlocal_nix
@pytest.mark.parametrize('tzvar, tzoff', [('EST5', tz.tzoffset('EST', -18000)), ('GMT0', tz.tzoffset('GMT', 0)), ('YAKT-9', tz.tzoffset('YAKT', timedelta(hours=9))), ('JST-9', tz.tzoffset('JST', timedelta(hours=9)))])
def test_tzlocal_offset_equal(tzvar, tzoff): (source)

Undocumented

@mark_tzlocal_nix
@pytest.mark.parametrize('tzvar, tzoff', [('EST5EDT', tz.tzoffset('EST', -18000)), ('GMT0BST', tz.tzoffset('GMT', 0)), ('EST5', tz.tzoffset('EST', -14400)), ('YAKT-9', tz.tzoffset('JST', timedelta(hours=9))), ('JST-9', tz.tzoffset('YAKT', timedelta(hours=9)))])
def test_tzlocal_offset_unequal(tzvar, tzoff): (source)

Undocumented

@mark_tzlocal_nix
@pytest.mark.parametrize('tzvar', ['UTC', 'GMT0', 'UTC0'])
def test_tzlocal_utc_equal(tzvar): (source)

Undocumented

@mark_tzlocal_nix
@pytest.mark.parametrize('tzvar', ['Europe/London', 'America/New_York', 'GMT0BST', 'EST5EDT'])
def test_tzlocal_utc_unequal(tzvar): (source)

Undocumented

@pytest.mark.parametrize('args,kwargs', [(('EST', -18000), {}), (('EST', timedelta(hours=-5)), {}), (('EST'), {'offset': -18000}), (('EST'), {'offset': timedelta(hours=-5)}), (tuple(), {'name': 'EST', 'offset': -18000})])
def test_tzoffset_is(args, kwargs): (source)

Undocumented

def test_tzoffset_is_not(): (source)

Undocumented

@pytest.mark.tzoffset
@pytest.mark.parametrize('args', [('UTC', 0), ('EST', -18000), ('EST', timedelta(hours=-5)), (None, timedelta(hours=3))])
def test_tzoffset_singleton(args): (source)

Undocumented

@pytest.mark.tzoffset
@pytest.mark.skipif(not SUPPORTS_SUB_MINUTE_OFFSETS, reason='Sub-minute offsets not supported')
def test_tzoffset_sub_minute(): (source)

Undocumented

@pytest.mark.tzoffset
@pytest.mark.skipif(SUPPORTS_SUB_MINUTE_OFFSETS, reason='Sub-minute offsets supported')
def test_tzoffset_sub_minute_rounding(): (source)

Undocumented

@pytest.mark.smoke
@pytest.mark.tzoffset
def test_tzoffset_weakref(): (source)

Undocumented

@pytest.mark.tzstr
@pytest.mark.parametrize('tzstr_1', ['EST5EDT', 'EST5EDT4,M4.1.0/02:00:00,M10-5-0/02:00'])
@pytest.mark.parametrize('tzstr_2', ['EST5EDT', 'EST5EDT4,M4.1.0/02:00:00,M10-5-0/02:00'])
def test_tzstr_default_cmp(tzstr_1, tzstr_2): (source)

Undocumented

@pytest.mark.tzstr
@pytest.mark.parametrize('tz_str', DEFAULT_TZSTR_RULES_EQUIV_2003)
def test_tzstr_default_end(tz_str): (source)

Undocumented

@pytest.mark.tzstr
@pytest.mark.parametrize('tz_str', DEFAULT_TZSTR_RULES_EQUIV_2003)
def test_tzstr_default_start(tz_str): (source)

Undocumented

@pytest.mark.smoke
@pytest.mark.tzstr
def test_tzstr_weakref(): (source)

Undocumented

@pytest.mark.tzstr
@pytest.mark.parametrize('tz_str, expected', [('EST5EDT,5,4,0,7200,11,3,0,7200', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(month=5, day=1, weekday=SU(+4), hours=+2), end=relativedelta(month=11, day=1, weekday=SU(+3), hours=+1))), ('EST5EDT,5,-4,0,7200,11,3,0,7200', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(hours=+2, month=5, day=31, weekday=SU(-4)), end=relativedelta(hours=+1, month=11, day=1, weekday=SU(+3)))), ('EST5EDT,5,4,0,7200,11,-3,0,7200', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(hours=+2, month=5, day=1, weekday=SU(+4)), end=relativedelta(hours=+1, month=11, day=31, weekday=SU(-3)))), ('EST5EDT,5,4,0,7200,11,-3,0,7200,3600', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(hours=+2, month=5, day=1, weekday=SU(+4)), end=relativedelta(hours=+1, month=11, day=31, weekday=SU(-3)))), ('EST5EDT,5,4,0,7200,11,-3,0,7200,3600', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(hours=+2, month=5, day=1, weekday=SU(+4)), end=relativedelta(hours=+1, month=11, day=31, weekday=SU(-3)))), ('EST5EDT,5,4,0,7200,11,-3,0,7200,-3600', tz.tzrange('EST', timedelta(hours=-5), 'EDT', timedelta(hours=-6), start=relativedelta(hours=+2, month=5, day=1, weekday=SU(+4)), end=relativedelta(hours=+3, month=11, day=31, weekday=SU(-3)))), ('EST5EDT,5,4,0,7200,11,-3,0,7200,+7200', tz.tzrange('EST', timedelta(hours=-5), 'EDT', timedelta(hours=-3), start=relativedelta(hours=+2, month=5, day=1, weekday=SU(+4)), end=relativedelta(hours=0, month=11, day=31, weekday=SU(-3)))), ('EST5EDT,5,4,0,7200,11,-3,0,7200,+3600', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(hours=+2, month=5, day=1, weekday=SU(+4)), end=relativedelta(hours=+1, month=11, day=31, weekday=SU(-3))))])
def test_valid_dateutil_format(tz_str, expected): (source)

Undocumented

@pytest.mark.tzstr
@pytest.mark.parametrize('tz_str,expected', [('', tz.tzrange(None)), ('EST+5EDT,M3.2.0/2,M11.1.0/12', tz.tzrange('EST', -18000, 'EDT', -14400, start=relativedelta(month=3, day=1, weekday=SU(2), hours=2), end=relativedelta(month=11, day=1, weekday=SU(1), hours=11))), ('WART4WARST,J1/0,J365/25', tz.tzrange('WART', timedelta(hours=-4), 'WARST', start=relativedelta(month=1, day=1, hours=0), end=relativedelta(month=12, day=31, days=1))), ('IST-2IDT,M3.4.4/26,M10.5.0', tz.tzrange('IST', timedelta(hours=2), 'IDT', start=relativedelta(month=3, day=1, weekday=TH(4), days=1, hours=2), end=relativedelta(month=10, day=31, weekday=SU(-1), hours=1))), ('WGT3WGST,M3.5.0/2,M10.5.0/1', tz.tzrange('WGT', timedelta(hours=-3), 'WGST', start=relativedelta(month=3, day=31, weekday=SU(-1), hours=2), end=relativedelta(month=10, day=31, weekday=SU(-1), hours=0))), ('WGT0300WGST', tz.tzrange('WGT', timedelta(hours=-3), 'WGST')), ('WGT03:00WGST', tz.tzrange('WGT', timedelta(hours=-3), 'WGST')), ('AEST-1100AEDT', tz.tzrange('AEST', timedelta(hours=11), 'AEDT')), ('AEST-11:00AEDT', tz.tzrange('AEST', timedelta(hours=11), 'AEDT')), ('EST5EDT,M3.2.0/4:00,M11.1.0/3:00', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(month=3, day=1, weekday=SU(2), hours=4), end=relativedelta(month=11, day=1, weekday=SU(1), hours=2))), ('EST5EDT,M3.2.0/04:00,M11.1.0/03:00', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(month=3, day=1, weekday=SU(2), hours=4), end=relativedelta(month=11, day=1, weekday=SU(1), hours=2))), ('EST5EDT,M3.2.0/0400,M11.1.0/0300', tz.tzrange('EST', timedelta(hours=-5), 'EDT', start=relativedelta(month=3, day=1, weekday=SU(2), hours=4), end=relativedelta(month=11, day=1, weekday=SU(1), hours=2)))])
def test_valid_GNU_tzstr(tz_str, expected): (source)

Undocumented

DEFAULT_TZSTR_RULES_EQUIV_2003: list[str] = (source)

Undocumented

Value
['EST5EDT',
 'EST5EDT4,M4.1.0/02:00:00,M10-5-0/02:00',
 'EST5EDT4,95/02:00:00,298/02:00',
 'EST5EDT4,J96/02:00:00,J299/02:00',
 'EST5EDT4,J96/02:00:00,J299/02']
EDT_TUPLE = (source)

Undocumented

Value
('EDT', timedelta(hours=-4), timedelta(hours=1))
EST_TUPLE = (source)

Undocumented

Value
('EST', timedelta(hours=-5), timedelta(hours=0))
EUROPE_HELSINKI: bytes = (source)

Undocumented

Value
b'''
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABQAAAAAAAAB1AAAABQAAAA2kc28Yy85RYMy/hdAV
I+uQFhPckBcDzZAX876QGOOvkBnToJAaw5GQG7y9EBysrhAdnJ8QHoyQEB98gRAgbHIQIVxjECJM
VBAjPEUQJCw2ECUcJxAmDBgQJwVDkCf1NJAo5SWQKdUWkCrFB5ArtPiQLKTpkC2U2pAuhMuQL3S8
kDBkrZAxXdkQMnK0EDM9uxA0UpYQNR2dEDYyeBA2/X8QOBuUkDjdYRA5+3aQOr1DEDvbWJA8pl+Q
Pbs6kD6GQZA/mxyQQGYjkEGEORBCRgWQQ2QbEEQl55BFQ/0QRgXJkEcj3xBH7uYQSQPBEEnOyBBK
46MQS66qEEzMv5BNjowQTqyhkE9ubhBQjIOQUVeKkFJsZZBTN2yQVExHkFUXTpBWLCmQVvcwkFgV
...
IS_WIN = (source)

Undocumented

Value
sys.platform.startswith('win')
MISSING_TARBALL: str = (source)

Undocumented

Value
'This test fails if you don\'t have the dateutil timezone file installed. Please
 read the README'
NEW_YORK: bytes = (source)

Undocumented

Value
b'''
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAABcAAADrAAAABAAAABCeph5wn7rrYKCGAHCh
ms1gomXicKOD6eCkaq5wpTWnYKZTyvCnFYlgqDOs8Kj+peCqE47wqt6H4KvzcPCsvmngrdNS8K6e
S+CvszTwsH4t4LGcUXCyZ0pgs3wzcLRHLGC1XBVwticOYLc793C4BvBguRvZcLnm0mC7BPXwu8a0
YLzk1/C9r9DgvsS58L+PsuDApJvwwW+U4MKEffDDT3bgxGRf8MUvWODGTXxwxw864MgtXnDI+Fdg
yg1AcMrYOWDLiPBw0iP0cNJg++DTdeTw1EDd4NVVxvDWIL/g1zWo8NgAoeDZFYrw2eCD4Nr+p3Db
wGXg3N6JcN2pgmDevmtw34lkYOCeTXDhaUZg4n4vcONJKGDkXhFw5Vcu4OZHLfDnNxDg6CcP8OkW
...
SUPPORTS_SUB_MINUTE_OFFSETS = (source)

Undocumented

Value
(sys.version_info >= (3, 6))
TZFILE_EST5EDT: bytes = (source)

Undocumented

Value
b'''
VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAADrAAAABAAAABCeph5wn7rrYKCGAHCh
ms1gomXicKOD6eCkaq5wpTWnYKZTyvCnFYlgqDOs8Kj+peCqE47wqt6H4KvzcPCsvmngrdNS8K6e
S+CvszTwsH4t4LGcUXCyZ0pgs3wzcLRHLGC1XBVwticOYLc793C4BvBguRvZcLnm0mC7BPXwu8a0
YLzk1/C9r9DgvsS58L+PsuDApJvwwW+U4MKEffDDT3bgxGRf8MUvWODGTXxwxw864MgtXnDI+Fdg
yg1AcMrYOWDLiPBw0iP0cNJg++DTdeTw1EDd4NVVxvDWIL/g1zWo8NgAoeDZFYrw2eCD4Nr+p3Db
wGXg3N6JcN2pgmDevmtw34lkYOCeTXDhaUZg4n4vcONJKGDkXhFw5Vcu4OZHLfDnNxDg6CcP8OkW
...
TZICAL_EST5EDT: str = (source)

Undocumented

Value
'''
BEGIN:VTIMEZONE
TZID:US-Eastern
LAST-MODIFIED:19870101T000000Z
TZURL:http://zones.stds_r_us.net/tz/US-Eastern
BEGIN:STANDARD
DTSTART:19671029T020000
...
TZICAL_PST8PDT: str = (source)

Undocumented

Value
'''
BEGIN:VTIMEZONE
TZID:US-Pacific
LAST-MODIFIED:19870101T000000Z
BEGIN:STANDARD
DTSTART:19671029T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
...
resolve_imaginary_tests = (source)

Undocumented

def __get_kiritimati_resolve_imaginary_test(): (source)

Undocumented