11"""Gherkin step implementations for core properties-related features.""" 
22
3- from   datetime   import  datetime ,  timedelta 
3+ import  datetime   as   dt 
44
55from  behave  import  given , then , when 
66from  behave .runner  import  Context 
@@ -38,13 +38,13 @@ def when_I_assign_new_values_to_the_properties(context: Context):
3838        ("category" , "Category" ),
3939        ("comments" , "Description" ),
4040        ("content_status" , "Content Status" ),
41-         ("created" , datetime (2013 , 6 , 15 , 12 , 34 , 56 )),
41+         ("created" , dt . datetime (2013 , 6 , 15 , 12 , 34 , 56 ,  tzinfo = dt . timezone . utc )),
4242        ("identifier" , "Identifier" ),
4343        ("keywords" , "key; word; keyword" ),
4444        ("language" , "Language" ),
4545        ("last_modified_by" , "Last Modified By" ),
46-         ("last_printed" , datetime (2013 , 6 , 15 , 12 , 34 , 56 )),
47-         ("modified" , datetime (2013 , 6 , 15 , 12 , 34 , 56 )),
46+         ("last_printed" , dt . datetime (2013 , 6 , 15 , 12 , 34 , 56 ,  tzinfo = dt . timezone . utc )),
47+         ("modified" , dt . datetime (2013 , 6 , 15 , 12 , 34 , 56 ,  tzinfo = dt . timezone . utc )),
4848        ("revision" , 9 ),
4949        ("subject" , "Subject" ),
5050        ("title" , "Title" ),
@@ -66,8 +66,8 @@ def then_a_core_properties_part_with_default_values_is_added(context: Context):
6666    assert  core_properties .revision  ==  1 
6767    # core_properties.modified only stores time with seconds resolution, so 
6868    # comparison needs to be a little loose (within two seconds) 
69-     modified_timedelta  =  datetime .utcnow ( ) -  core_properties .modified 
70-     max_expected_timedelta  =  timedelta (seconds = 2 )
69+     modified_timedelta  =  dt . datetime .now ( dt . timezone . utc ) -  core_properties .modified 
70+     max_expected_timedelta  =  dt . timedelta (seconds = 2 )
7171    assert  modified_timedelta  <  max_expected_timedelta 
7272
7373
@@ -85,13 +85,13 @@ def then_the_core_property_values_match_the_known_values(context: Context):
8585        ("category" , "Category" ),
8686        ("comments" , "Description" ),
8787        ("content_status" , "Content Status" ),
88-         ("created" , datetime (2014 , 12 , 13 , 22 , 2 , 0 )),
88+         ("created" , dt . datetime (2014 , 12 , 13 , 22 , 2 , 0 ,  tzinfo = dt . timezone . utc )),
8989        ("identifier" , "Identifier" ),
9090        ("keywords" , "key; word; keyword" ),
9191        ("language" , "Language" ),
9292        ("last_modified_by" , "Steve Canny" ),
93-         ("last_printed" , datetime (2014 , 12 , 13 , 22 , 2 , 42 )),
94-         ("modified" , datetime (2014 , 12 , 13 , 22 , 6 , 0 )),
93+         ("last_printed" , dt . datetime (2014 , 12 , 13 , 22 , 2 , 42 ,  tzinfo = dt . timezone . utc )),
94+         ("modified" , dt . datetime (2014 , 12 , 13 , 22 , 6 , 0 ,  tzinfo = dt . timezone . utc )),
9595        ("revision" , 2 ),
9696        ("subject" , "Subject" ),
9797        ("title" , "Title" ),
0 commit comments