summaryrefslogtreecommitdiff
path: root/tests/forms_tests/field_tests/test_combofield.py
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2022-02-03 20:24:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch)
treef0506b668a013d0063e5fba3dbf4863b466713ba /tests/forms_tests/field_tests/test_combofield.py
parentf68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff)
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/forms_tests/field_tests/test_combofield.py')
-rw-r--r--tests/forms_tests/field_tests/test_combofield.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/tests/forms_tests/field_tests/test_combofield.py b/tests/forms_tests/field_tests/test_combofield.py
index 481783fe2e..d433fdf2b3 100644
--- a/tests/forms_tests/field_tests/test_combofield.py
+++ b/tests/forms_tests/field_tests/test_combofield.py
@@ -4,25 +4,34 @@ from django.test import SimpleTestCase
class ComboFieldTest(SimpleTestCase):
-
def test_combofield_1(self):
f = ComboField(fields=[CharField(max_length=20), EmailField()])
- self.assertEqual('test@example.com', f.clean('test@example.com'))
- with self.assertRaisesMessage(ValidationError, "'Ensure this value has at most 20 characters (it has 28).'"):
- f.clean('longemailaddress@example.com')
- with self.assertRaisesMessage(ValidationError, "'Enter a valid email address.'"):
- f.clean('not an email')
+ self.assertEqual("test@example.com", f.clean("test@example.com"))
+ with self.assertRaisesMessage(
+ ValidationError,
+ "'Ensure this value has at most 20 characters (it has 28).'",
+ ):
+ f.clean("longemailaddress@example.com")
+ with self.assertRaisesMessage(
+ ValidationError, "'Enter a valid email address.'"
+ ):
+ f.clean("not an email")
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
- f.clean('')
+ f.clean("")
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean(None)
def test_combofield_2(self):
f = ComboField(fields=[CharField(max_length=20), EmailField()], required=False)
- self.assertEqual('test@example.com', f.clean('test@example.com'))
- with self.assertRaisesMessage(ValidationError, "'Ensure this value has at most 20 characters (it has 28).'"):
- f.clean('longemailaddress@example.com')
- with self.assertRaisesMessage(ValidationError, "'Enter a valid email address.'"):
- f.clean('not an email')
- self.assertEqual('', f.clean(''))
- self.assertEqual('', f.clean(None))
+ self.assertEqual("test@example.com", f.clean("test@example.com"))
+ with self.assertRaisesMessage(
+ ValidationError,
+ "'Ensure this value has at most 20 characters (it has 28).'",
+ ):
+ f.clean("longemailaddress@example.com")
+ with self.assertRaisesMessage(
+ ValidationError, "'Enter a valid email address.'"
+ ):
+ f.clean("not an email")
+ self.assertEqual("", f.clean(""))
+ self.assertEqual("", f.clean(None))