1 | __test__ = {'BRIAN_PATCH_TESTS': """
|
---|
2 |
|
---|
3 | >>> from django.core.validators import *
|
---|
4 | >>> v = AllValidators([isLowerCase, isAlphaNumeric, isNotEmpty])
|
---|
5 |
|
---|
6 | >>> v('abc', '')
|
---|
7 |
|
---|
8 | >>> v('abC', '')
|
---|
9 | Traceback (most recent call last):
|
---|
10 | File "<console>", line 1, in ?
|
---|
11 | File "django/core/validators.py", line 522, in __call__
|
---|
12 | ValidationError: ['This field is invalid.']
|
---|
13 |
|
---|
14 | >>> v('a.c')
|
---|
15 | Traceback (most recent call last):
|
---|
16 | File "<console>", line 1, in ?
|
---|
17 | TypeError: __call__() takes exactly 3 arguments (2 given)
|
---|
18 |
|
---|
19 | >>> v('a c', '')
|
---|
20 | Traceback (most recent call last):
|
---|
21 | File "<console>", line 1, in ?
|
---|
22 | File "django/core/validators.py", line 522, in __call__
|
---|
23 | ValidationError: ['This field is invalid.']
|
---|
24 |
|
---|
25 | >>> v('', '')
|
---|
26 | Traceback (most recent call last):
|
---|
27 | File "<console>", line 1, in ?
|
---|
28 | File "django/core/validators.py", line 522, in __call__
|
---|
29 | ValidationError: ['This field is invalid.']
|
---|
30 |
|
---|
31 |
|
---|
32 | >>> v = RequiredIfAllOtherFieldsNotGiven(['email', 'name'])
|
---|
33 |
|
---|
34 | >>> v('', {'email': '', 'name': ''})
|
---|
35 | Traceback (most recent call last):
|
---|
36 | File "<console>", line 1, in ?
|
---|
37 | File "django/core/validators.py", line 499, in __call__
|
---|
38 | ValidationError: ['This field must be given if email and name are not given.']
|
---|
39 |
|
---|
40 | >>> v('22', {'email': '', 'name': ''})
|
---|
41 |
|
---|
42 | >>> v('22', {'email': 'test@example.com', 'name': ''})
|
---|
43 |
|
---|
44 | >>> v('', {'email': 'test@example.com', 'name': ''})
|
---|
45 |
|
---|
46 |
|
---|
47 | >>> v = RequiredIfOtherFieldsNotGiven(['email', 'name'])
|
---|
48 |
|
---|
49 | >>> v('', {'email': 'test@example.com', 'name': 'Brian'})
|
---|
50 |
|
---|
51 | >>> v('22', {'email': '', 'name': ''})
|
---|
52 |
|
---|
53 | >>> v('22', {'email': 'test@example.com', 'name': ''})
|
---|
54 |
|
---|
55 | >>> v('', {'email': '', 'name': ''})
|
---|
56 | Traceback (most recent call last):
|
---|
57 | File "<console>", line 1, in ?
|
---|
58 | File "django/core/validators.py", line 522, in __call__
|
---|
59 | ValidationError: ['This field must be given if email or name are not given.']
|
---|
60 |
|
---|
61 | >>> v('', {'email': 'test@example.com', 'name': ''})
|
---|
62 | Traceback (most recent call last):
|
---|
63 | File "<console>", line 1, in ?
|
---|
64 | File "django/core/validators.py", line 522, in __call__
|
---|
65 | ValidationError: ['This field must be given if email or name are not given.']
|
---|
66 |
|
---|
67 | """}
|
---|