Skip to content

Commit 646ef04

Browse files
Apply fixes from copilot review
1 parent a7d9b8e commit 646ef04

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

mssql_python/constants.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,4 @@ def get_attribute_set_timing(attribute):
501501
"packetsize": "PacketSize",
502502
}
503503

504-
def test_cursor_description(cursor):
505-
"""Test cursor description"""
506-
cursor.execute("SELECT database_id, name FROM sys.databases;")
507-
desc = cursor.description
508-
expected_description = [
509-
("database_id", 4, None, 10, 10, 0, False), # SQL_INTEGER
510-
("name", -9, None, 128, 128, 0, False), # SQL_WVARCHAR
511-
]
512-
assert len(desc) == len(expected_description), "Description length mismatch"
513-
for desc, expected in zip(desc, expected_description):
514-
assert desc == expected, f"Description mismatch: {desc} != {expected}"
504+
# (Function removed; no replacement needed)

mssql_python/cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ def _map_data_type(self, sql_type):
955955
ddbc_sql_const.SQL_LONGVARBINARY.value: bytes,
956956
ddbc_sql_const.SQL_GUID.value: uuid.UUID,
957957
ddbc_sql_const.SQL_SS_UDT.value: bytes, # UDTs mapped to bytes
958-
ddbc_sql_const.SQL_XML.value: xml, # XML mapped to str
958+
ddbc_sql_const.SQL_XML.value: str, # XML mapped to str
959959
ddbc_sql_const.SQL_DATETIME2.value: datetime.datetime,
960960
ddbc_sql_const.SQL_SMALLDATETIME.value: datetime.datetime,
961961
ddbc_sql_const.SQL_DATETIMEOFFSET.value: datetime.datetime,

tests/test_004_cursor.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ def test_fetchall(cursor):
999999

10001000

10011001
def test_fetchall_lob(cursor):
1002-
"""Test fetching all rows"""
1002+
"""Test fetching all rows with LOB columns"""
10031003
cursor.execute("SELECT * FROM #pytest_all_data_types")
10041004
rows = cursor.fetchall()
10051005
assert isinstance(rows, list), "fetchall should return a list"
@@ -13273,13 +13273,6 @@ def test_xml_malformed_input(cursor, db_connection):
1327313273
MULTIPOINT_WKT = "MULTIPOINT((-122.34900 47.65100), (-122.11100 47.67700))"
1327413274
COLLECTION_WKT = "GEOMETRYCOLLECTION(POINT(-122.34900 47.65100))"
1327513275

13276-
# Large geography for LOB testing
13277-
LARGE_POLYGON_WKT = (
13278-
"POLYGON(("
13279-
+ ", ".join([f"{-122.5 + i*0.001} {47.5 + i*0.001}" for i in range(5000)])
13280-
+ ", -122.5 47.5))"
13281-
)
13282-
1328313276

1328413277
def test_geography_basic_insert_fetch(cursor, db_connection):
1328513278
"""Test insert and fetch of a basic geography Point value."""

0 commit comments

Comments
 (0)