docs: correct psycopg paramstyle in test_postgres.py comments - #10
Merged
Conversation
The module docstring and test_select_with_string_param described psycopg as using the `format`/`%s` paramstyle, but psycopg 3.x reports `pyformat`: the compiler emits `%(p0)s` and binds params from a dict (Dialect.format_params), as engine.py's own information_schema comment already notes. `format`/`%s` is pg8000's style, not psycopg's. Comment-only; the tests pass unchanged.
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.
Fix incorrect psycopg paramstyle comments
Comment-only; corrects a comment/code mismatch flagged during the comment pass.
tests/test_postgres.pyclaimed the tests exercise psycopg'sformatparamstyle (
%s). That's wrong: psycopg 3.x (the[postgres]extra) reportspyformat, soDialect._detect_paramstylereturns"pyformat",placeholder()emits%(p0)s, andformat_paramsbinds a dict — whichis exactly what
engine.py'sinformation_schemacomment already documents("psycopg3 (and psycopg2) report 'pyformat' … only pg8000 uses 'format'").
The tests always passed (pyformat works on psycopg); only the comments
misdescribed the mechanism. Fixed:
pyformat/%(p0)s(dict-bound), and attributes the bareformat/%sstyle topg8000;test_select_with_string_param—pyformat/%(p0)sviaDialect.format_params.No code or test behavior changed. Gate green:
ruff,mypy,pytest(119 passed, 15 skipped).