FIX: Remove duplicate test functions and bare except blocks#411
Open
dlevy-msft-sql wants to merge 6 commits intomicrosoft:mainfrom
Open
FIX: Remove duplicate test functions and bare except blocks#411dlevy-msft-sql wants to merge 6 commits intomicrosoft:mainfrom
dlevy-msft-sql wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Fixes microsoft#409 - Removed 28 duplicate test function definitions (~1,267 lines of dead code) - Kept the LAST occurrence of each duplicate (what Python actually runs) - test_decimal_separator_* (4 functions × 3 duplicates each) - test_lowercase_attribute (2 duplicates) - test_rowcount (1 duplicate - versions differed) - test_columns_nonexistent (1 duplicate - versions differed) - test_all_numeric_types_with_nulls (1 duplicate) - test_lob_* (4 functions × 1 duplicate each) - test_zero_length_complex_types (1 duplicate) - test_guid_with_nulls (1 duplicate) - test_datetimeoffset_with_nulls (1 duplicate) - test_decimal_conversion_edge_cases (1 duplicate) - test_fixed_length_* (3 functions × 1 duplicate each, binary version differed) - Fixed 53 bare \\�xcept:\\ blocks: - 29 replaced with \\DROP TABLE IF EXISTS\\ pattern (cleaner cleanup) - 24 replaced with \\�xcept Exception:\\ for expected error handling File reduced from 15,021 to 13,754 lines (-8.4%) All 423 tests pass.
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.pybind.ddbc_bindings.cpp: 69.3%
mssql_python.pybind.ddbc_bindings.h: 69.7%
mssql_python.pybind.connection.connection.cpp: 75.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 84.1%
mssql_python.cursor.py: 84.7%🔗 Quick Links
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes dead code and improves code quality in
tests/test_004_cursor.pyby eliminating 28 duplicate test function definitions and fixing 53 bare except blocks.Changes
Removed 28 duplicate test function definitions (~1,267 lines of dead code)
Python only runs the last definition when there are duplicate function names, so all earlier duplicates were dead code. This PR keeps the last (working) occurrence of each:
test_decimal_separator_*(4 functions)test_lowercase_attributetest_rowcounttest_columns_nonexistent.fetchall()test_all_numeric_types_with_nullstest_lob_*(4 functions)test_zero_length_complex_typestest_guid_with_nullstest_datetimeoffset_with_nullstest_decimal_conversion_edge_casestest_fixed_length_*(3 functions)Fixed 53 bare
except:blocksDROP TABLE IF EXISTSpattern (cleaner, no try/except needed)except Exception:for expected error handlingResults