diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 19ca978c45..a86d443e33 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -14,6 +14,7 @@ from django.forms import ( DateField, DateTimeField, EmailField, + Field, FileField, FileInput, FloatField, @@ -35,10 +36,9 @@ from django.forms import ( TextInput, TimeField, ValidationError, - forms, ) from django.forms.renderers import DjangoTemplates, get_default_renderer -from django.forms.utils import ErrorList +from django.forms.utils import ErrorDict, ErrorList from django.http import QueryDict from django.template import Context, Template from django.test import SimpleTestCase @@ -1656,7 +1656,7 @@ class FormsTestCase(SimpleTestCase): self._errors = e.update_error_dict(self._errors) try: - raise ValidationError({"code": forms.ErrorList(["Code error 3."])}) + raise ValidationError({"code": ErrorList(["Code error 3."])}) except ValidationError as e: self._errors = e.update_error_dict(self._errors) @@ -1680,7 +1680,7 @@ class FormsTestCase(SimpleTestCase): self.assertFalse(form.is_valid()) # update_error_dict didn't lose track of the ErrorDict type. - self.assertIsInstance(form._errors, forms.ErrorDict) + self.assertIsInstance(form._errors, ErrorDict) self.assertEqual( dict(form.errors), @@ -2738,7 +2738,7 @@ Options: microseconds, ) - class DateTimeForm(forms.Form): + class DateTimeForm(Form): dt = DateTimeField(initial=FakeTime().now, disabled=disabled) return DateTimeForm({}) @@ -2914,7 +2914,7 @@ Options: ) def test_filefield_initial_callable(self): - class FileForm(forms.Form): - file1 = forms.FileField(initial=lambda: "resume.txt") + class FileForm(Form): + file1 = FileField(initial=lambda: "resume.txt") f = FileForm({}) self.assertEqual(f.errors, {}) @@ -3579,7 +3579,7 @@ Options: return {} return super().to_python(value) - class JSONForm(forms.Form): + class JSONForm(Form): json = CustomJSONField() form = JSONForm(data={"json": "{}"})