-
-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate
db/models/test_constraints.yml
to 'assert_type' tests (#2204)
- Loading branch information
Showing
2 changed files
with
16 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Any | ||
|
||
from django.db.models import CheckConstraint, F, UniqueConstraint | ||
from django.db.models.functions import Lower | ||
from django.db.models.lookups import LessThan | ||
|
||
UniqueConstraint(Lower("name").desc(), "category", name="unique_lower_name_category") | ||
UniqueConstraint(fields=["name"], name="unqiue_name") | ||
# There's no overload case for passing both expression and 'fields' | ||
UniqueConstraint( # type: ignore[call-overload] | ||
Lower("name"), | ||
fields=["name"], # pyright: ignore[reportArgumentType] | ||
name="unique_mess", | ||
) | ||
|
||
CheckConstraint(name="less_than_constraint", check=LessThan[Any](F("months"), 1)) |
This file was deleted.
Oops, something went wrong.