Skip to content

Commit e34f374

Browse files
committed
Made some subtle fixes
1 parent bf21af2 commit e34f374

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

tests/unit/test_fetches.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def fetch_results(
8080
description,
8181
use_cloud_fetch=True,
8282
chunk_id=0,
83+
timestamp_format=None,
8384
):
8485
nonlocal batch_index
8586
results = FetchTests.make_arrow_queue(batch_list[batch_index])

tests/unit/test_sea_conversion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pytest
88
import datetime
99
import decimal
10+
import pytz
1011
from unittest.mock import Mock, patch
1112

1213
from databricks.sql.backend.sea.utils.conversion import SqlType, SqlTypeConverter
@@ -158,7 +159,7 @@ def test_convert_timestamp_with_format(self):
158159
timestamp_format=fmt,
159160
)
160161
assert isinstance(result, datetime.datetime)
161-
assert result == datetime.datetime(2023, 12, 31, 12, 30, 0, 123000)
162+
assert result == datetime.datetime(2023, 12, 31, 12, 30, 0, 123000, tzinfo=pytz.UTC)
162163

163164
def test_convert_timestamp_with_format_fallback(self):
164165
"""Test that non-matching format falls back to dateutil."""

tests/unit/test_util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import datetime
33
from datetime import timezone, timedelta
44
import pytest
5+
import pytz
56
from databricks.sql.utils import (
67
convert_to_assigned_datatypes_in_column_table,
78
parse_timestamp,
@@ -235,7 +236,7 @@ def test_no_format_uses_dateutil(self):
235236
def test_matching_format_uses_strptime(self):
236237
fmt = "%Y-%m-%d %H:%M:%S.%f"
237238
result = parse_timestamp("2023-12-31 12:30:00.123000", fmt)
238-
assert result == datetime.datetime(2023, 12, 31, 12, 30, 0, 123000)
239+
assert result == datetime.datetime(2023, 12, 31, 12, 30, 0, 123000, tzinfo=pytz.UTC)
239240

240241
def test_non_matching_format_falls_back_to_dateutil(self):
241242
fmt = "%Y-%m-%d %H:%M:%S.%f"
@@ -252,7 +253,7 @@ def test_convert_column_table_with_timestamp_format(self):
252253
result = convert_to_assigned_datatypes_in_column_table(
253254
column_table, description, timestamp_format=fmt
254255
)
255-
assert result[0][0] == datetime.datetime(2023, 12, 31, 12, 30, 0)
256+
assert result[0][0] == datetime.datetime(2023, 12, 31, 12, 30, 0, tzinfo=pytz.UTC)
256257

257258
def test_convert_column_table_without_timestamp_format(self):
258259
description = [

0 commit comments

Comments
 (0)