typeddjango / django-stubs

PEP-484 stubs for Django
MIT License
1.58k stars 436 forks source link

try and use named arguments from caller for matching name #2294

Closed asottile closed 2 months ago

asottile commented 2 months ago

test failing prior to change:

__________________ nullable_foreign_key_with_init_overridden ___________________
/home/asottile/workspace/django-stubs/tests/typecheck/fields/test_related.yml:806: 
E   pytest_mypy_plugins.utils.TypecheckAssertionError: Invalid output: 
E   Actual:
E     main:2: note: Revealed type is "myapp.models.B" (diff)
E   Expected:
E     main:2: note: Revealed type is "Union[myapp.models.B, None]" (diff)
E   Alignment of first line difference:
E     E: ...te: Revealed type is "Union[myapp.models.B, None]"
E     A: ...te: Revealed type is "myapp.models.B"
E                                 ^

the FK example matches a similar one in sentry