- Notifications
You must be signed in to change notification settings - Fork11
FIX: Adding row string#136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR enhances theRow
class’s string output by introducing a user-facing__str__
method and refining the__repr__
for clearer debugging.
- Added
__str__
to return a stringified tuple of row values - Updated
__repr__
to use the built-inrepr
of the tuple for debugging
Comments suppressed due to low confidence (2)
mssql_python/row.py:69
- [nitpick] The
__repr__
output now omits the class name and only shows a bare tuple, which can be ambiguous during debugging. Consider including theRow
class name in the output (e.g.,f"Row({repr(tuple(self._values))})"
) to make the object type explicit.
return repr(tuple(self._values))
mssql_python/row.py:63
- There are no existing tests covering the new
__str__
method (and the updated__repr__
). Adding unit tests to verify their outputs will help prevent regressions and ensure correct formatting.
def __str__(self):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
lets add a testcase in test_cursor py file
6e11847
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ADO Work Item Reference
Summary
This pull request modifies the
Row
class inmssql_python/row.py
to improve its string representation methods. The changes include adding a__str__
method for user-friendly output and updating the__repr__
method to focus on debugging.Enhancements to string representation:
__str__
method to provide a user-friendly string representation of theRow
object by returning the tuple of its values as a string.__repr__
method to provide a more detailed representation for debugging purposes by using therepr
function on the tuple of values instead of a formatted string.