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

Fix test filters todo #1619

Merged
merged 2 commits into from
May 22, 2024
Merged

Fix test filters todo #1619

merged 2 commits into from
May 22, 2024

Conversation

waketzheng
Copy link
Contributor

Description

Fixes TODO item in tests/test_filters.py

Motivation and Context

Django get result of: ['17', '17', '12']
But test_mysql_myisam get result of ['12', '17', '17']
So I add .order_by("id")

To reproduce Django result:

python3 -m venv venv
source venv/*/activate
pip install django
python -m django startproject haha
cd haha
python manage.py startapp foo
echo 'from django.db import models

class CharPkModel(models.Model):
    id = models.CharField(max_length=64, primary_key=True)

class CharFkRelatedModel(models.Model):
    model = models.ForeignKey(CharPkModel, related_name="children", on_delete=models.CASCADE)
' > foo/models.py
echo 'INSTALLED_APPS.append("foo")' >> haha/settings.py
python manage.py makemigrations
python manage.py migrate
python manage.py shell
from foo.models import *
objs=CharPkModel.objects.bulk_create([CharPkModel(id=i) for i in '17 12 2001'.split()])
CharFkRelatedModel.objects.bulk_create([CharFkRelatedModel(model=i) for i in (objs[0], objs[0], objs[1])])
CharPkModel.objects.filter(children__isnull=False).values_list('id', flat=True)
image

How Has This Been Tested?

make ci

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.

@abondar abondar merged commit 1f6e823 into tortoise:develop May 22, 2024
7 checks passed
@waketzheng waketzheng deleted the fix-tests-todos branch June 11, 2024 03:27
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.

None yet

2 participants