@@ -340,6 +340,34 @@ def test_time_variable_preservation(self):
340
340
output = self .get_output (self .widget .Outputs .data )
341
341
self .assertEqual (str (table [0 , 4 ]), str (output [0 , 4 ]))
342
342
343
+ def test_custom_format (self ):
344
+ time_variable = StringVariable ("Date" )
345
+ data = [
346
+ ["2024-001" ],
347
+ ["2024-032" ],
348
+ ["2024-150" ],
349
+ ["2024-365" ]
350
+ ]
351
+ table = Table .from_list (Domain ([], metas = [time_variable ]), data )
352
+ self .send_signal (self .widget .Inputs .data , table )
353
+ model = self .widget .domain_view .model ()
354
+ index = self .widget .variables_view .model ().index
355
+ self .widget .variables_view .setCurrentIndex (index (0 ))
356
+
357
+ editor = self .widget .findChild (TimeVariableEditor )
358
+ idx = editor .format_cb .count () - 1
359
+ editor .format_cb .setCurrentIndex (idx )
360
+ editor .variable_changed .emit ()
361
+ editor .custom_edit .setText ("%Y-%j" )
362
+ editor ._on_custom_change ()
363
+ model .setData (model .index (0 , 0 ), [AsTime ()], TransformRole )
364
+
365
+ self .widget .commit ()
366
+ output = self .get_output (self .widget .Outputs .data )
367
+ print (output .domain .metas )
368
+ self .assertEqual (str (table [0 ].metas [0 ]), "2024-001" )
369
+ self .assertEqual (str (output [0 ].metas [0 ]), "2024-01-01" )
370
+
343
371
def test_restore (self ):
344
372
iris = self .iris
345
373
viris = (
0 commit comments