28
28
(validate_integer, '42', None),
29
29
(validate_integer, '-42', None),
30
30
(validate_integer, -42, None),
31
-
(validate_integer, -42.5, None),
32
31
32
+
(validate_integer, -42.5, ValidationError),
33
33
(validate_integer, None, ValidationError),
34
34
(validate_integer, 'a', ValidationError),
35
+
(validate_integer, '\n42', ValidationError),
36
+
(validate_integer, '42\n', ValidationError),
35
37
36
38
(validate_email, 'email@here.com', None),
37
39
(validate_email, 'weirder-email@here.and.there.com', None),
72
74
# Max length of domain name in email is 249 (see validator for calculation)
73
75
(validate_email, 'a@%s.us' % ('a' * 249), None),
74
76
(validate_email, 'a@%s.us' % ('a' * 250), ValidationError),
77
+
# Trailing newlines in username or domain not allowed
78
+
(validate_email, 'a@b.com\n', ValidationError),
79
+
(validate_email, 'a\n@b.com', ValidationError),
80
+
(validate_email, '"test@test"\n@example.com', ValidationError),
81
+
(validate_email, 'a@[127.0.0.1]\n', ValidationError),
75
82
76
83
(validate_slug, 'slug-ok', None),
77
84
(validate_slug, 'longer-slug-still-ok', None),
84
91
(validate_slug, 'some@mail.com', ValidationError),
85
92
(validate_slug, '你好', ValidationError),
86
93
(validate_slug, '\n', ValidationError),
94
+
(validate_slug, 'trailing-newline\n', ValidationError),
87
95
88
96
(validate_ipv4_address, '1.1.1.1', None),
89
97
(validate_ipv4_address, '255.0.0.0', None),
93
101
(validate_ipv4_address, '25.1.1.', ValidationError),
94
102
(validate_ipv4_address, '25,1,1,1', ValidationError),
95
103
(validate_ipv4_address, '25.1 .1.1', ValidationError),
104
+
(validate_ipv4_address, '1.1.1.1\n', ValidationError),
96
105
97
106
# validate_ipv6_address uses django.utils.ipv6, which
98
107
# is tested in much greater detail in its own testcase
126
135
(validate_comma_separated_integer_list, '', ValidationError),
127
136
(validate_comma_separated_integer_list, 'a,b,c', ValidationError),
128
137
(validate_comma_separated_integer_list, '1, 2, 3', ValidationError),
138
+
(validate_comma_separated_integer_list, '1,2,3\n', ValidationError),
129
139
130
140
(MaxValueValidator(10), 10, None),
131
141
(MaxValueValidator(10), -10, None),
159
169
(URLValidator(EXTENDED_SCHEMES), 'git://example.com/', None),
160
170
161
171
(URLValidator(EXTENDED_SCHEMES), 'git://-invalid.com', ValidationError),
172
+
# Trailing newlines not accepted
173
+
(URLValidator(), 'http://www.djangoproject.com/\n', ValidationError),
174
+
(URLValidator(), 'http://[::ffff:192.9.5.5]\n', ValidationError),
162
175
163
176
(BaseValidator(True), True, None),
164
177
(BaseValidator(True), False, ValidationError),
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4