Skip to content
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

Add missing type checking for acreate #2093

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 19 additions & 0 deletions tests/typecheck/models/test_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,22 @@
id = models.IntegerField(primary_key=True)
class MyModel3(models.Model):
default = models.IntegerField(default=return_int)

- case: default_manager_acreate_is_typechecked
main: |
import asyncio
from myapp.models import User
async def amain() -> None:
await User.objects.acreate(pk=1, name='Max', age=10)
await User.objects.acreate(age=[]) # E: Incompatible type for "age" of "User" (got "List[Any]", expected "Union[float, int, str, Combinable]") [misc]
installed_apps:
- myapp
files:
- path: myapp/__init__.py
- path: myapp/models.py
content: |
from django.db import models

class User(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
Loading