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
Create regression test for related managers 2022 #967
Conversation
|
||
def process_user(user: User): | ||
reveal_type(user.bookingowner_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' | ||
reveal_type(user.booking_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could consider using typing_extensions.assert_type()
instead of reveal_type()
, which is less verbose.
But would need to ensure that testing dependencies are typing-extensions>=4.2.0
and mypy>=0.950
then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it won't work with our pytest-mypy-plugin
lib 🤔
ordering = ['-created_at'] | ||
|
||
def process_user(user: User): | ||
reveal_type(user.bookingowner_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reveal_type(user.bookingowner_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' | |
reveal_type(user.bookingowner_set) # N: Revealed type is "django.db.models.manager.RelatedManager[myapp.models.Booking]" |
|
||
def process_user(user: User): | ||
reveal_type(user.bookingowner_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' | ||
reveal_type(user.booking_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reveal_type(user.booking_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Booking]' | |
reveal_type(user.booking_set) # N: Revealed type is "django.db.models.manager.RelatedManager[myapp.models.Booking]" |
Closed in favor of #993. |
RelatedManagers do not get set up for me anymore with the latest plugin rewrites.
I took another stab at making a test case.
#902 (comment)