From 567cfc1601a5f475eea12bc5de53b849fa5dadea Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 28 Jun 2016 11:21:26 -0400 Subject: [1.10.x] Replaced use of TestCase.fail() with assertRaises(). Also removed try/except/fail antipattern that hides exceptions. Backport of c9ae09addffb839403312131d4251e9d8b454508 from master --- tests/validators/tests.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tests/validators') 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.') -- cgit v1.3