summaryrefslogtreecommitdiff
path: root/tests/validators
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerGitHub <noreply@github.com>2016-06-28 11:21:26 -0400
commitc9ae09addffb839403312131d4251e9d8b454508 (patch)
tree74913fbe2e90d88e094f8594947ebf313ec5f12f /tests/validators
parentc1b6f554e405fe733e8d80f7e3d77c277810e707 (diff)
downloaddjango-c9ae09addffb839403312131d4251e9d8b454508.tar.gz
Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
Diffstat (limited to 'tests/validators')
-rw-r--r--tests/validators/tests.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index 3266b5832b..56ebbe4cce 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -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.')