@@ -316,7 +316,7 @@ class TIME_ZONE_INFORMATION(_SimpleStruct):
316316 ]
317317
318318
319- class DYNAMIC_TIME_ZONE_INFORMATION (_SimpleStruct ):
319+ class DYNAMIC_TIME_ZONE_INFORMATION (TIME_ZONE_INFORMATION ):
320320 _fields_ = TIME_ZONE_INFORMATION ._fields_ + [
321321 ("key_name" , str ),
322322 ("dynamic_daylight_time_disabled" , bool ),
@@ -334,10 +334,25 @@ class TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION):
334334
335335 def __init__ (self , * args , ** kwargs ):
336336 """
337+ >>> test_args = [1] * 44
338+
337339 Try to construct a TimeZoneDefinition from
340+
338341 a) [DYNAMIC_]TIME_ZONE_INFORMATION args
339- b) another TimeZoneDefinition
342+ >>> TimeZoneDefinition(*test_args).bias
343+ datetime.timedelta(seconds=60)
344+
345+ b) another TimeZoneDefinition or [DYNAMIC_]TIME_ZONE_INFORMATION
346+ >>> TimeZoneDefinition(TimeZoneDefinition(*test_args)).bias
347+ datetime.timedelta(seconds=60)
348+ >>> TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION(*test_args)).bias
349+ datetime.timedelta(seconds=60)
350+ >>> TimeZoneDefinition(TIME_ZONE_INFORMATION(*test_args)).bias
351+ datetime.timedelta(seconds=60)
352+
340353 c) a byte structure (using _from_bytes)
354+ >>> TimeZoneDefinition(bytes(test_args)).bias
355+ datetime.timedelta(days=11696, seconds=46140)
341356 """
342357 try :
343358 super ().__init__ (* args , ** kwargs )
@@ -357,7 +372,7 @@ def __init__(self, *args, **kwargs):
357372 except TypeError :
358373 pass
359374
360- raise TypeError ("Invalid arguments for %s" % self .__class__ )
375+ raise TypeError (f "Invalid arguments for { self .__class__ } " )
361376
362377 def __init_from_bytes (
363378 self ,
@@ -389,7 +404,7 @@ def __init_from_other(self, other):
389404 raise TypeError ("Not a TIME_ZONE_INFORMATION" )
390405 for name in other .field_names ():
391406 # explicitly get the value from the underlying structure
392- value = super (TimeZoneDefinition , other ).__getattribute__ (other , name )
407+ value = super (TIME_ZONE_INFORMATION , other ).__getattribute__ (name )
393408 setattr (self , name , value )
394409 # consider instead of the loop above just copying the memory directly
395410 # size = max(ctypes.sizeof(DYNAMIC_TIME_ZONE_INFO), ctypes.sizeof(other))
0 commit comments