Visitar URL original
test: add coverage for query key sorting in URL.render_as_string by Sudhakar7J · Pull Request #13785 · sqlalchemy/sqlalchemy · GitHub
Skip to content

test: add coverage for query key sorting in URL.render_as_string - #13785

Closed
Sudhakar7J wants to merge 1 commit into
sqlalchemy:mainfrom
Sudhakar7J:test/url-render-query-key-sort
Closed

Sudhakar7J wants to merge 1 commit into
sqlalchemy:mainfrom
Sudhakar7J:test/url-render-query-key-sort

Conversation

@Sudhakar7J

Copy link
Copy Markdown

Description

Adds a regression test for query key ordering in URL.render_as_string(). Existing test_parseconnect.py cases use alphabetically ordered query strings, so the current keys.sort() behavior was not exercised. This adds a case with unsorted keys and asserts stable string rendering, equality, hashing, and set behavior.

Refs #13784

Checklist

  • This pull request includes a test case (test-only change).
  • The change is covered by existing SQLAlchemy behavior (render_as_string sorts query keys; __hash__ uses the rendered string).

Local verification

  • uv run --no-project --with pytest --with typing-extensions python -m pytest test/engine/test_parseconnect.py -k "render_as_string_query_key_sort" -q → 1 passed, 151 deselected.
  • Sanity check against lib/ source: make_url("d://h/db?b=2&a=1").render_as_string() returns d://h/db?a=1&b=2 and hashes/equality are stable.

Windows 11, Python 3.15.2, pytest 9.2.0 (SQLAlchemy main @ 4e974a0).

The query keys are sorted in render_as_string, but existing parse/connect tests used alphabetically ordered query strings, so removing the sort did not fail them. Add a case with unsorted keys and assert stable rendering and hashing.

Refs: sqlalchemy#13784
@sqla-tester

Copy link
Copy Markdown
Collaborator

Hi, and thanks for the pull request!

This project accepts pull requests only for issues that a maintainer has already marked with the open for pull requests label. That way we can settle on an approach before anyone spends time writing code.

This pull request references issue #13784, which hasn't been marked open for pull requests, so the change isn't authorized yet and I'm closing it automatically. Once a maintainer adds the label to #13784, reopen this pull request and it will stay open. If #13784 needs more detail before that can happen, a complete runnable example is usually the missing piece, and adding one to the issue is the fastest way to get there.

This is automatic and procedural. It isn't a judgment on your change, and nothing you've written here is lost.

Thanks for your interest in the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants