Skip to content

Conversation

@sam-dawnops
Copy link

Description

Add a dedicated ParamsError message for integer indexing on QuerySet and cover it with a regression test.

Motivation and Context

QuerySet is lazy and supports slicing, but queryset[5] currently raises a generic message. This change makes that failure mode clearer and tells users how to evaluate/query for a single item correctly.

How Has This Been Tested?

  • uv run --frozen --group test --group contrib --extra psycopg pytest -q tests/test_queryset.py
  • uv run --frozen --group dev ruff check tests/test_queryset.py tortoise/queryset.py

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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