mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
fix @output decorator
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from test.pytest_plugin import reveal_type
|
||||
from test.pytest_plugin import reveal_type, output
|
||||
from test.pytest_tests.base import BaseDjangoPluginTestCase
|
||||
|
||||
|
||||
@@ -48,6 +48,20 @@ class TestForeignKey(BaseDjangoPluginTestCase):
|
||||
publisher = Publisher()
|
||||
reveal_type(publisher.books) # E: Revealed type is 'django.db.models.query.QuerySet[main.Book]'
|
||||
|
||||
@output(
|
||||
"""
|
||||
main:4: warning: to= parameter type Instance is not supported
|
||||
"""
|
||||
)
|
||||
def test_to_parameter_as_string_fallbacks_to_any(self):
|
||||
from django.db import models
|
||||
|
||||
class Book(models.Model):
|
||||
publisher = models.ForeignKey(to='Publisher', on_delete=models.CASCADE)
|
||||
|
||||
book = Book()
|
||||
reveal_type(book.publisher) # E: Revealed type is 'Any'
|
||||
|
||||
|
||||
class TestOneToOneField(BaseDjangoPluginTestCase):
|
||||
def test_onetoone_field(self):
|
||||
|
||||
Reference in New Issue
Block a user