summaryrefslogtreecommitdiff
path: root/tests/test_utils
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_utils')
-rw-r--r--tests/test_utils/tests.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 6869f49666..00c9c0fa2b 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -363,7 +363,8 @@ class AssertTemplateUsedContextManagerTests(SimpleTestCase):
with self.assertTemplateUsed(template_name='template_used/base.html'):
pass
- with six.assertRaisesRegex(self, AssertionError, r'^template_used/base\.html.*template_used/alternative\.html$'):
+ with six.assertRaisesRegex(
+ self, AssertionError, r'^template_used/base\.html.*template_used/alternative\.html$'):
with self.assertTemplateUsed('template_used/base.html'):
render_to_string('template_used/alternative.html')
@@ -519,13 +520,16 @@ class HTMLEqualTests(SimpleTestCase):
<td><input type="text" value="1940-10-9" name="birthday" id="id_birthday" /></td></tr>""",
"""
<tr><th>
- <label for="id_first_name">First name:</label></th><td><input type="text" name="first_name" value="John" id="id_first_name" />
+ <label for="id_first_name">First name:</label></th><td>
+ <input type="text" name="first_name" value="John" id="id_first_name" />
</td></tr>
<tr><th>
- <label for="id_last_name">Last name:</label></th><td><input type="text" name="last_name" value="Lennon" id="id_last_name" />
+ <label for="id_last_name">Last name:</label></th><td>
+ <input type="text" name="last_name" value="Lennon" id="id_last_name" />
</td></tr>
<tr><th>
- <label for="id_birthday">Birthday:</label></th><td><input type="text" name="birthday" value="1940-10-9" id="id_birthday" />
+ <label for="id_birthday">Birthday:</label></th><td>
+ <input type="text" name="birthday" value="1940-10-9" id="id_birthday" />
</td></tr>
""")
@@ -645,7 +649,11 @@ class HTMLEqualTests(SimpleTestCase):
def test_unicode_handling(self):
response = HttpResponse('<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>')
- self.assertContains(response, '<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>', html=True)
+ self.assertContains(
+ response,
+ '<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>',
+ html=True
+ )
class JSONEqualTests(SimpleTestCase):
@@ -805,9 +813,14 @@ class AssertFieldOutputTests(SimpleTestCase):
def test_assert_field_output(self):
error_invalid = ['Enter a valid email address.']
self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid})
- self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid + ['Another error']})
- self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'Wrong output'}, {'aaa': error_invalid})
- self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': ['Come on, gimme some well formatted data, dude.']})
+ with self.assertRaises(AssertionError):
+ self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid + ['Another error']})
+ with self.assertRaises(AssertionError):
+ self.assertFieldOutput(EmailField, {'a@a.com': 'Wrong output'}, {'aaa': error_invalid})
+ with self.assertRaises(AssertionError):
+ self.assertFieldOutput(
+ EmailField, {'a@a.com': 'a@a.com'}, {'aaa': ['Come on, gimme some well formatted data, dude.']}
+ )
def test_custom_required_message(self):
class MyCustomField(IntegerField):