pyoda_time.testing.time_zones package

Module contents

class pyoda_time.testing.time_zones.SingleTransitionDateTimeZone

Bases: DateTimeZone

Time zone with a single transition between two offsets.

This provides a simple way to test behaviour across a transition.

class property utc: DateTimeZone

Gets the UTC (Coordinated Universal Time) time zone.

This is a single instance which is not provider-specific; it is guaranteed to have the ID “UTC”, and to compare equal to an instance returned by calling for_offset with an offset of zero, but it may or may not compare equal to an instance returned by e.g. DateTimeZoneProviders.Tzdb["UTC"].

Returns:

The UTC DateTimeZone.

__init__(transition_point: Instant, offset_before: Offset | int, offset_after: Offset | int, id_: str = 'Single') None

Creates a zone with a single transition between two offsets.

Parameters:
  • transition_point – The transition point as an Instant.

  • offset_before – The offset of local time from UTC before the transition.

  • offset_after – The offset of local time from UTC before the transition.

  • id

property early_interval: ZoneInterval

Gets the ZoneInterval for the period before the transition, starting at the beginning of time.

Returns:

The zone interval for the period before the transition, starting at the beginning of time.

get_zone_interval(instant: Instant) ZoneInterval
property late_interval: ZoneInterval

Gets the ZoneInterval for the period after the transition, ending at the end of time.

Returns:

The zone interval for the period after the transition, ending at the end of time.

property transition: Instant

Gets the transition instant of the zone.

Returns:

The transition instant of the zone.