diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py
index a1a48bf..a3a0675 100644
a
|
b
|
TEST_DATA = (
|
54 | 54 | (validate_ipv4_address, '25.1.1.', ValidationError), |
55 | 55 | (validate_ipv4_address, '25,1,1,1', ValidationError), |
56 | 56 | (validate_ipv4_address, '25.1 .1.1', ValidationError), |
| 57 | (validate_ipv4_address, ' 1.1.1.1', ValidationError), |
57 | 58 | |
58 | 59 | # validate_ipv6_address uses django.utils.ipv6, which |
59 | 60 | # is tested in much greater detail in it's own testcase |
… |
… |
TEST_DATA = (
|
64 | 65 | (validate_ipv6_address, '1:2', ValidationError), |
65 | 66 | (validate_ipv6_address, '::zzz', ValidationError), |
66 | 67 | (validate_ipv6_address, '12345::', ValidationError), |
| 68 | (validate_ipv6_address, ' fe80::1', ValidationError), |
67 | 69 | |
68 | 70 | (validate_ipv46_address, '1.1.1.1', None), |
69 | 71 | (validate_ipv46_address, '255.0.0.0', None), |
… |
… |
def create_simple_test_method(validator, expected, value, num):
|
159 | 161 | if expected is not None and issubclass(expected, Exception): |
160 | 162 | test_mask = 'test_%s_raises_error_%d' |
161 | 163 | def test_func(self): |
162 | | self.assertRaises(expected, validator, value) |
| 164 | # Do not use assertRaises, so as to be able to produce a more |
| 165 | # precise error message |
| 166 | try: |
| 167 | validator(value) |
| 168 | raise AssertionError("%s not raised for value '%s'" % ( |
| 169 | expected.__name__, value)) |
| 170 | except expected: |
| 171 | pass |
163 | 172 | else: |
164 | 173 | test_mask = 'test_%s_%d' |
165 | 174 | def test_func(self): |