mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
This commit is contained in:
parent
c1b6f554e4
commit
c9ae09addf
30 changed files with 205 additions and 447 deletions
|
@ -308,12 +308,8 @@ class TestSimpleValidators(SimpleTestCase):
|
|||
self.assertEqual(repr(v), str_prefix("ValidationError({%(_)s'first': [%(_)s'First Problem']})"))
|
||||
|
||||
def test_regex_validator_flags(self):
|
||||
try:
|
||||
with self.assertRaises(TypeError):
|
||||
RegexValidator(re.compile('a'), flags=re.IGNORECASE)
|
||||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
self.fail("TypeError not raised when flags and pre-compiled regex in RegexValidator")
|
||||
|
||||
def test_max_length_validator_message(self):
|
||||
v = MaxLengthValidator(16, message='"%(value)s" has more than %(limit_value)d characters.')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue