Skip to content

Commit bf055bb

Browse files
baldwiccsdebruyn
authored andcommitted
test byte_array_to_datetime behaviour as a string
1 parent ace8543 commit bf055bb

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/unit/adapters/sqlserver/test_sql_server_connection_manager.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,14 @@ def test_bool_to_connection_string_arg(key: str, value: bool, expected: str) ->
9292
0x40, 0xE2, 0x01, 0x00, # microsecond: 123456
9393
0x02, 0x00, 0x1E, 0x00 # tzinfo: +02:30
9494
]),
95-
dt.datetime(
96-
2021, 12, 17,
97-
22, 22,
98-
18, 123456,
99-
dt.timezone(dt.timedelta(hours=2, minutes=30))
100-
)
95+
"2021-12-17 22:22:18.123456+02:30"
10196
)
10297
]
10398
)
10499
def test_byte_array_to_datetime(value: bytes, expected: dt.datetime) -> None:
105100
"""
106-
101+
Assert SQL_SS_TIMESTAMPOFFSET_STRUCT bytes convert to string in an expected isoformat
102+
https://docs.python.org/3/library/datetime.html#datetime.datetime.__str__
103+
https://learn.microsoft.com/sql/relational-databases/native-client-odbc-date-time/data-type-support-for-odbc-date-and-time-improvements#sql_ss_timestampoffset_struct
107104
"""
108-
assert byte_array_to_datetime(value) == expected
105+
assert str(byte_array_to_datetime(value)) == expected

0 commit comments

Comments
 (0)