Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement last for querysets and models #1756

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

ruitcatarino
Copy link
Contributor

@ruitcatarino ruitcatarino commented Nov 2, 2024

Description

This implements the last (https://docs.djangoproject.com/en/5.1/ref/models/querysets/#last methods similar to Django.

Motivation and Context

Like I explained in the issue #1753 I miss this method as someone coming from Django.

How Has This Been Tested?

Well I implemented tests to validate the usage of this method and ran them with make test. I also did some local testing.

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.

The existing tests are not passing in the develop branch for me. But the new created tests are passing. I'll post the output of my tests here

==================================================================================================== short test summary info ====================================================================================================
FAILED tests/test_queryset.py::TestQueryset::test_delete_limit - tortoise.exceptions.OperationalError: near "LIMIT": syntax error
FAILED tests/test_queryset.py::TestQueryset::test_delete_limit_order_by - tortoise.exceptions.OperationalError: near "ORDER": syntax error
FAILED tests/test_queryset.py::TestQueryset::test_delete - tortoise.exceptions.OperationalError: near "ORDER": syntax error
FAILED tests/test_update.py::TestUpdate::test_update_with_limit_ordering - tortoise.exceptions.OperationalError: near "ORDER": syntax error
ERROR tests/test_default.py
ERROR tests/test_two_databases.py
4 failed, 1156 passed, 67 skipped, 4 xfailed, 20 warnings, 2 errors in 69.54s (0:01:09)

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11646693216

Details

  • 13 of 14 (92.86%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 89.074%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tortoise/queryset.py 10 11 90.91%
Totals Coverage Status
Change from base Build 11641255981: 0.005%
Covered Lines: 6025
Relevant Lines: 6650

💛 - Coveralls

@abondar abondar merged commit aee6e5c into tortoise:develop Nov 4, 2024
7 checks 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.

3 participants