Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/typecheck/fields/test_nullable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,27 @@
text_nullable = models.CharField(max_length=100, null=True)
text = models.CharField(max_length=100)

- case: nullable_field_with_strict_optional_false
main: |
from myapp.models import MyModel
reveal_type(MyModel().text_nullable) # N: Revealed type is "builtins.str | None"
installed_apps:
- myapp
mypy_config: |
[mypy]
strict_optional = True

[mypy-myapp.*]
strict_optional = False
files:
- path: myapp/__init__.py
- path: myapp/models.py
content: |
from django.db import models
class MyModel(models.Model):
text_nullable = models.CharField(max_length=100, null=True)


- case: nullable_array_field
main: |
from myapp.models import MyModel
Expand Down
Loading