@@ -637,9 +637,9 @@ def test_to_api_repr_w_timestamp_datetime(self):
637637 self .assertEqual (param .to_api_repr (), EXPECTED )
638638
639639 def test_to_api_repr_w_timestamp_micros (self ):
640- from google .cloud ._helpers import _microseconds_from_datetime
640+ from google .cloud ._helpers import _microseconds_from_datetime , UTC
641641
642- now = datetime .datetime .utcnow ( )
642+ now = datetime .datetime .now ( UTC )
643643 seconds = _microseconds_from_datetime (now ) / 1.0e6
644644 EXPECTED = {
645645 "parameterType" : {"type" : "TIMESTAMP" },
@@ -650,9 +650,9 @@ def test_to_api_repr_w_timestamp_micros(self):
650650 self .assertEqual (param .to_api_repr (), EXPECTED )
651651
652652 def test_to_api_repr_w_datetime_datetime (self ):
653- from google .cloud ._helpers import _datetime_to_rfc3339
653+ from google .cloud ._helpers import _datetime_to_rfc3339 , UTC
654654
655- now = datetime .datetime .utcnow ( )
655+ now = datetime .datetime .now ( UTC )
656656 EXPECTED = {
657657 "parameterType" : {"type" : "DATETIME" },
658658 "parameterValue" : {
@@ -664,9 +664,9 @@ def test_to_api_repr_w_datetime_datetime(self):
664664 self .assertEqual (param .to_api_repr (), EXPECTED )
665665
666666 def test_to_api_repr_w_datetime_string (self ):
667- from google .cloud ._helpers import _datetime_to_rfc3339
667+ from google .cloud ._helpers import _datetime_to_rfc3339 , UTC
668668
669- now = datetime .datetime .utcnow ( )
669+ now = datetime .datetime .now ( UTC )
670670 now_str = _datetime_to_rfc3339 (now )
671671 EXPECTED = {
672672 "parameterType" : {"type" : "DATETIME" },
@@ -1047,9 +1047,10 @@ def test_to_api_repr_w_datetime_str(self):
10471047 self .assertEqual (param .to_api_repr (), EXPECTED )
10481048
10491049 def test_to_api_repr_w_datetime_datetime (self ):
1050+ from google .cloud ._helpers import UTC # type: ignore
10501051 from google .cloud .bigquery ._helpers import _RFC3339_MICROS_NO_ZULU
10511052
1052- now = datetime .datetime .utcnow ( )
1053+ now = datetime .datetime .now ( UTC )
10531054 now_str = now .strftime (_RFC3339_MICROS_NO_ZULU )
10541055 EXPECTED = {
10551056 "parameterType" : {
@@ -1089,7 +1090,7 @@ def test_to_api_repr_w_timestamp_str(self):
10891090 def test_to_api_repr_w_timestamp_timestamp (self ):
10901091 from google .cloud ._helpers import UTC # type: ignore
10911092
1092- now = datetime .datetime .utcnow ( )
1093+ now = datetime .datetime .now ( UTC )
10931094 now = now .astimezone (UTC )
10941095 now_str = str (now )
10951096 EXPECTED = {
0 commit comments