summaryrefslogtreecommitdiff
path: root/tests/validators/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerTim Graham <timograham@gmail.com>2016-07-01 09:58:56 -0400
commit567cfc1601a5f475eea12bc5de53b849fa5dadea (patch)
treec471ba1af748008e4fbe9faee8cf51d4dffcd263 /tests/validators/tests.py
parent9c48e17480432b8723fcdcc262d8d62866e93a4f (diff)
[1.10.x] Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions. Backport of c9ae09addffb839403312131d4251e9d8b454508 from master
Diffstat (limited to 'tests/validators/tests.py')
-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.')