Skip to content

Regression test for #2302 #2306

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Regression test for #2302 #2306

wants to merge 4 commits into from

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 1, 2024

Refs #2302

@sobolevn
Copy link
Member Author

sobolevn commented Aug 1, 2024

cc @flaeppe

@sobolevn
Copy link
Member Author

sobolevn commented Aug 1, 2024

Right now this test fails with:

_________________ alias_and_annotate_can_be_used_with_dynamic_new_fields __________________
/Users/sobolev/Desktop/django-stubs/tests/typecheck/managers/querysets/test_filter.yml:282: 
E   pytest_mypy_plugins.utils.TypecheckAssertionError: Invalid output: 
E   Actual:
E     main:10: error: Cannot resolve keyword 'alias_entries' into field. Choices are: entry, id  [misc] (diff)
E     main:16: error: Cannot resolve keyword 'alias_entries' into field. Choices are: entry, id  [misc] (diff)
E     main:22: error: Cannot resolve keyword 'alias_e' into field. Choices are: entry, id  [misc] (diff)
E   Expected:
E     main:22: error: Cannot resolve keyword 'alias_e' into field. Choices are: entry, id  [misc] (diff)
E   Alignment of first line difference:
E     E: main:22: error: Cannot resolve keyword 'alias_e' into field. Choices are...
E     A: main:10: error: Cannot resolve keyword 'alias_entries' into field. Choic...
E             ^

We need to:

  • Check how can we easily support .alias (while keeping it distinct from .annotate)
  • Make sure that the tests passx

Unrelated (I will create a new issue):

    Blog.objects.alias(
        alias_entries=models.Count("entry"),
    ).annotate(
        annotate_entries=models.Count("entry"),
    ).filter(alias_wrong=5, annotate_wrong=5)

^ This code does not fail for some reason

@flaeppe
Copy link
Member

flaeppe commented Aug 1, 2024

This code does not fail for some reason

I would suspect that has to do with the plugin code for .annotate

@sobolevn
Copy link
Member Author

sobolevn commented Aug 1, 2024

I created #2307 to track this separate issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants