Skip to content

Commit de3c2e8

Browse files
committed
Formatting tests files using black formatter
1 parent 45866f9 commit de3c2e8

10 files changed

Lines changed: 350 additions & 174 deletions

tests/test_003_connection.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -992,14 +992,16 @@ def test_execute_with_large_parameters(db_connection, conn_str):
992992
pytest.skip("Skipping for Azure SQL - large parameter tests may cause timeouts")
993993

994994
# Test with a temporary table for large data
995-
cursor = db_connection.execute("""
995+
cursor = db_connection.execute(
996+
"""
996997
DROP TABLE IF EXISTS #large_params_test;
997998
CREATE TABLE #large_params_test (
998999
id INT,
9991000
large_text NVARCHAR(MAX),
10001001
large_binary VARBINARY(MAX)
10011002
)
1002-
""")
1003+
"""
1004+
)
10031005
cursor.close()
10041006

10051007
try:
@@ -2124,10 +2126,12 @@ def test_timeout_long_query(db_connection):
21242126
while retry_count < max_retries:
21252127
start_time = time.perf_counter()
21262128
try:
2127-
cursor.execute("""
2129+
cursor.execute(
2130+
"""
21282131
SELECT COUNT(*) FROM sys.objects a, sys.objects b, sys.objects c
21292132
WHERE a.object_id = b.object_id * c.object_id
2130-
""")
2133+
"""
2134+
)
21312135
cursor.fetchall()
21322136
elapsed_time = time.perf_counter() - start_time
21332137
break # Success, exit retry loop

tests/test_004_cursor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15406,7 +15406,9 @@ def test_native_uuid_false_returns_strings(db_connection):
1540615406
cursor.execute("SELECT id, name FROM #test_native_uuid_false")
1540715407
row = cursor.fetchone()
1540815408
assert isinstance(row[0], str), f"With native_uuid=False, expected str, got {type(row[0])}"
15409-
assert row[0] == str(test_uuid).upper(), f"UUID string mismatch: {row[0]} != {str(test_uuid).upper()}"
15409+
assert (
15410+
row[0] == str(test_uuid).upper()
15411+
), f"UUID string mismatch: {row[0]} != {str(test_uuid).upper()}"
1541015412

1541115413
# fetchall
1541215414
cursor.execute("SELECT id, name FROM #test_native_uuid_false")
@@ -15845,7 +15847,9 @@ def test_two_connections_different_native_uuid(conn_str):
1584515847

1584615848
assert isinstance(row_uuid[0], uuid.UUID), f"Expected uuid.UUID, got {type(row_uuid[0])}"
1584715849
assert isinstance(row_string[0], str), f"Expected str, got {type(row_string[0])}"
15848-
assert str(row_uuid[0]).upper() == row_string[0], "Values should be equal as uppercase strings"
15850+
assert (
15851+
str(row_uuid[0]).upper() == row_string[0]
15852+
), "Values should be equal as uppercase strings"
1584915853

1585015854
drop_table_if_exists(cursor_uuid, "#test_dual_conn")
1585115855
drop_table_if_exists(cursor_string, "##test_dual_conn_shared")

tests/test_011_performance_stress.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ def test_exception_mid_batch_no_corrupt_data(cursor, db_connection):
5353
drop_table_if_exists(cursor, "#pytest_mid_batch_exception")
5454

5555
# Create simple table to test batch processing integrity
56-
cursor.execute("""
56+
cursor.execute(
57+
"""
5758
CREATE TABLE #pytest_mid_batch_exception (
5859
id INT,
5960
value NVARCHAR(50),
6061
amount FLOAT
6162
)
62-
""")
63+
"""
64+
)
6365
db_connection.commit()
6466

6567
# Insert 1000 rows using individual inserts to avoid executemany complications
@@ -119,14 +121,16 @@ def test_python_c_api_null_handling_memory_pressure(cursor, db_connection):
119121
drop_table_if_exists(cursor, "#pytest_memory_pressure")
120122

121123
# Create table with various string types
122-
cursor.execute("""
124+
cursor.execute(
125+
"""
123126
CREATE TABLE #pytest_memory_pressure (
124127
id INT,
125128
varchar_col VARCHAR(1000),
126129
nvarchar_col NVARCHAR(1000),
127130
varbinary_col VARBINARY(1000)
128131
)
129-
""")
132+
"""
133+
)
130134
db_connection.commit()
131135

132136
# Insert test data
@@ -188,14 +192,16 @@ def test_thousands_of_empty_strings_allocation_stress(cursor, db_connection):
188192
try:
189193
drop_table_if_exists(cursor, "#pytest_empty_stress")
190194

191-
cursor.execute("""
195+
cursor.execute(
196+
"""
192197
CREATE TABLE #pytest_empty_stress (
193198
id INT,
194199
empty_varchar VARCHAR(100),
195200
empty_nvarchar NVARCHAR(100),
196201
empty_varbinary VARBINARY(100)
197202
)
198-
""")
203+
"""
204+
)
199205
db_connection.commit()
200206

201207
# Insert 10,000 rows with empty strings
@@ -271,14 +277,16 @@ def test_large_result_set_100k_rows_no_overflow(cursor, db_connection):
271277
try:
272278
drop_table_if_exists(cursor, "#pytest_100k_rows")
273279

274-
cursor.execute("""
280+
cursor.execute(
281+
"""
275282
CREATE TABLE #pytest_100k_rows (
276283
id INT,
277284
varchar_col VARCHAR(50),
278285
nvarchar_col NVARCHAR(50),
279286
int_col INT
280287
)
281-
""")
288+
"""
289+
)
282290
db_connection.commit()
283291

284292
# Insert 100,000 rows with sequential IDs and predictable data
@@ -367,14 +375,16 @@ def test_very_large_lob_10mb_data_integrity(cursor, db_connection):
367375
try:
368376
drop_table_if_exists(cursor, "#pytest_10mb_lob")
369377

370-
cursor.execute("""
378+
cursor.execute(
379+
"""
371380
CREATE TABLE #pytest_10mb_lob (
372381
id INT,
373382
varchar_lob VARCHAR(MAX),
374383
nvarchar_lob NVARCHAR(MAX),
375384
varbinary_lob VARBINARY(MAX)
376385
)
377-
""")
386+
"""
387+
)
378388
db_connection.commit()
379389

380390
# Create 10MB+ data
@@ -484,13 +494,15 @@ def worker_thread(thread_id: int, conn_str: str, results_list: List, errors_list
484494
table_name = f"#pytest_concurrent_t{thread_id}"
485495
drop_table_if_exists(cursor, table_name)
486496

487-
cursor.execute(f"""
497+
cursor.execute(
498+
f"""
488499
CREATE TABLE {table_name} (
489500
id INT,
490501
thread_id INT,
491502
data VARCHAR(100)
492503
)
493-
""")
504+
"""
505+
)
494506
conn.commit()
495507

496508
# Insert thread-specific data

0 commit comments

Comments
 (0)