fix @output decorator

This commit is contained in:
Maxim Kurnikov
2018-11-28 00:43:28 +03:00
parent ba058e340e
commit 96a265348b
4 changed files with 22 additions and 22 deletions

View File

@@ -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):