forked from typeddjango/django-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_constraints.yml
47 lines (40 loc) · 1.37 KB
/
test_constraints.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
- case: unique_constraint_expressions
main: |
from django.db.models import Q, UniqueConstraint
from django.db.models.functions import Lower
UniqueConstraint(
Lower('name').desc(),
'category',
name='unique_lower_name_category',
)
- case: unique_constraint_fields
main: |
from django.db.models import Q, UniqueConstraint
from django.db.models.functions import Lower
UniqueConstraint(
fields=['name'],
name='unqiue_name',
)
- case: unique_constraint_expressions_fields
main: |
from django.db.models import Q, UniqueConstraint
from django.db.models.functions import Lower
UniqueConstraint(
Lower('name'),
fields=['name'],
name='unique_mess',
)
regex: true
out: |
main:4: error: No overload variant of "UniqueConstraint" matches argument types "Lower", "List\[str\]", "str"
main:4: note: Possible overload variants:
main:4: note: .*
main:4: note: .*
- case: constraint_violation_error_message
main: |
from django.db.models import CheckConstraint, Q
CheckConstraint(
check=Q(name__startswith='a'),
name='name_starts_with_a',
violation_error_message='Name must start with a',
)